mirror of git://sourceware.org/git/glibc.git
Revert x86: Allow undefined _DYNAMIC in static executable
This code is used in non-PIE static executable and static PIE. It checks if _DYNAMIC is undefined before using it to compute load address. But not all targets can convert access _DYNAMIC via GOT, which needs dynamic relocation, to PC-relative at link-time. * sysdeps/i386/dl-machine.h (elf_machine_load_address): Don't allow undefined _DYNAMIC in PIE libc.a. * sysdeps/x86_64/dl-machine.h (elf_machine_load_address): Likewse.
This commit is contained in:
parent
0c609d19e3
commit
02d2d8927d
|
|
@ -1,3 +1,10 @@
|
||||||
|
2017-10-03 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* sysdeps/i386/dl-machine.h (elf_machine_load_address): Don't
|
||||||
|
allow undefined _DYNAMIC in PIE libc.a.
|
||||||
|
* sysdeps/x86_64/dl-machine.h (elf_machine_load_address):
|
||||||
|
Likewse.
|
||||||
|
|
||||||
2017-10-03 H.J. Lu <hongjiu.lu@intel.com>
|
2017-10-03 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* sysdeps/mips/dl-machine.h (elf_machine_load_address): Don't
|
* sysdeps/mips/dl-machine.h (elf_machine_load_address): Don't
|
||||||
|
|
|
||||||
|
|
@ -54,15 +54,8 @@ elf_machine_load_address (void)
|
||||||
/* Compute the difference between the runtime address of _DYNAMIC as seen
|
/* Compute the difference between the runtime address of _DYNAMIC as seen
|
||||||
by a GOTOFF reference, and the link-time address found in the special
|
by a GOTOFF reference, and the link-time address found in the special
|
||||||
unrelocated first GOT entry. */
|
unrelocated first GOT entry. */
|
||||||
#ifndef SHARED
|
extern Elf32_Dyn bygotoff[] asm ("_DYNAMIC") attribute_hidden;
|
||||||
extern Elf32_Dyn _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
|
return (Elf32_Addr) &bygotoff - elf_machine_dynamic ();
|
||||||
if (!_DYNAMIC)
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
/* The address of dynamic must be taken as non-weak to avoid dynamic
|
|
||||||
relocation. */
|
|
||||||
extern Elf32_Dyn dynamic[] asm ("_DYNAMIC") attribute_hidden;
|
|
||||||
return (Elf32_Addr) &dynamic - elf_machine_dynamic ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the loaded object described by L so its unrelocated PLT
|
/* Set up the loaded object described by L so its unrelocated PLT
|
||||||
|
|
|
||||||
|
|
@ -55,15 +55,8 @@ elf_machine_load_address (void)
|
||||||
/* Compute the difference between the runtime address of _DYNAMIC as seen
|
/* Compute the difference between the runtime address of _DYNAMIC as seen
|
||||||
by an IP-relative reference, and the link-time address found in the
|
by an IP-relative reference, and the link-time address found in the
|
||||||
special unrelocated first GOT entry. */
|
special unrelocated first GOT entry. */
|
||||||
#ifndef SHARED
|
extern ElfW(Dyn) _DYNAMIC[] attribute_hidden;
|
||||||
extern ElfW(Dyn) _DYNAMIC[] __attribute__((weak, visibility ("hidden")));
|
return (ElfW(Addr)) &_DYNAMIC - elf_machine_dynamic ();
|
||||||
if (!_DYNAMIC)
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
/* The address of dynamic must be taken as non-weak to avoid dynamic
|
|
||||||
relocation. */
|
|
||||||
extern ElfW(Dyn) dynamic[] asm ("_DYNAMIC") attribute_hidden;
|
|
||||||
return (ElfW(Addr)) &dynamic - elf_machine_dynamic ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the loaded object described by L so its unrelocated PLT
|
/* Set up the loaded object described by L so its unrelocated PLT
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue