[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[ruby-core:63090] [ruby-trunk - Bug #9928] Fiddle::TestHandle#test_NEXT fails on AIX due to unexported symbols of extension libraries
From:
nobu@...
Date:
2014-06-11 02:29:32 UTC
List:
ruby-core #63090
Issue #9928 has been updated by Nobuyoshi Nakada.
Rei Odaira wrote:
> The reason for this is a little bit complicated. `Fiddle::TestHandle#test_NEXT` tests the behavior of `RTLD_NEXT` for `dlsym(3)`. According to the manual, `RTLD_NEXT` of AIX should behave like that of BSD, so the following part in `Fiddle::TestHandle#test_NEXT` should succeed, but in fact it fails.
Does AIX support `dlopen()` now?
> The problem is that on AIX, Ruby's extension libraries do not export their symbols, because they are loaded not by dlopen(3)/dlsym(3) but by load(3). The build process on AIX only specifies `Init_*` functions as the entry points of the extension shared libraries. This means `Init_objspace` cannot be the search target of `RTLD_NEXT`, and the test above results in nil. (FYI, the symbols in the modules loaded by load(3) can be found by `RTLD_NEXT` if they are exported.)
Will it solve if dlopen()/dlsym() is used instead?
> One way to solve this is to somehow export the `Init_objspace` function. However, specifying -Wl,-bexpall does not export the entry points, so we need to specify -Wl,-bexpfull, which looks like overkill for just passing this test.
Or by using `-bE` option?
----------------------------------------
Bug #9928: Fiddle::TestHandle#test_NEXT fails on AIX due to unexported symbols of extension libraries
https://bugs.ruby-lang.org/issues/9928#change-47158
* Author: Rei Odaira
* Status: Open
* Priority: Normal
* Assignee: Yutaka Kanemoto
* Category: platform/aix
* Target version:
* ruby -v: ruby 2.2.0dev (2014-06-02 trunk 45270) [powerpc-aix7.1.0.0]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
`Fiddle::TestHandle#test_NEXT` fails on AIX.
~~~
[ 4/21] Fiddle::TestHandle#test_NEXT = 0.00 s
1) Error:
Fiddle::TestHandle#test_NEXT:
Fiddle::DLError: unknown symbol "Init_objspace"
/ss/home/rayod/Dev/Contribution/ruby-trunk-blue1/test/fiddle/test_handle.rb:171:in `[]'
/ss/home/rayod/Dev/Contribution/ruby-trunk-blue1/test/fiddle/test_handle.rb:171:in `rescue in test_NEXT'
/ss/home/rayod/Dev/Contribution/ruby-trunk-blue1/test/fiddle/test_handle.rb:144:in `test_NEXT'
~~~
The reason for this is a little bit complicated. `Fiddle::TestHandle#test_NEXT` tests the behavior of `RTLD_NEXT` for `dlsym(3)`. According to the manual, `RTLD_NEXT` of AIX should behave like that of BSD, so the following part in `Fiddle::TestHandle#test_NEXT` should succeed, but in fact it fails.
~~~
# BSD
#
<snip>
require 'objspace'
handle = Handle::NEXT
refute_nil handle['Init_objspace']
~~~
The problem is that on AIX, Ruby's extension libraries do not export their symbols, because they are loaded not by dlopen(3)/dlsym(3) but by load(3). The build process on AIX only specifies `Init_*` functions as the entry points of the extension shared libraries. This means `Init_objspace` cannot be the search target of `RTLD_NEXT`, and the test above results in nil. (FYI, the symbols in the modules loaded by load(3) can be found by `RTLD_NEXT` if they are exported.)
One way to solve this is to somehow export the `Init_objspace` function. However, specifying -Wl,-bexpall does not export the entry points, so we need to specify -Wl,-bexpfull, which looks like overkill for just passing this test.
Fortunately, on AIX, test/fiddle/helper.rb creates and loads a dummy shared library, libaixdltest.so, which contains and exports `strcpy` and some other functions, so we can take advantage of it for testing `RTLD_NEXT`. That is, we can simply query `strcpy` to check whether or not `RTLD_NEXT` works correctly, as follows. The patch is attached.
~~~
handle = Handle::NEXT
refute_nil handle['strcpy']
~~~
---Files--------------------------------
test_NEXT_for_aix.patch (2.96 KB)
--
https://bugs.ruby-lang.org/