File tree Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Expand file tree Collapse file tree 2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,11 @@ def dlopen library
111
111
case line
112
112
when /\A \s *(?:INPUT|GROUP)\s *\( \s *([^\s ,\) ]+)/
113
113
# TODO: Should we support multiple files?
114
- return dlopen ( $1)
114
+ first_input = $1
115
+ if first_input . start_with? ( "-l" )
116
+ first_input = "lib#{ first_input [ 2 ..-1 ] } .so"
117
+ end
118
+ return dlopen ( first_input )
115
119
end
116
120
end
117
121
end
Original file line number Diff line number Diff line change @@ -34,13 +34,34 @@ def test_dlopen_linker_script_input_linux
34
34
omit ( "Fiddle::Handle#file_name doesn't exist in FFI backend" )
35
35
end
36
36
37
- # libncurses.so uses INPUT() on Debian GNU/Linux
37
+ # libncurses.so uses INPUT() on Debian GNU/Linux and Arch Linux:
38
+ #
39
+ # Debian GNU/Linux:
40
+ #
38
41
# $ cat /usr/lib/x86_64-linux-gnu/libncurses.so
39
42
# INPUT(libncurses.so.6 -ltinfo)
43
+ #
44
+ # Arch Linux:
45
+ # $ cat /usr/lib/libncurses.so
46
+ # INPUT(-lncursesw)
40
47
handle = Fiddle . dlopen ( "libncurses.so" )
41
48
begin
42
- assert_equal ( "libncurses.so" ,
43
- File . basename ( handle . file_name , ".*" ) )
49
+ # /usr/lib/x86_64-linux-gnu/libncurses.so.6 ->
50
+ # libncurses.so.6
51
+ normalized_file_name = File . basename ( handle . file_name )
52
+ # libncurses.so.6 ->
53
+ # libncurses.so
54
+ #
55
+ # libncursesw.so ->
56
+ # libncursesw.so
57
+ normalized_file_name = normalized_file_name . sub ( /\. so(\. \d +)+\z / , ".so" )
58
+ # libncurses.so ->
59
+ # libncurses.so
60
+ #
61
+ # libncursesw.so ->
62
+ # libncurses.so
63
+ normalized_file_name = normalized_file_name . sub ( /ncursesw/ , "ncurses" )
64
+ assert_equal ( "libncurses.so" , normalized_file_name )
44
65
ensure
45
66
handle . close
46
67
end
You can’t perform that action at this time.
0 commit comments