Go to file
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
argp Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
assert Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
benchtests install: Replace scripts/output-format.sed with objdump -f [BZ #26559] 2021-01-11 12:03:36 -08:00
bits Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
catgets Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
ChangeLog.old Prepare for glibc 2.32 release. 2020-08-04 22:17:00 -04:00
conform Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
crypt Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
csu Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +00:00
ctype Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
debug Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
dirent Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
dlfcn Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
elf Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +00:00
gmon Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gnulib Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
grp Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
gshadow Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hesiod Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
htl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
iconv Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
iconvdata Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
include malloc: Add scratch_buffer_dupfree 2021-01-05 11:33:16 -03:00
inet Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
intl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
io Update STATX_ATTR_DAX value from Linux 5.10. 2021-01-11 14:57:08 +00:00
libio Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
locale Update automatically-generated copyright dates 2021-01-02 12:17:34 -08:00
localedata POSIX locale: Fix typo in comment 2021-01-09 12:14:44 +01:00
login Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
mach Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
malloc malloc: Add scratch_buffer_dupfree 2021-01-05 11:33:16 -03:00
manual <sys/platform/x86.h>: Remove the C preprocessor magic 2021-01-21 05:58:17 -08:00
math math/test-tgmath2: Fix fabs failure when no long double 2021-01-15 11:24:04 +09:00
mathvec Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
misc Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +00:00
nis Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
nptl nptl: Fix comment typo in pthread_cond_wait.c 2021-01-04 22:09:35 +01:00
nptl_db Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
nscd Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
nss Update copyright dates not handled by scripts/update-copyrights. 2021-01-02 12:17:34 -08:00
po Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
posix posix: Fix fnmatch.c on bootstrap 2021-01-20 13:23:33 -03:00
pwd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
resolv Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
resource Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
rt Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
scripts elf: Avoid RELATIVE relocs in __tunables_init 2021-01-21 14:05:15 +00:00
setjmp Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shadow Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
signal Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
socket Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
soft-fp Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stdio-common Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
stdlib stdlib: Add testcase for BZ #26241 2021-01-20 11:13:53 -03:00
string Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sunrpc Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
support posix: Fix return value of system if shell can not be executed [BZ #27053] 2021-01-11 12:26:58 -03:00
sysdeps Use hidden visibility for early static PIE code 2021-01-21 15:55:01 +00:00
sysvipc Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
termios Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
time Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
timezone Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wcsmbs Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wctype Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
.gitattributes
.gitignore
abi-tags
aclocal.m4
config.h.in configure: Check for static PIE support 2021-01-21 15:54:50 +00:00
config.make.in install: Replace scripts/output-format.sed with objdump -f [BZ #26559] 2021-01-11 12:03:36 -08:00
configure configure: Check for static PIE support 2021-01-21 15:54:50 +00:00
configure.ac configure: Check for static PIE support 2021-01-21 15:54:50 +00:00
COPYING
COPYING.LIB
extra-lib.mk
gen-locales.mk
INSTALL config: Allow memory tagging to be enabled when configuring glibc 2020-12-21 15:25:25 +00:00
libc-abis riscv: support GNU indirect function 2021-01-10 21:25:13 -05:00
libof-iterator.mk
LICENSES
MAINTAINERS
Makeconfig 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
Makefile.help Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
Makefile.in
Makerules Makerules: Do not require startup files for format.lds probe object 2021-01-12 12:22:47 +01:00
NEWS ld.so: Add --list-tunables to print tunable values 2021-01-15 05:59:10 -08:00
o-iterator.mk
README Documentation for the RISC-V 32-bit port 2020-08-27 08:17:44 -07:00
Rules Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
shlib-versions Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
test-skeleton.c Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
version.h Open master branch for glibc 2.33 development. 2020-08-04 23:41:43 -04:00

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	ia64-*-linux-gnu
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.