glibc/csu
Szabolcs Nagy 86d439b06f csu: Move static pie self relocation later [BZ #27072]
IFUNC resolvers may depend on tunables and cpu feature setup so
move static pie self relocation after those.

It is hard to guarantee that the ealy startup code does not rely
on relocations so this is a bit fragile. It would be more robust
to handle RELATIVE relocs early and only IRELATIVE relocs later,
but the current relocation processing code cannot do that.

The early startup code up to relocation processing includes

  _dl_aux_init (auxvec);
  __libc_init_secure ();
  __tunables_init (__environ);
  ARCH_INIT_CPU_FEATURES ();
  _dl_relocate_static_pie ();

These are simple enough that RELATIVE relocs can be avoided.

The following steps include

  ARCH_SETUP_IREL ();
  ARCH_SETUP_TLS ();
  ARCH_APPLY_IREL ();

On some targets IRELATIVE processing relies on TLS setup on
others TLS setup relies on IRELATIVE relocs, so the right
position for _dl_relocate_static_pie is target dependent.
For now move self relocation as early as possible on targets
that support static PIE.

Fixes bug 27072.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-21 15:55:10 +00:00
..
abi-note.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
check_fds.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dso_handle.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elf-init.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
errno-loc.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
errno.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gmon-start.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
init-first.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
init.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
libc-start.c csu: Move static pie self relocation later [BZ #27072] 2021-01-21 15:55:10 +00:00
libc-tls.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
start.c More fallout from supporting only ELF 2012-01-08 00:45:01 -05:00
static-reloc.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sysdep.c
version.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Versions Remove unused %include lines from Versions files. 2014-02-22 00:58:54 -08:00