Subject: bug#20102: Problem with ld.so RUNPATH on armhf

From: [email-masked] (Ludovic Courtès)
Date: Thu, 09 Apr 2015 10:18:00 +0200

Mark H Weaver <[email-masked]> skribis:

> [email-masked] (Ludovic Courtès) writes:
>
>> With a bit of additional debug, I can print the value of ‘libs’ in the
>> ‘ld-wrapper’ procedure:
>>
>> ;;; (libs ("/gnu/store/fbdjazgwy3zyx8qc5z4ag0j78k2d7raw-glibc-2.21/lib/ld-linux-armhf.so.3"))
>>
>> This one comes from the -dynamic-linker flag, which is not passed on
>> x86_64.
>>
>> I believe this extra -dynamic-linker flag comes from a bogus ‘link’ spec
>> on ARM, solved by this:
>>
>> --- gcc-4.8.4/gcc/config/arm/linux-elf.h.orig	2015-04-08 20:31:20.376900478 +0200
>> +++ gcc-4.8.4/gcc/config/arm/linux-elf.h	2015-04-08 20:31:36.437014437 +0200
>> @@ -65,7 +65,7 @@
>>     %{symbolic:-Bsymbolic} \
>>     %{!static: \
>>       %{rdynamic:-export-dynamic} \
>> -     -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
>> +     %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
>>     -X \
>>     %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
>>     SUBTARGET_EXTRA_LINK_SPEC
>>
>> That way it would match GNU_USER_TARGET_LINK_SPEC in i386/gnu-user.h,
>> where -dynamic-linker appears within %{!static ... %{!shared ...}}.
>>
>> So, could you do:
>>
>>   (define patched-gcc
>>     (package
>>       (inherit gcc-4.8)
>>       (sources (origin (inherit (package-source gcc-4.8))
>>                  (patches ...)))))
>>
>> build it, and then use it in the failed glibc build tree to rebuild
>> ld.so?
>
> Yes, this fixed the problem.  I went ahead and pushed 1421afa94a to
> core-updates to apply this patch to gcc-4.8, gcc-4.9, and cross-gcc.

I’ve reported the problem at
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65711>.

Ludo’.