[PATCH] buildsys: clean up libubacktrace linker script handling

Khem Raj raj.khem at gmail.com
Mon Jun 18 18:47:56 UTC 2012


On Fri, Jun 15, 2012 at 7:37 AM, Bernhard Reutner-Fischer
<rep.dot.nop at gmail.com> wrote:
> On 15 June 2012 04:54, Kevin Cernekee <cernekee at gmail.com> wrote:
>> On Wed, Jun 13, 2012 at 12:58 AM, Bernhard Reutner-Fischer
>> <rep.dot.nop at gmail.com> wrote:
>>> On Tue, Jun 12, 2012 at 04:52:21PM +0100, Carmelo AMOROSO wrote:
>>>>On 07/06/2012 19.32, Kevin Cernekee wrote:
>>>>> Move the AS_NEEDED insertion into libc/Makefile.in, and add a case to
>>>>> the HARDWIRED_ABSPATH substitution command so libubacktrace is handled
>>>>> the same way as the other libraries listed in the script.
>>>>
>>>>Looks fine to me.
>>>>
>>>
>>> Applied, thanks!
>>
>> Unfortunately it looks like this could cause some problems when
>> bootstrapping a new toolchain.  If the libc.so script references
>> libubacktrace, but libubacktrace.so.0 is not yet installed anywhere,
>> gcc will throw an error during the final link on the other shared
>> libraries:
>>
>> rm -f lib/libdl.so lib/libdl.so.0 lib/libdl-0.9.32.1.so
>> arm-linux-uclibcgnueabi-gcc -Wl,-EL -shared -Wl,--warn-common
>> -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relro -Wl,-z,defs
>> -Wl,-fini,dl_cleanup  -Wl,-soname=libdl.so.0 -nostdlib -o
>> lib/libdl-0.9.32.1.so  -Wl,--whole-archive ldso/libdl/libdl_so.a
>> -Wl,--no-whole-archive ./lib/interp.os -L./lib ./lib/libc.so
>> ./lib/ld-uClibc.so.0
>> /ssd/test/bin/../lib/gcc/arm-linux-uclibcgnueabi/4.5.3/libgcc.a
>> /ssd/test/bin/../lib/gcc/arm-linux-uclibcgnueabi/4.5.3/libgcc_eh.a
>> /ssd/test/bin/../lib/gcc/arm-linux-uclibcgnueabi/4.5.3/../../../../arm-linux-uclibcgnueabi/bin/ld:
>> cannot find libubacktrace.so.0
>> collect2: ld returned 1 exit status
>> make[1]: *** [lib/libdl.so] Error 1
>>
>>
>> I did not see this earlier because -nostdlib doesn't actually keep gcc
>> from passing ld "-L" arguments pointing into the sysroot directories.
>> So it saw my existing libubacktrace.so.0 from the installed sysroot
>> and did not complain that libubacktrace.so.0 was missing from the
>> uClibc build tree.
>>
>> Maybe we will need to revert back to this technique, at least in some form?
>>
>> -# Add the AS_NEEDED entry for libubacktrace.so
>> -       if [ -f $(top_builddir)lib/libc.so -a -f
>> $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME) ] ; then \
>> -               echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >>
>> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
>> -       fi
>> -endif
>>
>> I would appreciate any feedback/suggestions.
>
> What a mess. Carmelo, can you suggest a proper fix please (as
> quick-fix i put the static lib into the libc script just to make it
> link).
> TIA,


This quick fix is wrong since now it will try to ask for static
version of libubacktrace when linking shared libs and PIC binaries and
libubacktrace.a is not PIC


More information about the uClibc mailing list