[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/2143] New: Unresolvable reference by DSO to hidden symbol despit

From: jan dot echternach at group-technologies dot com
Subject: [Bug ld/2143] New: Unresolvable reference by DSO to hidden symbol despite --allow-shlib-undefined
Date: 12 Jan 2006 11:40:56 -0000

I'm getting a "hidden symbol is referenced by DSO" error if I link a program 
with both LSB2's libc.so and an old libnotes.so from Lotus Domino 6.  
libnotes.so has an undefined reference to atexit, LSB2's libc.so has no 
definition of that symbol, but there is a hidden atexit symbol in 

I tried both the preinstalled ld (GNU ld version 20041220 (SuSE 
Linux)) and the ld from binutils- (GNU ld version 

I can reproduce the error without libnotes.so by linking with a dummy DSO that 
has only an undefined 'atexit' reference.  It is possible to work around the 
problem by removing the hidden atexit symbol from libc_nonshared.a.

$ cat oldlib.c
#include <stdlib.h>
int (*oldlib_ptr) (void (*) (void)) = atexit;
$ cat main.c
int main (void) { return 0; }

$ gcc -Wall -W -fPIC -c -o oldlib.o oldlib.c
$ ld -shared -o liboldlib.so oldlib.o

$ gcc -Wall -W -o main1 main.c -Wl,--allow-shlib-undefined -L. -loldlib \
        -I/opt/lsb/include -L/opt/lsb/lib -lc -lc_nonshared
main1: hidden symbol `atexit' in /usr/lib/gcc-lib/i586-suse-
linux/3.3.5/../../../libc_nonshared.a(atexit.oS) is referenced by DSO
final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status

$ cp /usr/lib/libc_nonshared.a libc_nonshared_noatexit.a
$ ar d libc_nonshared_noatexit.a atexit.oS
$ gcc -Wall -W -o main2 main.c -Wl,--allow-shlib-undefined -L. -loldlib \
        -I/opt/lsb/include -L/opt/lsb/lib -lc -lc_nonshared_noatexit

(No error in this case.)

There's no doubt that the hidden symbol can't resolve the reference by the 
DSO.  But I think ld should just leave the reference unresolved if --allow-
shlib-undefined is specified.  There are plenty of other references in 
libnotes.so that can't be resolved and cause no complaints.

           Summary: Unresolvable reference by DSO to hidden symbol despite -
           Product: binutils
           Version: 2.16
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: jan dot echternach at group-technologies dot com
                CC: bug-binutils at gnu dot org
  GCC host triplet: i586-suse-linux
GCC target triplet: i586-suse-linux


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]