mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-25 06:20:06 +00:00
d6efcc118e
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> |
||
---|---|---|
.. | ||
a2 | ||
be | ||
bits | ||
cell | ||
fpu | ||
le | ||
multiarch | ||
power4 | ||
power6 | ||
power7 | ||
power8 | ||
__longjmp-common.S | ||
__longjmp.S | ||
addmul_1.S | ||
atomic-machine.h | ||
bsd-_setjmp.S | ||
bsd-setjmp.S | ||
configure | ||
configure.ac | ||
crti.S | ||
crtn.S | ||
dl-dtprocnum.h | ||
dl-funcdesc.h | ||
dl-irel.h | ||
dl-machine.c | ||
dl-machine.h | ||
dl-trampoline.S | ||
ffsll.c | ||
hp-timing.h | ||
Implies | ||
lshift.S | ||
Makefile | ||
memcpy.S | ||
memset.S | ||
mul_1.S | ||
ppc-mcount.S | ||
rtld-memset.c | ||
setjmp-bug21895.c | ||
setjmp-common.S | ||
setjmp.S | ||
stackguard-macros.h | ||
start.S | ||
strchr.S | ||
strcmp.S | ||
strlen.S | ||
strncmp.S | ||
submul_1.S | ||
sysdep.h | ||
tst-audit.h | ||
tst-setjmp-bug21895-static.c | ||
tst-ucontext-ppc64-vscr.c |