glibc/sysdeps/generic
Florian Weimer ec935dea63 elf: Implement __libc_early_init
This function is defined in libc.so, and the dynamic loader calls
right after relocation has been finished, before any ELF constructors
or the preinit function is invoked.  It is also used in the static
build for initializing parts of the static libc.

To locate __libc_early_init, a direct symbol lookup function is used,
_dl_lookup_direct.  It does not search the entire symbol scope and
consults merely a single link map.  This function could also be used
to implement lookups in the vDSO (as an optimization).

A per-namespace variable (libc_map) is added for locating libc.so,
to avoid repeated traversals of the search scope.  It is similar to
GL(dl_initfirst).  An alternative would have been to thread a context
argument from _dl_open down to _dl_map_object_from_fd (where libc.so
is identified).  This could have avoided the global variable, but
the change would be larger as a result.  It would not have been
possible to use this to replace GL(dl_initfirst) because that global
variable is used to pass the function pointer past the stack switch
from dl_main to the main program.  Replacing that requires adding
a new argument to _dl_init, which in turn needs changes to the
architecture-specific libc.so startup code written in assembler.

__libc_early_init should not be used to replace _dl_var_init (as
it exists today on some architectures).  Instead, _dl_lookup_direct
should be used to look up a new variable symbol in libc.so, and
that should then be initialized from the dynamic loader, immediately
after the object has been loaded in _dl_map_object_from_fd (before
relocation is run).  This way, more IFUNC resolvers which depend on
these variables will work.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-04-24 22:32:09 +02:00
..
net Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
netinet Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
nfs Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
sys Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
_G_config.h
_itoa.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
a.out.h
abort-instr.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
adaptive_spin_count.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
aio_misc.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
allocalim.h
arch-fd_to_filename.h <fd_to_filename.h>: Add type safety and port to Hurd 2020-02-18 13:42:29 +01:00
asm-syntax.h
atomic-machine.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
c++-types.data
confstr.h
crti.S Introduce <elf-initfini.h> and ELF_INITFINI for all architectures 2020-02-18 15:12:25 +01:00
crtn.S Introduce <elf-initfini.h> and ELF_INITFINI for all architectures 2020-02-18 15:12:25 +01:00
device-nrs.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dirstream.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-auxv.h powerpc: Move cache line size to rtld_global_ro 2020-01-17 09:05:03 -03:00
dl-cache.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-dtv.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-fcntl.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-fileid.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-fptr.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-hash.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-irel.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-librecon.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-lookupcfg.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-machine.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-mman.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-osinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-procinfo.c
dl-procinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-procruntime.c
dl-prop.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-sysdep.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-tls.h
dl-unistd.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
dl-vdso-setup.c elf: Move vDSO setup to rtld (BZ#24967) 2020-01-03 11:22:07 -03:00
dl-vdso-setup.h elf: Move vDSO setup to rtld (BZ#24967) 2020-01-03 11:22:07 -03:00
dl-vdso.h elf: Move vDSO setup to rtld (BZ#24967) 2020-01-03 11:22:07 -03:00
dwarf2.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
elf_machine_sym_no_match.h elf: Introduce <elf_machine_sym_no_match.h> 2020-04-24 22:13:03 +02:00
elf-initfini.h Introduce <elf-initfini.h> and ELF_INITFINI for all architectures 2020-02-18 15:12:25 +01:00
elide.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
eloop-threshold.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
entry.h
errqueue.h
exit-thread.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fd_to_filename.h <fd_to_filename.h>: Add type safety and port to Hurd 2020-02-18 13:42:29 +01:00
fenv_private.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fips-private.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fix-fp-int-compare-invalid.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fix-fp-int-convert-overflow.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fix-int-fp-convert-zero.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
float128-abi.h
fork.h
fpu_control.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
framestate.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gcc-compat.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gccframe.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
get-rounding-mode.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
gmp-mparam.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
hp-timing-common.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
hp-timing.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ifreq.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ifunc-init.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ifunc-sel.h
internal-signals.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
intr-msg.h
ld.abilist
ldbl-classify-compat.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ldconfig.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
ldsodefs.h elf: Implement __libc_early_init 2020-04-24 22:32:09 +02:00
libanl.abilist
libBrokenLocale.abilist
libc-lock.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc-mmap.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc-start.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc-tsd.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libc.abilist
libcrypt.abilist
libdl.abilist
libm-alias-double.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libm-alias-float128.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libm-alias-float.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libm-alias-ldouble.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
libm-test-ulps
libm-test-ulps-name
libm.abilist
libnsl.abilist
libnss_compat.abilist
libnss_db.abilist
libnss_dns.abilist
libnss_files.abilist
libnss_hesiod.abilist
libnss_nis.abilist
libnss_nisplus.abilist
libpthread.abilist
libresolv.abilist
librt.abilist
libutil.abilist
link_map.h
linkmap.h
local-setxid.h
localplt.data ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
machine-lock.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
machine-sp.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Makefile Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
malloc-alignment.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
malloc-machine.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
malloc-sysdep.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math_ldbl_opt.h
math_ldbl.h
math_private_calls.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math_private.h
math-barriers.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-nan-payload-double.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-nan-payload-float.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-narrow-alias-float128.h ldbl-128ibm-compat: Provide ieee128 symbols to narrow functions 2020-02-20 17:12:14 -06:00
math-tests-arch.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-exceptions.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-rounding.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-snan-cast.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-snan-payload.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-snan.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-trap-force.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests-trap.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-tests.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-type-macros-double.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-type-macros-float128.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-type-macros-float.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-type-macros-ldouble.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
math-type-macros.h Add libm_alias_finite for _finite symbols 2020-01-03 10:02:04 -03:00
math-use-builtins.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
memcopy.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
memusage.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
mmap_info.h
nan-high-order-bit.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
not-cancel.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
not-errno.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
nscd-types.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
pagecopy.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
paths.h
profil-counter.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
pty-private.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
register-dump.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
rtld-lowlevel.h
safe-fatal.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
setjmpP.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
siglist.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
sigset-cvt-mask.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
sigsetops.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
single-thread.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stackguard-macros.h
stackinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stap-probe-machine.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
startup.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
stdio-lock.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
string_private.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
symbol-hacks.h
sysdep-cancel.h
sysdep.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
thread_state.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
time-clockid.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
tininess.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
tls-macros.h
tls-setup.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
tls.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
tst-audit.h
tst-stack-align.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unsecvars.h
unwind-arch.h mips: Fix bracktrace result for signal frames 2020-02-18 10:39:03 -03:00
unwind-dw2-fde-glibc.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind-dw2-fde.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind-dw2-fde.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind-dw2.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind-pe.c
unwind-pe.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind-resume.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
unwind.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
utmp-equal.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00