http://sourceware.org/bugzilla/show_bug.cgi?id=13177
Bug #: 13177
Summary: garbage collector retains zombie references to
external libraries
Product: binutils
Version: 2.21
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
If shared library is compiled and linked with garbage collection enabled,
zombie references to external libraries are retained that result future link
failure.
(ld 2.21, gcc 4.5.2, Ubuntu 11.04)
Steps to repro:
* Create file shared.c
--8<--
#include <dlfcn.h>
void opt_out(const char *name)
{
dlopen(name, RTLD_LAZY);
}
__attribute__ ((visibility ("default"))) int add_two(int number)
{
return number+2;
}
-->8--
* Create shared library by running
gcc -fpic -shared -ffunction-sections -fdata-sections -Wl,--gc-sections
-fvisibility=hidden -o libtest.so shared.c -static-libgcc
Result: SUCCESS, no errors.
* Verify created library references by running
ldd -r libtest.so
Resukt: SUCCESS. No unreferenced symbols and expected list of library bindings.
* Create file main.c:
--8<--
int add_two(int);
int main()
{
return add_two(-2);
}
-->8--
* Create a program by running:
gcc -o main main.c -L. -ltest
Expected result: Program compailes and links correctly.
Acttual result: FAIL. ld returns:
./libtest.so: undefined reference to 'dlopen'
collect2: ld returned 1 exit status
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils