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

Re: [GLIBC][AARCH64]Rewrite elf_machine_load_address using _DYNAMIC symbol



Hi,

On 2017-10-18 11:32, Renlin Li wrote:
> Hi Szabolcs,
> 
> Here is the C version one which should be portable in all cases.
> aarch64 native glibc regression test checked Okay.
> 
> Regards,
> Renlin
> 
> ChangeLog:
> 
> 2017-10-18  Renlin Li  <renlin.li@arm.com>
> 
> 	* sysdeps/aarch64/dl-machine.h (elf_machine_load_address): Use
> 	_DYNAMIC symbol to calculate load address.
> 

I do not know the exact reason of this patch, but my guess is that its
goal is to fix building with recent binutils version. Indeed with a
recent snapshot of the binutils 2.30 branch, glibc versions withtout
this patch fail to build on aarch64 during the linking of ld.so:

...

|  aarch64-linux-gnu-gcc-7 -no-pie -fno-PIE   -nostdlib -nostartfiles -shared -o /home/aurel32/glibc-2.26/build-tree/arm64-libc/elf/ld.so.new              \
|            -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -Wl,-z,defs       \
|            /home/aurel32/glibc-2.26/build-tree/arm64-libc/elf/librtld.os -Wl,--version-script=/home/aurel32/glibc-2.26/build-tree/arm64-libc/ld.map              \
|            -Wl,-soname=ld-linux-aarch64.so.1                     \
|            -Wl,-defsym=_begin=0
|  /usr/bin/ld: /home/aurel32/glibc-2.26/build-tree/arm64-libc/elf/librtld.os: relocation R_AARCH64_ABS32 against `a local symbol' can not be used when making a shared object
|  /usr/bin/ld: BFD (GNU Binutils for Debian) 2.29.90.20180122 assertion fail ../../bfd/elfnn-aarch64.c:4386
|  /usr/bin/ld: BFD (GNU Binutils for Debian) 2.29.90.20180122 assertion fail ../../bfd/elfnn-aarch64.c:4386
|  /home/aurel32/glibc-2.26/build-tree/arm64-libc/elf/librtld.os: In function `process_envvars':
|  /home/aurel32/glibc-2.26/elf/rtld.c:2499:(.text+0x108c): relocation truncated to fit: R_AARCH64_LD64_GOT_LO12_NC against symbol `audit_list_string' defined in COMMON section in /home/aurel32/glibc-2.26/build-tree/arm64-libc/elf/librtld.os
|  /usr/bin/ld: BFD (GNU Binutils for Debian) 2.29.90.20180122 assertion fail ../../bfd/elfnn-aarch64.c:4386
|  /usr/bin/ld: BFD (GNU Binutils for Debian) 2.29.90.20180122 assertion fail ../../bfd/elfnn-aarch64.c:4386

...

Given that binutils 2.30 should be released in the next few days, I
believe we should fix that in at least the 2.26 stable branch. Do you
mind if I backport this patch to this stable branch?

Thanks,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net