bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/22471] New: libraries using version scripts can cause undefined


From: james410 at cowgill dot org.uk
Subject: [Bug ld/22471] New: libraries using version scripts can cause undefined reference to symbol '__bss_start'
Date: Tue, 21 Nov 2017 13:33:24 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22471

            Bug ID: 22471
           Summary: libraries using version scripts can cause undefined
                    reference to symbol '__bss_start'
           Product: binutils
           Version: 2.30 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: james410 at cowgill dot org.uk
  Target Milestone: ---

Created attachment 10625
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10625&action=edit
testcase tar.gz

This bug arises when the following occurs:

* An executable which references the __bss_start symbol (from the linker
script)
* links against a library using a version script so that __bss_start is not
exported
* in turn links against another "normal" library which does export __bss_start

I this case ld will complain that the __bss_start symbol is undefined and that
the "normal" library must be linked into the executable directly. I think this
is incorrect and ld should be using the definition of the symbol from the
linker script. Linking the "normal" library manually works around the bug, but
this isn't nice because that library is an implementation detail that the
executable shouldn't need to know about.

The gold linker doesn't seem to be affected (for whatever reason).

I've attached a testcase which illustrates the problem. It was first discovered
while compiling mariadb (specifically mariabackup) on Debian MIPS.

> $ ./build 
> + rm -f null.c
> + touch null.c
> + gcc -c -fPIC consume.c -o consume.o
> + gcc -c -fPIC null.c -o null.o
> + gcc -shared -Wl,--rpath=/user/jcowgill/workspace/binutils/test-bss-start 
> null.o -o libtest.so
> + gcc -shared -Wl,--rpath=/user/jcowgill/workspace/binutils/test-bss-start 
> -Wl,--version-script=middle.ver null.o libtest.so -o libmiddle.so
> + ld --rpath=/user/jcowgill/workspace/binutils/test-bss-start consume.o 
> libmiddle.so -o consume
> ld: consume.o: undefined reference to symbol '__bss_start'
> //user/jcowgill/workspace/binutils/test-bss-start/libtest.so: error adding 
> symbols: DSO missing from command line

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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