From: GNU Libc Maintainers Date: Sat, 16 Dec 2017 14:37:43 +0000 (+0000) Subject: submitted-strip-bit-0 X-Git-Tag: archive/raspbian/2.25-5+rpi1^2~159 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a255761a9fdc00be57cd3bfb5713e84ad3f8f919;p=glibc.git submitted-strip-bit-0 2017-07-12 Jiong Wang * sysdeps/arm/dl-machine.h (elf_machine_load_address): Also strip bit 0 of pcrel_address under Thumb mode. Gbp-Pq: Topic arm Gbp-Pq: Name submitted-strip-bit-0.diff --- diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 2c72972bd..d47a99d67 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -56,11 +56,19 @@ elf_machine_load_address (void) extern Elf32_Addr internal_function __dl_start (void *) asm ("_dl_start"); Elf32_Addr got_addr = (Elf32_Addr) &__dl_start; Elf32_Addr pcrel_addr; + asm ("adr %0, _dl_start" : "=r" (pcrel_addr)); #ifdef __thumb__ - /* Clear the low bit of the funciton address. */ + /* Clear the low bit of the funciton address. + + NOTE: got_addr is from GOT table whose lsb is always set by linker if it's + Thumb function address. PCREL_ADDR comes from PC-relative calculation + which will finish during assembling. GAS assembler before the fix for + PR gas/21458 was not setting the lsb but does after that. Always do the + strip for both, so the code works with various combinations of glibc and + Binutils. */ got_addr &= ~(Elf32_Addr) 1; + pcrel_addr &= ~(Elf32_Addr) 1; #endif - asm ("adr %0, _dl_start" : "=r" (pcrel_addr)); return pcrel_addr - got_addr; }