summaryrefslogtreecommitdiff
path: root/elf/dynamic-link.h
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-12-15Add --enable-static-pie configure option to build static PIE [BZ #19574]H.J. Lu
Static PIE extends address space layout randomization to static executables. It provides additional security hardening benefits at the cost of some memory and performance. Dynamic linker, ld.so, is a standalone program which can be loaded at any address. This patch adds a configure option, --enable-static-pie, to embed the part of ld.so in static executable to create static position independent executable (static PIE). A static PIE is similar to static executable, but can be loaded at any address without help from a dynamic linker. When --enable-static-pie is used to configure glibc, libc.a is built as PIE and all static executables, including tests, are built as static PIE. The resulting libc.a can be used together with GCC 8 or above to build static PIE with the compiler option, -static-pie. But GCC 8 isn't required to build glibc with --enable-static-pie. Only GCC with PIE support is needed. When an older GCC is used to build glibc with --enable-static-pie, proper input files are passed to linker to create static executables as static PIE, together with "-z text" to prevent dynamic relocations in read-only segments, which are not allowed in static PIE. The following changes are made for static PIE: 1. Add a new function, _dl_relocate_static_pie, to: a. Get the run-time load address. b. Read the dynamic section. c. Perform dynamic relocations. Dynamic linker also performs these steps. But static PIE doesn't load any shared objects. 2. Call _dl_relocate_static_pie at entrance of LIBC_START_MAIN in libc.a. crt1.o, which is used to create dynamic and non-PIE static executables, is updated to include a dummy _dl_relocate_static_pie. rcrt1.o is added to create static PIE, which will link in the real _dl_relocate_static_pie. grcrt1.o is also added to create static PIE with -pg. GCC 8 has been updated to support rcrt1.o and grcrt1.o for static PIE. Static PIE can work on all architectures which support PIE, provided: 1. Target must support accessing of local functions without dynamic relocations, which is needed in start.S to call __libc_start_main with function addresses of __libc_csu_init, __libc_csu_fini and main. All functions in static PIE are local functions. If PIE start.S can't reach main () defined in a shared object, the code sequence: pass address of local_main to __libc_start_main ... local_main: tail call to main via PLT can be used. 2. start.S is updated to check PIC instead SHARED for PIC code path and avoid dynamic relocation, when PIC is defined and SHARED isn't defined, to support static PIE. 3. All assembly codes are updated check PIC instead SHARED for PIC code path to avoid dynamic relocations in read-only sections. 4. All assembly codes are updated check SHARED instead PIC for static symbol name. 5. elf_machine_load_address in dl-machine.h are updated to support static PIE. 6. __brk works without TLS nor dynamic relocations in read-only section so that it can be used by __libc_setup_tls to initializes TLS in static PIE. NB: When glibc is built with GCC defaulted to PIE, libc.a is compiled with -fPIE, regardless if --enable-static-pie is used to configure glibc. When glibc is configured with --enable-static-pie, libc.a is compiled with -fPIE, regardless whether GCC defaults to PIE or not. The same libc.a can be used to build both static executable and static PIE. There is no need for separate PIE copy of libc.a. On x86-64, the normal static sln: text data bss dec hex filename 625425 8284 5456 639165 9c0bd elf/sln the static PIE sln: text data bss dec hex filename 657626 20636 5392 683654 a6e86 elf/sln The code size is increased by 5% and the binary size is increased by 7%. Linker requirements to build glibc with --enable-static-pie: 1. Linker supports --no-dynamic-linker to remove PT_INTERP segment from static PIE. 2. Linker can create working static PIE. The x86-64 linker needs the fix for https://sourceware.org/bugzilla/show_bug.cgi?id=21782 The i386 linker needs to be able to convert "movl main@GOT(%ebx), %eax" to "leal main@GOTOFF(%ebx), %eax" if main is defined locally. Binutils 2.29 or above are OK for i686 and x86-64. But linker status for other targets need to be verified. 3. Linker should resolve undefined weak symbols to 0 in static PIE: https://sourceware.org/bugzilla/show_bug.cgi?id=22269 4. Many ELF backend linkers incorrectly check bfd_link_pic for TLS relocations, which should check bfd_link_executable instead: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 Tested on aarch64, i686 and x86-64. Using GCC 7 and binutils master branch, build-many-glibcs.py with --enable-static-pie with all patches for static PIE applied have the following build successes: PASS: glibcs-aarch64_be-linux-gnu build PASS: glibcs-aarch64-linux-gnu build PASS: glibcs-armeb-linux-gnueabi-be8 build PASS: glibcs-armeb-linux-gnueabi build PASS: glibcs-armeb-linux-gnueabihf-be8 build PASS: glibcs-armeb-linux-gnueabihf build PASS: glibcs-arm-linux-gnueabi build PASS: glibcs-arm-linux-gnueabihf build PASS: glibcs-arm-linux-gnueabihf-v7a build PASS: glibcs-arm-linux-gnueabihf-v7a-disable-multi-arch build PASS: glibcs-m68k-linux-gnu build PASS: glibcs-microblazeel-linux-gnu build PASS: glibcs-microblaze-linux-gnu build PASS: glibcs-mips64el-linux-gnu-n32 build PASS: glibcs-mips64el-linux-gnu-n32-nan2008 build PASS: glibcs-mips64el-linux-gnu-n32-nan2008-soft build PASS: glibcs-mips64el-linux-gnu-n32-soft build PASS: glibcs-mips64el-linux-gnu-n64 build PASS: glibcs-mips64el-linux-gnu-n64-nan2008 build PASS: glibcs-mips64el-linux-gnu-n64-nan2008-soft build PASS: glibcs-mips64el-linux-gnu-n64-soft build PASS: glibcs-mips64-linux-gnu-n32 build PASS: glibcs-mips64-linux-gnu-n32-nan2008 build PASS: glibcs-mips64-linux-gnu-n32-nan2008-soft build PASS: glibcs-mips64-linux-gnu-n32-soft build PASS: glibcs-mips64-linux-gnu-n64 build PASS: glibcs-mips64-linux-gnu-n64-nan2008 build PASS: glibcs-mips64-linux-gnu-n64-nan2008-soft build PASS: glibcs-mips64-linux-gnu-n64-soft build PASS: glibcs-mipsel-linux-gnu build PASS: glibcs-mipsel-linux-gnu-nan2008 build PASS: glibcs-mipsel-linux-gnu-nan2008-soft build PASS: glibcs-mipsel-linux-gnu-soft build PASS: glibcs-mips-linux-gnu build PASS: glibcs-mips-linux-gnu-nan2008 build PASS: glibcs-mips-linux-gnu-nan2008-soft build PASS: glibcs-mips-linux-gnu-soft build PASS: glibcs-nios2-linux-gnu build PASS: glibcs-powerpc64le-linux-gnu build PASS: glibcs-powerpc64-linux-gnu build PASS: glibcs-tilegxbe-linux-gnu-32 build PASS: glibcs-tilegxbe-linux-gnu build PASS: glibcs-tilegx-linux-gnu-32 build PASS: glibcs-tilegx-linux-gnu build PASS: glibcs-tilepro-linux-gnu build and the following build failures: FAIL: glibcs-alpha-linux-gnu build elf/sln is failed to link due to: assertion fail bfd/elf64-alpha.c:4125 This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-hppa-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault] https://sourceware.org/bugzilla/show_bug.cgi?id=22537 FAIL: glibcs-ia64-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault] FAIL: glibcs-powerpc-linux-gnu build FAIL: glibcs-powerpc-linux-gnu-soft build FAIL: glibcs-powerpc-linux-gnuspe build FAIL: glibcs-powerpc-linux-gnuspe-e500v1 build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22264 FAIL: glibcs-powerpc-linux-gnu-power4 build elf/sln is failed to link due to: findlocale.c:96:(.text+0x22c): @local call to ifunc memchr This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-s390-linux-gnu build elf/sln is failed to link due to: collect2: fatal error: ld terminated with signal 11 [Segmentation fault], core dumped assertion fail bfd/elflink.c:14299 This is caused by linker bug and/or non-PIC code in PIE libc.a. FAIL: glibcs-sh3eb-linux-gnu build FAIL: glibcs-sh3-linux-gnu build FAIL: glibcs-sh4eb-linux-gnu build FAIL: glibcs-sh4eb-linux-gnu-soft build FAIL: glibcs-sh4-linux-gnu build FAIL: glibcs-sh4-linux-gnu-soft build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 Also TLS code sequence in SH assembly syscalls in glibc doesn't match TLS code sequence expected by ld: https://sourceware.org/bugzilla/show_bug.cgi?id=22270 FAIL: glibcs-sparc64-linux-gnu build FAIL: glibcs-sparcv9-linux-gnu build FAIL: glibcs-tilegxbe-linux-gnu build FAIL: glibcs-tilegxbe-linux-gnu-32 build FAIL: glibcs-tilegx-linux-gnu build FAIL: glibcs-tilegx-linux-gnu-32 build FAIL: glibcs-tilepro-linux-gnu build elf/sln is failed to link due to: ld: read-only segment has dynamic relocations. This is caused by linker bug and/or non-PIC code in PIE libc.a. See: https://sourceware.org/bugzilla/show_bug.cgi?id=22263 [BZ #19574] * INSTALL: Regenerated. * Makeconfig (real-static-start-installed-name): New. (pic-default): Updated for --enable-static-pie. (pie-default): New for --enable-static-pie. (default-pie-ldflag): Likewise. (+link-static-before-libc): Replace $(DEFAULT-LDFLAGS-$(@F)) with $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)). Replace $(static-start-installed-name) with $(real-static-start-installed-name). (+prectorT): Updated for --enable-static-pie. (+postctorT): Likewise. (CFLAGS-.o): Add $(pie-default). (CFLAGS-.op): Likewise. * NEWS: Mention --enable-static-pie. * config.h.in (ENABLE_STATIC_PIE): New. * configure.ac (--enable-static-pie): New configure option. (have-no-dynamic-linker): New LIBC_CONFIG_VAR. (have-static-pie): Likewise. Enable static PIE if linker supports --no-dynamic-linker. (ENABLE_STATIC_PIE): New AC_DEFINE. (enable-static-pie): New LIBC_CONFIG_VAR. * configure: Regenerated. * csu/Makefile (omit-deps): Add r$(start-installed-name) and gr$(start-installed-name) for --enable-static-pie. (extra-objs): Likewise. (install-lib): Likewise. (extra-objs): Add static-reloc.o and static-reloc.os ($(objpfx)$(start-installed-name)): Also depend on $(objpfx)static-reloc.o. ($(objpfx)r$(start-installed-name)): New. ($(objpfx)g$(start-installed-name)): Also depend on $(objpfx)static-reloc.os. ($(objpfx)gr$(start-installed-name)): New. * csu/libc-start.c (LIBC_START_MAIN): Call _dl_relocate_static_pie in libc.a. * csu/libc-tls.c (__libc_setup_tls): Add main_map->l_addr to initimage. * csu/static-reloc.c: New file. * elf/Makefile (routines): Add dl-reloc-static-pie. (elide-routines.os): Likewise. (DEFAULT-LDFLAGS-tst-tls1-static-non-pie): Removed. (tst-tls1-static-non-pie-no-pie): New. * elf/dl-reloc-static-pie.c: New file. * elf/dl-support.c (_dl_get_dl_main_map): New function. * elf/dynamic-link.h (ELF_DURING_STARTUP): Also check STATIC_PIE_BOOTSTRAP. * elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise. * gmon/Makefile (tests): Add tst-gmon-static-pie. (tests-static): Likewise. (DEFAULT-LDFLAGS-tst-gmon-static): Removed. (tst-gmon-static-no-pie): New. (CFLAGS-tst-gmon-static-pie.c): Likewise. (CRT-tst-gmon-static-pie): Likewise. (tst-gmon-static-pie-ENV): Likewise. (tests-special): Likewise. ($(objpfx)tst-gmon-static-pie.out): Likewise. (clean-tst-gmon-static-pie-data): Likewise. ($(objpfx)tst-gmon-static-pie-gprof.out): Likewise. * gmon/tst-gmon-static-pie.c: New file. * manual/install.texi: Document --enable-static-pie. * sysdeps/generic/ldsodefs.h (_dl_relocate_static_pie): New. (_dl_get_dl_main_map): Likewise. * sysdeps/i386/configure.ac: Check if linker supports static PIE. * sysdeps/x86_64/configure.ac: Likewise. * sysdeps/i386/configure: Regenerated. * sysdeps/x86_64/configure: Likewise. * sysdeps/mips/Makefile (ASFLAGS-.o): Add $(pie-default). (ASFLAGS-.op): Likewise.
2017-08-31elf: Remove internal_function attributeFlorian Weimer
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-10-15Mark internal _dl_XXX functions hiddenH.J. Lu
Since internal _dl_XXX functions are only used internally in ld.so, they can be made hidden. [BZ #19122] * elf/dl-runtime.c (_dl_fixup): Add attribute_hidden. * elf/dynamic-link.h (_dl_try_allocate_static_tls): Likewise. * sysdeps/generic/dl-cache.h (_dl_cache_libcmp): Likewise. * sysdeps/generic/ldsodefs.h (_dl_name_match_p): Likewise. (_dl_higher_prime_number): Likewise. (_dl_debug_printf_c): Likewise. (_dl_signal_cerror): Likewise. (_dl_receive_error): Likewise. (_dl_reloc_bad_type): Likewise. (_dl_resolve_conflicts): Likewise. (_dl_check_all_versions): Likewise. (_dl_check_map_versions): Likewise. (_dl_sort_fini): Likewise. (_dl_debug_initialize): Likewise. (_dl_init_paths): Likewise. (_dl_show_auxv): Likewise. (_dl_next_ld_env_entry): Likewise. (_dl_important_hwcaps): Likewise. (_dl_load_cache_lookup): Likewise. (_dl_update_slotinfo): Likewise. (_dl_show_scope): Likewise.
2015-08-19Fix dynamic linker issue with bind-nowPetar Jovanovic
Fix the bind-now case when DT_REL and DT_JMPREL sections are separate and there is a gap between them. [BZ #14341] * elf/dynamic-link.h (elf_machine_lazy_rel): Properly handle the case when there is a gap between DT_REL and DT_JMPREL sections. * sysdeps/x86_64/Makefile (tests): Add tst-split-dynreloc. (LDFLAGS-tst-split-dynreloc): New. (tst-split-dynreloc-ENV): Likewise. * sysdeps/x86_64/tst-split-dynreloc.c: New file. * sysdeps/x86_64/tst-split-dynreloc.lds: Likewise.
2015-03-25powerpc __tls_get_addr call optimizationAlan Modra
This patch is glibc support for a PowerPC TLS optimization, inspired by Alexandre Oliva's TLS optimization for other processors, http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt In essence, this optimization uses a zero module id in the tls_index GOT entry to indicate that a TLS variable is allocated space in the static TLS area. A special plt call linker stub for __tls_get_addr checks for such a tls_index and if found, returns the offset immediately. The linker communicates the fact that the special __tls_get_addr stub is used by setting a bit in the dynamic tag DT_PPC64_OPT/DT_PPC_OPT. glibc communicates to the linker that this optimization is available by the presence of __tls_get_addr_opt. tst-tlsmod2.so is built with -Wl,--no-tls-get-addr-optimize for tst-tls-dlinfo, which otherwise would fail since it tests that no static tls is allocated. The ld option --no-tls-get-addr-optimize has been available since binutils-2.20 so doesn't need a configure test. * NEWS: Advertise TLS optimization. * elf/elf.h (R_PPC_TLSGD, R_PPC_TLSLD, DT_PPC_OPT, PPC_OPT_TLS): Define. (DT_PPC_NUM): Increment. * elf/dynamic-link.h (HAVE_STATIC_TLS): Define. (CHECK_STATIC_TLS): Use here. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Optimize TLS descriptors. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise. * sysdeps/powerpc/dl-tls.c: New file. * sysdeps/powerpc/Versions: Add __tls_get_addr_opt. * sysdeps/powerpc/tst-tlsopt-powerpc.c: New tls test. * sysdeps/unix/sysv/linux/powerpc/Makefile: Add new test. Build tst-tlsmod2.so with --no-tls-get-addr-optimize. * sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Update. * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.
2015-01-09Remove divide from _ELF_DYNAMIC_DO_RELOC in elf/dynamic-link.h.Chung-Lin Tang
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-10-05Set up the data structures for vDSO in libc.aH.J. Lu
2012-09-28Define VERSYMIDX/VALIDX/ADDRIDX in ldsodefs.hH.J. Lu
2012-04-10Fix ld.so regression.David S. Miller
[BZ #13967] * elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Handle the case where the is a gap between DT_REL(A) and DT_JMPREL.
2012-04-07Simplify _ELF_DYNAMIC_DO_RELOC after combining the old two defs.Carlos O'Donell
* elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Simplify conditions and remove no longer applicable assertion.
2012-04-05Reduce down to one definition of _ELF_DYNAMIC_DO_RELOC.David S. Miller
* elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Reduce down to one definition. * sysdeps/powerpc/powerpc32/dl-machine.h (ELF_MACHINE_PLTREL_OVERLAP): Delete. * sysdeps/s390/s390-32/dl-machine.h (ELF_MACHINE_PLTREL_OVERLAP): Likewise. * sysdeps/sparc/sparc32/dl-machine.h (ELF_MACHINE_PLTREL_OVERLAP): Likewise. * sysdeps/sparc/sparc64/dl-machine.h (ELF_MACHINE_PLTREL_OVERLAP): Likewise.
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2011-10-16Cleanup last patchUlrich Drepper
2011-10-16Fix potential problem with skipping relocationsUlrich Drepper
We never seem to have hit this problem but way relative relocations were skipped was wrong. There are relative relocations only in the DT_REL/DT_RELA section. The elf_dynamic_do_##reloc function skipped the entries in all calls, though.
2011-10-05Don't call ifunc functions in trace modeAndreas Schwab
2011-07-02Make asserts accept DT_FLAGS/DT_FLAGS_1 with zero flags.Roland McGrath
2010-01-18Use correct type when casting d_tag.Andreas Schwab
2010-01-18Ignore negative dynamic entry types.Andreas Schwab
2008-05-13Introduce TLS descriptors for i386 and x86_64.Ulrich Drepper
* include/inline-hashtab.h: New file, copied from 2005's libiberty, with fix for memory leak imported afterwards by Glauber de Oliveira Costa. * elf/tlsdeschtab.h: New file. * elf/dl-reloc.c (_dl_try_allocate_static_tls): Extract from... (_dl_allocate_static_tls): ... here. Rearrange failure path. (CHECK_STATIC_TLS): Move to... * elf/dynamic-link.h: ... this file. (TRY_STATIC_TLS): New macro. * elf/dl-conflict.c (CHECK_STATIC_TLS, TRY_STATIC_TLS): Override. * elf/elf.h (R_386_TLS_GOTDESC, R_386_TLS_DESC_CALL, R_386_TLS_DESC): Define. (R_X86_64_PC64, R_X86_GOTOFF64, R_X86_64_GOTPC32): Merge from binutils. (R_X86_64_GOTPC32_TLSDESC, R_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC): Define. (R_386_NUM, R_X86_64_NUM): Adjust. * sysdeps/i386/Makefile (sysdep-dl-routines, sysdep_routines, systep-rtld-routines): Add tlsdesc and dl-tlsdesc for elf subdir. (gen-as-const-headers): Add tlsdesc.sym to csu subdir. * sysdeps/i386/dl-lookupcfg.h: New file. Introduce _dl_unmap to release tlsdesc_table. * sysdeps/i386/dl-machine.h: Include dl-tlsdesc.h. (elf_machine_type_class): Mark R_386_TLS_DESC as PLT class. (elf_machine_rel): Handle R_386_TLS_DESC. (elf_machine_rela): Likewise. (elf_machine_lazy_rel): Likewise. (elf_machine_lazy_rela): Likewise. * sysdeps/i386/dl-tls.h (struct dl_tls_index): Name it. * sysdeps/i386/dl-tlsdesc.S: New file. * sysdeps/i386/dl-tlsdesc.h: New file. * sysdeps/i386/tlsdesc.c: New file. * sysdeps/i386/tlsdesc.sym: New file. * sysdeps/i386/bits/linkmap.h (struct link_map_machine): Add tlsdesc_table. * sysdeps/x86_64/Makefile (sysdep-dl-routines, sysdep_routines, systep-rtld-routines): Add tlsdesc and dl-tlsdesc for elf subdir. (gen-as-const-headers): Add tlsdesc.sym to csu subdir. * sysdeps/x86_64/dl-lookupcfg.h: New file. Introduce _dl_unmap to release tlsdesc_table. * sysdeps/x86_64/dl-machine.h: Include dl-tlsdesc.h. (elf_machine_runtime_setup): Set up lazy TLSDESC GOT entry. (elf_machine_type_class): Mark R_X86_64_TLSDESC as PLT class. (elf_machine_rel): Handle R_X86_64_TLSDESC. (elf_machine_rela): Likewise. (elf_machine_lazy_rel): Likewise. * sysdeps/x86_64/dl-tls.h (struct dl_tls_index): Name it. (__tls_get_addr): Do not declare for non-shared compiles. * sysdeps/x86_64/dl-tlsdesc.S: New file. * sysdeps/x86_64/dl-tlsdesc.h: New file. * sysdeps/x86_64/tlsdesc.c: New file. * sysdeps/x86_64/tlsdesc.sym: New file. * sysdeps/x86_64/bits/linkmap.h (struct link_map_machine): Add tlsdesc_table for both 32- and 64-bit structs.
2006-07-10* elf/dl-lookup.c (dl_new_hash): New functions.cvs/fedora-glibc-20060710T2206Ulrich Drepper
(_dl_lookup_symbol_x): Rename hash to old_hash and don't compute value here. Compute new-style hash value. Pass new hash value and reference to variable with the old value to do_lookup_x. (_dl_setup_hash): If DT_GNU_HASH is defined, use it and not old-style hash table. (_dl_debug_bindings): Pass new hash value and reference to variable with the old value to do_lookup_x. * elf/do-lookup.h (do_lookup_x): Accept additional parameter with new-style hash value and change old-style hash value parameter to be a reference. Reoganize functions to determine whether new-style hash table is available. Only fall back on old-style table. If old-style hash value is needed, compute it here. * elf/dynamic-link.h (elf_get_dynamic_info): Relocate DT_GNU_HASH entry. * elf/elf.h: Define SHT_GNU_HASH, DT_GNU_HASH, DT_TLSDEC_PLT, DT_TLSDEC_GOT. Adjust DT_ADDRNUM. * include/link.h (struct link_map): Add l_gnu_bitmask_idxbits, l_gnu_shift, l_gnu_bitmask, l_gnu_buckets and l_gnu_chain_zero. * Makeconfig: If linker supports --hash-style option add it to all linker command lines to build DSOs. * config.make.in: Define have-hash-style. * configure.in: Test whether linker supports --hash-style option. * elf/dl-misc.c (_dl_name_match_p): Make MAP parameter const. * sysdeps/generic/ldsodefs.h: Adjust prototype.
2005-03-15* sysdeps/generic/wordexp.c (exec_comm_child): Add inline keyword.Roland McGrath
Patch by Dan Kegel <dank@kegel.com>. * elf/dynamic-link.h (elf_machine_rel, elf_machine_rel_relative, elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel): Add inline keyword. * sysdeps/alpha/dl-machine.h (elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel): Add always_inline attribute. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel): Likewise. Change static inline into auto inline. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel): Likewise. * sysdeps/generic/dl-machine.h (elf_machine_rel, elf_machine_rela): Likewise. * sysdeps/arm/dl-machine.h (elf_machine_rel, elf_machine_rel_relative, elf_machine_rela, elf_machine_rela_relative, elf_machine_lazy_rel): Likewise. 2005-03-15 Jakub Jelinek <jakub@redhat.com>
2005-02-17[BZ #284, BZ #721]Roland McGrath
* intl/dcigettext.c (_nl_find_msg): Add a cast. * nis/nis_clone_dir.c (nis_clone_directory): Use char * for ADDR. * nis/nis_clone_obj.c (nis_clone_object): Likewise. * nis/nis_clone_res.c (nis_clone_result): Likewise. * resolv/nss_dns/dns-network.c (getanswer_r): Use const unsigned char * for END_OF_MESSAGE and CP. * resolv/res_send.c (send_dg): Add else branch for case impossible unless `poll' is buggy. * crypt/crypt_util.c (__setkey_r): Add a cast. * locale/programs/linereader.c (get_toplvl_escape): Use size_t for NBYTES, and unsigned char * for BYTES. * locale/programs/charmap.c (charmap_new_char): Use size_t and unsighed char * for NBYTES, BYTES parameters. * sysdeps/generic/dl-hash.h (_dl_elf_hash): Take const char * argument and cast it. * sysdeps/i386/i686/dl-hash.h (_dl_elf_hash): Likewise. * sunrpc/create_xid.c (_create_xid): Don't use unsigned long for RES. * sunrpc/svcauth_des.c (_svcauth_des): Fix cast type. * sunrpc/auth_des.c (authdes_create): Don't use u_char for PKEY_DATA. (authdes_marshal): Don't use unsigned int for LEN. * sunrpc/xdr.c (xdr_hyper): Don't use unsigned long for T2. (xdr_u_hyper): Likewise. (xdr_u_short): Don't use u_long for L. * sunrpc/xdr_intXX_t.c (xdr_int64_t): Don't use uint32_t for T2. * inet/rexec.c (rexec_af): Use socklen_t. * sunrpc/key_call.c (getkeyserv_handle): Likewise. * sunrpc/rtime.c (rtime): Likewise. * resolv/res_send.c (send_vc, send_dg): Likewise. * nis/nis_callback.c (__nis_create_callback): Likewise. * sysdeps/generic/libc-start.c: Use unsigned int for nthreads ptr. * sysdeps/posix/getaddrinfo.c (gaih_inet): Fix type of ADDR local. * libio/libio.h (_IO_BE): Add parenthesis around EXPR. * intl/dcigettext.c (INTVARDEF, INTUSE): Macros removed. (_nl_default_dirname): Use libc_hidden_data_def instead of INTVARDEF. (libc_freeres_fn, DCIGETTEXT): Don't use INTUSE. * intl/bindtextdom.c (INTUSE): Macro removed. (_nl_default_dirname): Use libc_hidden_proto. (set_binding_values): Don't use INTUSE. * include/libintl.h (_libc_intl_domainname_internal): Decl removed. (_libc_intl_domainname): Use libc_hidden_proto. * posix/regex_internal.h (gettext): Remove INTUSE on it. * locale/SYS_libc.c (_libc_intl_domainname): Use libc_hidden_data_def rather than INTDEF. * include/libintl.h (_): Don't use *_internal name. * ctype/ctype-extn.c (__ctype_tolower, __ctype_toupper): Use int32_t, not uint32_t. * locale/lc-ctype.c (_nl_postload_ctype): Likewise for assignments. * iconv/gconv_open.c (__gconv_open): Remove useless cast. [BZ #721] * sysdeps/i386/dl-machine.h (ELF_MACHINE_NO_RELA): Define this outside of [RESOLVE_MAP]. * sysdeps/sh/dl-machine.h (ELF_MACHINE_NO_REL): Likewise. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rel, elf_machine_rel_relative): Removed. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rel, elf_machine_rel_relative): Removed. 2005-02-03 Alexandre Oliva <aoliva@redhat.com> [BZ #721] * elf/dynamic-link.h: Don't declare nested auto functions that are not going to be defined. 2004-07-23 Jakub Jelinek <jakub@redhat.com> [BZ #284] * include/features.h (_POSIX_SOURCE, _POSIX_C_SOURCE): Define if _XOPEN_SOURCE >= 500 even if __STRICT_ANSI__ is defined. 2005-02-16 Roland McGrath <roland@redhat.com>
2005-01-06* csu/elf-init.c (__libc_csu_fini): Don't do anything here. Ulrich Drepper
* sysdeps/generic/libc-start.c: Don't register program destructor here. * dlfcn/Makefile: Add rules to build dlfcn.c. (LDFLAGS-dl.so): Removed. * dlfcn/dlclose.c: _dl_close is now in ld.so, use function pointer table. * dlfcn/dlmopen.c: Likewise for _dl_open. * dlfcn/dlopen.c: Likewise. * dlfcn/dlopenold.c: Likewise. * elf/dl-libc.c: Likewise for _dl_open and _dl_close. * elf/Makefile (routines): Remove dl-open and dl-close. (dl-routines): Add dl-open, dl-close, and dl-trampoline. Add rules to build and run tst-audit1. * elf/tst-audit1.c: New file. * elf/tst-auditmod1.c: New file. * elf/Versions [libc]: Remove _dl_open and _dl_close. * elf/dl-close.c: Change for use inside ld.so instead of libc.so. * elf/dl-open.c: Likewise. * elf/dl-debug.c (_dl_debug_initialize): Allow reinitialization, signaled by nonzero parameter. * elf/dl-init.c: Fix use of r_state. * elf/dl-load.c: Likewise. * elf/dl-close.c: Add auditing checkpoints. * elf/dl-open.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-sym.c: Likewise. * sysdeps/generic/libc-start.c: Likewise. * elf/dl-object.c: Allocate memory for auditing information. * elf/dl-reloc.c: Remove RESOLV. We now always need the map. Correctly initialize slotinfo. * elf/dynamic-link.h: Adjust after removal of RESOLV. * sysdeps/hppa/dl-lookupcfg.h: Likewise. * sysdeps/ia64/dl-lookupcfg.h: Likewise. * sysdeps/powerpc/powerpc64/dl-lookupcfg.h: Removed. * elf/dl-runtime.c (_dl_fixup): Little cleanup. (_dl_profile_fixup): New parameters to point to register struct and variable for frame size. Add auditing checkpoints. (_dl_call_pltexit): New function. Don't define trampoline code here. * elf/rtld.c: Recognize LD_AUDIT. Load modules on startup. Remove all the functions from _rtld_global_ro which only _dl_open and _dl_close needed. Add auditing checkpoints. * elf/link.h: Define symbols for auditing interfaces. * include/link.h: Likewise. * include/dlfcn.h: Define __RTLD_AUDIT. Remove prototypes for _dl_open and _dl_close. Adjust access to argc and argv in libdl. * dlfcn/dlfcn.c: New file. * sysdeps/generic/dl-lookupcfg.h: Remove all content now that RESOLVE is gone. * sysdeps/generic/ldsodefs.h: Add definitions for auditing interfaces. * sysdeps/generic/unsecvars.h: Add LD_AUDIT. * sysdeps/i386/dl-machine.h: Remove trampoline code here. Adjust for removal of RESOLVE. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/generic/dl-trampoline.c: New file. * sysdeps/i386/dl-trampoline.c: New file. * sysdeps/x86_64/dl-trampoline.c: New file. * sysdeps/generic/dl-tls.c: Cleanups. Fixup for dtv_t change. Fix updating of DTV. * sysdeps/generic/libc-tls.c: Likewise. * sysdeps/arm/bits/link.h: Renamed to ... * sysdeps/arm/buts/linkmap.h: ...this. * sysdeps/generic/bits/link.h: Renamed to... * sysdeps/generic/bits/linkmap.h: ...this. * sysdeps/hppa/bits/link.h: Renamed to... * sysdeps/hppa/bits/linkmap.h: ...this. * sysdeps/hppa/i386/link.h: Renamed to... * sysdeps/hppa/i386/linkmap.h: ...this. * sysdeps/hppa/ia64/link.h: Renamed to... * sysdeps/hppa/ia64/linkmap.h: ...this. * sysdeps/hppa/s390/link.h: Renamed to... * sysdeps/hppa/s390/linkmap.h: ...this. * sysdeps/hppa/sh/link.h: Renamed to... * sysdeps/hppa/sh/linkmap.h: ...this. * sysdeps/hppa/x86_64/link.h: Renamed to... * sysdeps/hppa/x86_64/linkmap.h: ...this. 2005-01-06 Ulrich Drepper <drepper@redhat.com> * allocatestack.c (init_one_static_tls): Adjust initialization of DTV entry for static tls deallocation fix. * sysdeps/alpha/tls.h (dtv_t): Change pointer type to be struct which also contains information whether the memory pointed to is static TLS or not. * sysdeps/i386/tls.h: Likewise. * sysdeps/ia64/tls.h: Likewise. * sysdeps/powerpc/tls.h: Likewise. * sysdeps/s390/tls.h: Likewise. * sysdeps/sh/tls.h: Likewise. * sysdeps/sparc/tls.h: Likewise. * sysdeps/x86_64/tls.h: Likewise.
2004-12-22(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper
2007-07-122.5-18.1Jakub Jelinek
2004-09-24* sysdeps/x86_64/dl-machine.h (elf_machine_rela_relative): Remove Andreas Jaeger
static, add always_inline attribute. (elf_machine_rela): Likewise. (elf_machine_lazy_rel): Likewise. * elf/dynamic-link.h (elf_get_dynamic_info): Make static dependend on !RESOLVE so that it's not defined in local scope. * locale/weight.h (findidx): Remove static, it's not supported anymore with GCC 4.0 in a block scope. * locale/weightwc.h (findidx): Likewise. * posix/regcomp.c (seek_collating_symbol_entry): Likewise. (lookup_collation_sequence_value): Likewise. (build_range_exp): Likewise. (build_collating_symbol): Likewise. * iconv/iconvconfig.c (write_output): Likewise. * elf/do-rel.h (elf_dynamic_do_rel): Likewise.
2004-03-06Update.Ulrich Drepper
* configure.in: Recognize --enable-bind-now. * elf/dynamic-link.h (elf_get_dynamic_info): Allow bind-now flags in ld.so. * Makerules (LDFLAGS-c.so): Add -z now if so configured. * elf/Makefile ($(objpfx)ld.so): Likewise. * config.make.in (bind-now): New definition.
2004-02-21(elf_get_dynamic_info): Recognize DF_1_NOW. In ld.so, neither DT_FLAGS nor ↵Ulrich Drepper
DT_FLAGS_1 must be used.
2003-07-31* elf/dynamic-link.h (elf_machine_rel, elf_machine_rela, ↵Alexandre Oliva
elf_machine_rel_relative, elf_machine_rela_relative): Don't assume reloc_addr is aligned. * sysdeps/alpha/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/arm/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/cris/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/hppa/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/i386/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/ia64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/m68k/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/mips/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela_relative, elf_machine_rela): Adjust. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): * sysdeps/sh/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/x86_64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. 2003-07-31 Alexandre Oliva <aoliva@redhat.com> * elf/dynamic-link.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Don't assume reloc_addr is aligned. * sysdeps/alpha/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/arm/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/cris/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/hppa/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/i386/dl-machine.h (elf_machine_rel, elf_machine_rela, elf_machine_rel_relative, elf_machine_rela_relative): Adjust. * sysdeps/ia64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/m68k/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/mips/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela_relative, elf_machine_rela): Adjust. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): * sysdeps/sh/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust. * sysdeps/x86_64/dl-machine.h (elf_machine_rela, elf_machine_rela_relative): Adjust.
2003-05-20Update.Update.Ulrich Drepper
2003-05-20 Jakub Jelinek <jakub@redhat.com> * elf/dynamic-link.h (elf_get_dynamic_info): Add temp argument. If temp != NULL, copy dynamic entries which need relocation to temp array before relocating. (DL_RO_DYN_TEMP_CNT): Define. * elf/dl-load.c (_dl_map_object_from_fd): Adjust caller. * elf/rtld.c (_dl_start): Likewise. (dl_main): Likewise. Add dyn_temp static variable.
2003-01-30Update.Ulrich Drepper
2003-01-30 Jakub Jelinek <jakub@redhat.com> * sysdeps/alpha/tls.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Avoid warnings about unused self variable. * sysdeps/ia64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise. * sysdeps/s390/s390-32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise. * sysdeps/s390/s390-64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise. * sysdeps/sh/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise. * sysdeps/sparc/sparc32/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise. * sysdeps/sparc/sparc64/pt-machine.h (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC): Likewise.
2002-09-27(elf_get_dynamic_info): Also relocate DT_HASH entry if necessary.Ulrich Drepper
2002-08-31(elf_get_dynamic_info): Mark with always_inline attribute.Ulrich Drepper
2002-04-03Update.Ulrich Drepper
2002-04-02 Jakub Jelinek <jakub@redhat.com> * inet/ether_ntoh.c (__nss_ethers_lookup): Add internal_function. * inet/ether_hton.c (__nss_ethers_lookup): Likewise. * inet/getnetgrent_r.c (__nss_netgroup_lookup): Likewise. * sunrpc/netname.c (__nss_publickey_lookup): Likewise. * sunrpc/publickey.c (__nss_publickey_lookup): Likewise. 2002-03-30 Jakub Jelinek <jakub@redhat.com> * elf/dynamic-link.h (elf_get_dynamic_info): Don't abort on unknown dynamic tags. 2002-03-29 Jakub Jelinek <jakub@redhat.com> * sysdeps/i386/fpu/s_fabs.S: New file. * sysdeps/i386/fpu/s_fabsf.S: New file. * sysdeps/i386/fpu/s_fabsl.S: New file. * sysdeps/sparc/sparc64/fpu/s_fabs.c: New file. * sysdeps/sparc/sparc64/fpu/s_fabsf.c: New file. * sysdeps/sparc/sparc64/fpu/s_fabsl.c: New file. 2002-04-02 Ulrich Drepper <drepper@redhat.com> * rt/tst-shm.c (do_test): Add one more test for size of shared memory object. 2002-03-29 Wolfram Gloger <wg@malloc.de> * malloc/malloc.c: Add short description and prototypes for malloc_get_state, malloc_set_state and posix_memalign, for consistency and to avoid warnings with -Wstrict-prototypes. Reported by Andreas Jaeger <aj@suse.de>. 2002-04-02 Ulrich Drepper <drepper@redhat.com> * po/gl.po: Update from translation team.
2002-02-06Update.Ulrich Drepper
* elf/dl-minimal.c: Define _itoa_lower_digits. * elf/dynamic-link.h (elf_get_dynamic_info): ld.so can have DT_FLAGS set.
2002-02-06Update.Ulrich Drepper
* elf/dl-load.c (_dl_map_object_from_fd): Prevent dynamically loading modules with the DF_STATIC_TLS flag set. * elf/dynamic-link.h (elf_get_dynamic_info): Initialize l_flags element. * include/link.h (struct link_map): Add l_flags field. * elf/elf.h (DF_STATIC_TLS): New definition.
2002-02-02Update.Ulrich Drepper
* elf/do-rel.h (elf_dynamic_do_rel): Help the compiler recognize code which is never used when relocating ld.so itself. (_ELF_DYNAMIC_DO_RELOC): Help the compiler optimize a bit.
2002-02-02Update.Ulrich Drepper
2002-02-01 Ulrich Drepper <drepper@redhat.com> * elf/dynamic-link.h (elf_get_dynamic_info): Optimize a bit for starting ld.so itself. Move l_addr variable initialization closer to use.
2002-01-31Update.Ulrich Drepper
2002-01-30 Ulrich Drepper <drepper@redhat.com> * Versions.def [ld]: Add GLIBC_2.3. * elf/dl-addr.c: Move global variables for SHARED code in struct _rtld_global. Export this struct, remove all exports for the signal variables. * elf/dl-close.c: Likewise. * elf/dl-conflict.c: Likewise. * elf/dl-debug.c: Likewise. * elf/dl-deps.c: Likewise. * elf/dl-dst.h: Likewise. * elf/dl-error.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-init.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-libc.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-minimal.c: Likewise. * elf/dl-object.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-profstub.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-sym.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * elf/do-rel.h: Likewise. * elf/dynamic-link.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/libc-start.c: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/ia64/dl-fptr.c: Likewise. * sysdeps/ia64/dl-machine.h: Likewise. * sysdeps/unix/sysv/linux/dl-librecon.h: Likewise. * sysdeps/unix/sysv/linux/dl-origin.c: Likewise. * sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise. * sysdeps/unix/sysv/linux/getclktck.c: Likewise. * sysdeps/unix/sysv/linux/getpagesize.c: Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. * sysdeps/unix/sysv/linux/ia64/dl-static.c: Likewise. * sysdeps/unix/sysv/linux/ia64/getpagesize.c: Likewise. * malloc/thread-m.h: Spinlock definitions for x86/x86_64.
2001-12-12Update.Ulrich Drepper
2001-12-11 Jakub Jelinek <jakub@redhat.com> * elf/Makefile (dl-routines): Add conflict. (rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove. (ld.so): Add _begin local symbol. * elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM): Define. * elf/dl-deps.c (_dl_build_local_scope): New. (_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes of all libraries. * elf/do-rel.h (VALIDX): Define. (elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations can be skipped. * elf/dl-conflict.c: New file. * elf/dl-lookup.c (_dl_debug_bindings): New. (_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always non-NULL. (_dl_lookup_symbol_skip): Likewise. (_dl_lookup_versioned_symbol): Likewise. (_dl_lookup_versioned_symbol_skip): Likewise. * elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined, define to ElfW(Rel). * elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI ranges. Don't adjust address dynamic tags if l_addr is 0. * elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables. (_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked. (VALIDX, ADDRIDX): Define. (_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end. (dl_main): Print library list for LD_TRACE_PRELINKING. If prelinking information can be used, skip relocating libraries and call _dl_resolve_conflicts instead. (process_envvars): Handle LD_TRACE_PRELINKING envvar. * elf/dl-load.c (_dl_map_object): Don't create fake libs if LD_TRACE_PRELINKING. * include/link.h (struct link_map) [l_info]: Add DT_VALNUM + DT_ADDRNUM. * sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration. (DL_DEBUG_PRELINK): Define. (_dl_resolve_conflicts): Add prototype. * sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. (elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map. * sysdeps/arm/bits/link.h: New file. * sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP. (ELF_MACHINE_PLT_REL): Define. (elf_machine_rela, elf_machine_rela_relative): New. (elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/i386/bits/link.h: New file. * sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP. (ELF_MACHINE_PLT_REL): Define. (elf_machine_rela, elf_machine_rela_relative): New. (elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP to find out map for R_PPC_JMP_SLOT relocs. * sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define. (OPCODE_BA): Define. (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. (sparc_fixup_plt): Renamed from elf_machine_fixup_plt. (elf_machine_fixup_plt): Call sparc_fixup_plt. (elf_machine_rela): Set value to 0 if relocating conflicts. Call sparc_fixup_plt for R_SPARC_JMP_SLOT. * sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define. (sparc64_fixup_plt): Fix a typo. (elf_machine_rela): Set value to 0 if relocating conflicts. Handle R_SPARC_JMP_SLOT relocs when relocating conflicts. (elf_machine_runtime_setup): Reinitialize .plt for prelinked libraries where prelinking info cannot be used. * sysdeps/sh/bits/link.h: New file. * sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/s390/s390-32/bits/link.h: New file. * sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/s390/s390-64/bits/link.h: New file. * sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used. * sysdeps/x86_64/bits/link.h: New file. * sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup): Save original content of .got[1]. (elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead of adjusting it if prelinked and prelinking cannot be used.
2001-07-06Update to LGPL v2.1.Andreas Jaeger
2001-07-06 Paul Eggert <eggert@twinsun.com> * manual/argp.texi: Remove ignored LGPL copyright notice; it's not appropriate for documentation anyway. * manual/libc-texinfo.sh: "Library General Public License" -> "Lesser General Public License". 2001-07-06 Andreas Jaeger <aj@suse.de> * All files under GPL/LGPL version 2: Place under LGPL version 2.1.
2000-07-20Update.Ulrich Drepper
* elf/elf.h: Add various DF_1_*, DTF_1_*, and DF_P1_* entries. * elf/dl-close.c (_dl_close): Don't close an object if it is marked with nodelete. * elf/dl-open.c (dl_open_worker): Pass RTLD_NOLOAD as new parameter to _dl_map_object. Return immediately if no object loaded. Set DF_1_NODELETE bit in l_flags_1 if RTLD_NODELETE was passed. * elf/dynamic-link.h (elf_get_dynamic_info): Copy DT_FLAGS_1 entry if it exists into l_flags_1 word. * elf/dl-load.c (_dl_map_object_from_fd): Take no parameter and use it to determine whether loading is wanted or not. (_dl_map_object): Likewise. Call _dl_map_object_from_fd with new parameter. * sysdeps/generic/ldsodefs.h: Update prototype. * elf/dl-deps.c: Add new parameter to _dl_map_object calls. * elf/rtld.c: Likewise. * elf/Makefile (tests): Add noload. Add rules to generate noload. * elf/noload.c: New file. * include/link.h (struct link_map): Add l_feature_1 and l_flags_1. * sysdeps/generic/bits/dlfcn.h: Define RTLD_NOLOAD and RTLD_NODELETE. * sysdeps/mips/bits/dlfcn.h: Likewise.
2000-06-08Update.Ulrich Drepper
* include/elf.h: Include also <dl-dtprocnum.h>. * elf/dl-deps.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-rel.h: Likewise. * elf/dynamic-link.h: Likewise. * elf/link.h: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/dl-dtprocnum.h: New file. * sysdeps/ia64/dl-dtprocnum.h: New file. * sysdeps/mips/dl-dtprocnum.h: New file. * sysdeps/sparc/dl-dtprocnum.h: New file.
2000-03-30Update.Ulrich Drepper
2000-03-30 Ulrich Drepper <drepper@redhat.com> Implement dynamic determination of constructor/destructor order in the dynamic linker. * elf/Versions [ld.so] (GLIBC_2.0): Remove _dl_init_next. (GLIBC_2.2): Add _dl_init. * elf/dl-close.c: Also call all destructors in FINI_ARRAY. r_duplist is not anymore allocated separately. l_initfini is and therefore free it if necessary. * elf/dl-deps.c: If a searchlist has to be allocated, put all in one malloc block. Otherwise allocate l_initfini list only. Put dependencies for the object in l_initfini list. Sort dependencies for the object to be loaded topologically. * elf/dl-fini.c: Before running the destructors sort the topologically. * elf/dl-init.c (_dl_init): Renamed from _dl_init_next. Rewrite to call constructors instead of iterating over the pointers. Get list of objects for which to run constructors from l_initfini element. Accept argc, argv, and env as parameters and pass them to the constructors. * elf/ld-load.c (_dl_map_object_from_fd): Initialize l_ldnum member with size of dynamic section. * elf/dl-open.c (dl_open_worker): Only call _dl_init instead of _dl_init_next and calling constructors ourself. * elf/dl-preinit.c (_dl_preinit): Renamed from _dl_preinit_next. Take argc, argv, and env as parameters and pass them to the constructors. Rewrite to call all constructors and not iterate over the pointers. * elf/dynamic-link.h: Don't relocate DT_FINI_ARRAY entry. Don't precompute l_initcount and l_preinitcount. * elf/link.h (struct link_map): Add l_ldnum member. Make l_phdr_allocated part of the bitfield. Remove l_runcount, l_initcount, and l_preinitcount. Add l_initfini. * sysdeps/generic/ldsodefs.h: Replace _dl_init_next prototype with one for _dl_init. * sysdeps/i386/dl-machine (RTLD_START): Rewrite to match new init function interface. * sysdeps/unix/sysv/linux/init-first.h: Removed. * sysdeps/unix/sysv/linux/Dist: Delete file here as well. * sysdeps/unix/sysv/linux/init-first.c [PIC]: Don't use SYSDEP_CALL_INIT. Make _init a strong alias of init. The calling conventions now match. * sysdeps/generic/libc-start.c: Calling __libc_init_first has no effect for shared objects. Don't emit message and call only for static library.