Skip to content

Commit cf8572a

Browse files
committed
[GR-18163] Update FFI specs and fix definitions of FFI::Pointer#put_array_of_* (#1525)
PullRequest: truffleruby/2246
2 parents f6b25b2 + ff8619d commit cf8572a

File tree

65 files changed

+451
-4912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+451
-4912
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Bug fixes:
1212
* Fixed `String#unpack` for `w*` format (#2143).
1313
* Fixed issue with ``Kernel#` `` when invalid UTF-8 given (#2118).
1414
* Fixed issue with `Method#to_proc` and special variable storage (#2156).
15+
* Add missing `offset` parameter for `FFI::Pointer#put_array_of_*` (#1525).
1516

1617
Compatibility:
1718

lib/truffle/ffi/library.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def ffi_lib(*names)
115115
rescue Exception => ex
116116
ldscript = false
117117
if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/
118-
if File.read($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/
118+
if File.binread($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/
119119
libname = $1
120120
ldscript = true
121121
end

lib/truffle/ffi/platform.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ def self.is_os(os)
141141
"#{LIBPREFIX}c.#{LIBSUFFIX}"
142142
end
143143

144+
LITTLE_ENDIAN = 1234 unless defined?(LITTLE_ENDIAN)
145+
BIG_ENDIAN = 4321 unless defined?(BIG_ENDIAN)
146+
unless defined?(BYTE_ORDER)
147+
BYTE_ORDER = [0x12345678].pack("I") == [0x12345678].pack("N") ? BIG_ENDIAN : LITTLE_ENDIAN
148+
end
149+
144150
# Test if current OS is a *BSD (include MAC)
145151
# @return [Boolean]
146152
def self.bsd?

lib/truffle/ffi/platform/aarch64-freebsd/types.conf

Lines changed: 0 additions & 128 deletions
This file was deleted.

lib/truffle/ffi/platform/aarch64-freebsd12/types.conf

Lines changed: 0 additions & 128 deletions
This file was deleted.

0 commit comments

Comments
 (0)