glibc/sysdeps
Alan Modra d6efcc118e powerpc64: Use medium model toc accesses throughout
The PowerPC64 linker edits medium model toc-indirect code to toc-pointer
relative:
	addis r9,r2,tc_entry_for_var@toc@ha
	ld r9,tc_entry_for_var@toc@l(r9)
becomes
	addis r9,r2,(var-.TOC.)@ha
	addi r9,r9,(var-.TOC.)@l
when "var" is known to be local to the binary.  This isn't done for
small-model toc-indirect code, because "var" is almost guaranteed to
be too far away from .TOC. for a 16-bit signed offset.  And, because
the analysis of which .toc entry can be removed becomes much more
complicated in objects that mix code models, they aren't removed if
any small-model toc sequence appears in an object file.

Unfortunately, glibc's build of ld.so smashes the needed objects
together in a ld -r linking stage.  This means the GOT/TOC is left
with a whole lot of relative relocations which is untidy, but in
itself is not a serious problem.  However, static-pie on powerpc64
bombs due to a segfault caused by one of the small-model accesses
before _dl_relocate_static_pie.  (The very first one in rcrt1.o
passing start_addresses in r8 to __libc_start_main.)

So this patch makes all the toc/got accesses in assembly medium code
model, and a couple of functions hidden.  By itself this is not
enough to give us working static-pie, but it is useful in isolation to
enable better linker optimisation.

There's a serious problem in libgcc too.  libgcc ifuncs access the
AT_HWCAP words stored in the tcb with an offset from the thread
pointer (r13), but r13 isn't set at the time _dl_relocate_static_pie.
A followup patch will fix that.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
2022-04-10 08:33:06 +09:30
..
aarch64 elf: Fix runtime linker auditing on aarch64 (BZ #26643) 2022-02-01 14:49:46 -03:00
alpha alpha: Remove fcopysign{f} implementation 2022-04-07 14:56:26 -03:00
arc Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
arm Remove -z combreloc and HAVE_Z_COMBRELOC 2022-04-04 17:19:07 -07:00
csky Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
generic elf: Remove inline _dl_dprintf 2022-03-23 10:42:01 -03:00
gnu Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
hppa Remove -z combreloc and HAVE_Z_COMBRELOC 2022-04-04 17:19:07 -07:00
htl htl: Fix initializing the key lock 2022-02-14 19:29:02 +01:00
hurd hurd: Fix pthread_kill on exiting/ted thread 2022-01-15 15:11:54 +01:00
i386 x86: Remove fcopysign{f} implementation 2022-04-07 12:17:15 -03:00
ia64 ia64: Remove fcopysign{f} implementation 2022-04-07 12:27:00 -03:00
ieee754 math: Use builtin for ldbl-96 copysign 2022-04-07 14:54:14 -03:00
m68k Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
mach posix: Replace posix_spawnattr_tc{get,set}pgrp_np with posix_spawn_file_actions_addtcsetpgrp_np 2022-02-02 08:34:16 -03:00
microblaze Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
mips elf: Add <dl-r_debug.h> 2022-01-31 07:05:48 -08:00
nios2 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
nptl Linux: Use ptrdiff_t for __rseq_offset 2022-02-02 22:37:20 +01:00
or1k elf: Remove prelink support 2022-02-10 09:16:12 -03:00
posix gmon: Remove unused sprofil.c functions 2022-03-23 14:29:25 -03:00
powerpc powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
pthread pthread: Do not overwrite tests-time64 2022-03-07 10:02:54 -03:00
riscv Remove -z combreloc and HAVE_Z_COMBRELOC 2022-04-04 17:19:07 -07:00
s390 Remove -z combreloc and HAVE_Z_COMBRELOC 2022-04-04 17:19:07 -07:00
sh elf: Remove prelink support 2022-02-10 09:16:12 -03:00
sparc sparc64: Remove fcopysign{f} implementation 2022-04-07 15:11:56 -03:00
unix linux: Constify rfv variable in dl_vdso_vsym 2022-04-10 08:33:02 +09:30
wordsize-32 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
x86 x86: Fix fallback for wcsncmp_avx2 in strcmp-avx2.S [BZ #28896] 2022-03-25 11:46:13 -05:00
x86_64 x86: Remove fcopysign{f} implementation 2022-04-07 12:17:15 -03:00