glibc/sysdeps/powerpc/powerpc64
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
..
a2 Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
be Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
bits Define wordsize.h macros everywhere 2016-11-04 09:37:44 -07:00
cell Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
fpu powerpc: Remove fcopysign{f} implementation 2022-04-07 12:00:16 -03:00
le configure.ac: fix bashisms in configure.ac 2022-03-22 21:53:43 -04:00
multiarch powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
power4 powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
power6 powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
power7 powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
power8 powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
__longjmp-common.S powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
__longjmp.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
addmul_1.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
bsd-_setjmp.S PowerPC64 ABI fixes 2010-08-12 09:19:19 -07:00
bsd-setjmp.S PowerPC64 ABI fixes 2010-08-12 09:19:19 -07:00
configure powerpc: Define USE_PPC64_NOTOC iff compiler supports it 2021-11-22 14:49:11 -03:00
configure.ac powerpc: Define USE_PPC64_NOTOC iff compiler supports it 2021-11-22 14:49:11 -03:00
crti.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
crtn.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
dl-funcdesc.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
dl-irel.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
dl-machine.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
dl-machine.h powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
dl-trampoline.S powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
ffsll.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
hp-timing.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
Implies Revert "Use ieee754/dbl-64/wordsize-64 on powerpc64" 2013-01-10 10:44:05 +01:00
lshift.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
Makefile Remove stale references to libdl.a 2021-06-09 19:14:02 +02:00
memcpy.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
memset.S powerpc: Remove powerpc64 bzero optimizations 2022-02-23 14:18:18 -03:00
mul_1.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
ppc-mcount.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
rtld-memset.c powerpc: Use generic memset for RTLD for ppc32/64 2010-09-29 12:21:14 -04:00
setjmp-bug21895.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
setjmp-common.S powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
setjmp.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
stackguard-macros.h PowerPC: Fix POINTER_CHK_GUARD thread register for PPC64 2013-09-25 13:43:04 -05:00
start.S powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
strchr.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
strcmp.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
strlen.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
strncmp.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
submul_1.S Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
sysdep.h powerpc64: Use medium model toc accesses throughout 2022-04-10 08:33:06 +09:30
tst-audit.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-setjmp-bug21895-static.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-ucontext-ppc64-vscr.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00