-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating a shared library from init.c and tramp.S #24
Comments
Thank you for trying Implib.so. First of all, there are a few caveats with your usecase (putting wrappers in a dedicated shared library, rather than into
As for the crash, is there a chance that there is a C++ constructor in |
Hi yugr, Thanks for your quick answer. First I tried the (gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fffef5a37f1 in __GI_abort () at abort.c:79
#2 0x00007fffef5933fa in __assert_fail_base (fmt=0x7fffef71a6c0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=assertion@entry=0x7fffe1153730 "0 && \"Assertion in generated code\"", file=file@entry=0x7fffe1153714 "libA.so.4.init.c",
line=line@entry=61, function=function@entry=0x7fffe11eab40 <__PRETTY_FUNCTION__.3281> "load_library") at assert.c:92
#3 0x00007fffef593472 in __GI___assert_fail (assertion=0x7fffe1153730 "0 && \"Assertion in generated code\"",
file=0x7fffe1153714 "libA.so.4.init.c", line=61, function=0x7fffe11eab40 <__PRETTY_FUNCTION__.3281> "load_library") at assert.c:101
#4 0x00007fffe1076fb6 in load_library () from ../../../../core/library/lib/libB.so
#5 0x00007fffe107700d in load_lib () from ../../../../core/library/lib/libB.so
#6 0x00007ffff7de38d3 in call_init (env=0x7fffffffe298, argv=0x7fffffffe288, argc=1, l=<optimized out>) at dl-init.c:72
#7 _dl_init (BFD: reopening /tmp/shared.ya8vsp: No such file or directory
BFD: reopening /tmp/shared.ya8vsp: No such file or directory
BFD: reopening /tmp/shared.ya8vsp: No such file or directory
main_map=0x7ffff7ffe170, main_map@entry=<error reading variable: Can't read data for section '.eh_frame' in file '/tmp/shared.ya8vsp'>,
argc=1, argv=0x7fffffffe288, env=0x7fffffffe298) at dl-init.c:119 |
Did you run
snippet from your libA.so.init.c ? |
OMG you're correct. While I was trying several options, I forgot to set the lazy_load option back. Now it works like a charm in my nested shared library case. Many thanks, yugr. You saved my life :) |
Closing for now, let me know if you have other issues. |
At first, thanks yugr for creating this nice proejct.
In the example case, it works fine but there is an issue in my case.
I applied Implib.so to libA.so which I want for delay-loading.
I created a shared library, libB.so from libA.so.init.c and libA.tramp.S
And then I built an executable with libB.
The problem is the executable tries to load libA at strarup even though a function in libA is called after some processing is finished. Following is an error message.
$ ./executable
implib-gen: libA.so.4: failed to load library 'libA.so.4' via dlopen: libA.so.4: cannot open shared object file: No such file or directory
executable: /home/xyz/Implib.so/libA.so.4.init.c:61: void *load_library(): Assertion `0 && "Assertion in generated code"' failed.
Aborted
Is this expected result? Or could you help me delay loading works fine in my case?
The text was updated successfully, but these errors were encountered: