diff options
author | Jeff Williams <jeffsmessages@gmail.com> | 2013-10-29 15:40:25 -0400 |
---|---|---|
committer | Jeff Williams <jeffsmessages@gmail.com> | 2013-10-29 15:40:25 -0400 |
commit | 52a5c3e27142f93fad60e2c4ac26afba723d1e63 (patch) | |
tree | 3b7a9e358db45bd3abe440a9de61a5af053402eb | |
parent | e40243a224a7aedc3cd36c67ee11d847f24f99c5 (diff) | |
download | ffi-52a5c3e27142f93fad60e2c4ac26afba723d1e63.tar.gz |
Improve loading of linker script .so files
* On some versions of Linux the dlopen error message for linker scripts is
"file too short" instead of "invalid ELF header".
* On some Linux distributions the linker script uses the INPUT directive
instead of GROUP
* Sometimes the INPUT directive is followed by a library name and in addition
more linker options (which we can ignore)
-rw-r--r-- | lib/ffi/library.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ffi/library.rb b/lib/ffi/library.rb index fcb8046..a09cb92 100644 --- a/lib/ffi/library.rb +++ b/lib/ffi/library.rb @@ -135,8 +135,8 @@ module FFI rescue Exception => ex ldscript = false - if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*invalid ELF header/ - if File.read($1) =~ /GROUP *\( *([^ \)]+) *\)/ + if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short)/ + if File.read($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/ libname = $1 ldscript = true end |