diff options
author | Roland McGrath <roland@gnu.org> | 2002-08-25 20:14:50 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-08-25 20:14:50 +0000 |
commit | 6ce3881de539b0a76673da3ea6fdac7453b47910 (patch) | |
tree | 2c5ab5ce32db69bf2d38b1759ec61e5f9fc3ff78 /sysdeps/i386/dl-machine.h | |
parent | d8a36a812d9ee3c2fd935d2391b27303903f0091 (diff) | |
download | glibc-6ce3881de539b0a76673da3ea6fdac7453b47910.tar.gz glibc-6ce3881de539b0a76673da3ea6fdac7453b47910.tar.xz glibc-6ce3881de539b0a76673da3ea6fdac7453b47910.zip |
* sysdeps/generic/utmp_file.c (UNLOCK_FILE): Clear alarm before
resetting handler, to avoid the possibility of a spurious SIGALRM delivered to the user's handler. Reported by Amit D. Chaudhary <amitc@brocade.com>, * misc/Makefile (CFLAGS-init-misc.c): Varaible removed. It served to set -fkeep-inline-functions, which is not needed for the current file. * sysdeps/generic/ldsodefs.h: Add attribute_hidden to *_internal decls. (_dl_setup_hash): Add attribute_hidden. (_dl_sysdep_start, _dl_sysdep_start_cleanup): Likewise. (_dl_sysdep_read_whole_file, _dl_dprintf): Likewise. (_dl_new_object, _dl_map_object_deps): Likewise. (_dl_map_object_deps_internal): Remove decl. * elf/rtld.c (__mempcpy, _exit): Redeclare locally as hidden. * sysdeps/i386/dl-machine.h [PI_STATIC_AND_HIDDEN && HAVE_VISIBILITY_ATTRIBUTE && HAVE_HIDDEN && !HAVE_BROKEN_VISIBILITY_ATTRIBUTE] (elf_machine_dynamic, elf_machine_load_address): Rewritten without asm, instead relying on the compiler to produce only GOTOFF variable refs.
Diffstat (limited to 'sysdeps/i386/dl-machine.h')
-rw-r--r-- | sysdeps/i386/dl-machine.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 09c1a9b6a4..c499875023 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -34,6 +34,35 @@ elf_machine_matches_host (const Elf32_Ehdr *ehdr) } +#if defined PI_STATIC_AND_HIDDEN \ + && defined HAVE_VISIBILITY_ATTRIBUTE && defined HAVE_HIDDEN \ + && !defined HAVE_BROKEN_VISIBILITY_ATTRIBUTE + +/* Return the link-time address of _DYNAMIC. Conveniently, this is the + first element of the GOT, a special entry that is never relocated. */ +static inline Elf32_Addr __attribute__ ((unused, const)) +elf_machine_dynamic (void) +{ + /* This produces a GOTOFF reloc that resolves to zero at link time, so in + fact just loads from the GOT register directly. By doing it without + an asm we can let the compiler choose any register. */ + extern const Elf32_Addr _GLOBAL_OFFSET_TABLE_[] attribute_hidden; + return _GLOBAL_OFFSET_TABLE_[0]; +} + +/* Return the run-time load address of the shared object. */ +static inline Elf32_Addr __attribute__ ((unused)) +elf_machine_load_address (void) +{ + /* Compute the difference between the runtime address of _DYNAMIC as seen + by a GOTOFF reference, and the link-time address found in the special + unrelocated first GOT entry. */ + extern Elf32_Dyn bygotoff[] asm ("_DYNAMIC") attribute_hidden; + return (Elf32_Addr) &bygotoff - elf_machine_dynamic (); +} + +#else /* Without .hidden support, we can't compile the code above. */ + /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT. This must be inlined in a function which uses global data. */ @@ -60,6 +89,9 @@ elf_machine_load_address (void) return addr; } +#endif + + #if !defined PROF && !__BOUNDED_POINTERS__ /* We add a declaration of this function here so that in dl-runtime.c the ELF_MACHINE_RUNTIME_TRAMPOLINE macro really can pass the parameters |