glibc/csu
Szabolcs Nagy 47618209d0 Use hidden visibility for early static PIE code
Extern symbol access in position independent code usually involves GOT
indirection which needs RELATIVE reloc in a static linked PIE. (On
some targets this is avoided e.g. because the linker can relax a GOT
access to a pc-relative access, but this is not generally true.) Code
that runs before static PIE self relocation must avoid relying on
dynamic relocations which can be ensured by using hidden visibility.
However we cannot just make all symbols hidden:

On i386, all calls to IFUNC functions must go through PLT and calls to
hidden functions CANNOT go through PLT in PIE since EBX used in PIE PLT
may not be set up for local calls to hidden IFUNC functions.

This patch aims to make symbol references hidden in code that is used
before and by _dl_relocate_static_pie when building a static PIE libc.
Note: for an object that is used in the startup code, its references
and definition may not have consistent visibility: it is only forced
hidden in the startup code.

This is needed for fixing bug 27072.

Co-authored-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2021-01-21 15:55:01 +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 Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +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 Moved to csu/errno-loc.c. 2005-12-14 15:06:39 +00:00
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