f378ab099d
ELFv2 functions with localentry:0 are those with a single entry point, ie. global entry == local entry, and that have no requirement on r2 or r12, and guarantee r2 is unchanged on return. Such an external function can be called via the PLT without saving r2 or restoring it on return, avoiding a common load-hit-store for small functions. The optimization is attractive. The TOC pointer load-hit-store is a major reason why calls to small functions that need no register saves, or with shrink-wrap, no register saves on a fast path, are slow on powerpc64le. To be safe, this optimization needs ld.so support to check that the run-time matches link-time function implementation. If a function in a shared library with st_other localentry non-zero is called without saving and restoring r2, r2 will be trashed on return, leading to segfaults. For that reason the optimization does not happen for weak functions since a weak definition is a fairly solid hint that the function will likely be overridden. I'm also not enabling the optimization by default unless glibc-2.26 is detected, which should have the ld.so checks implemented. bfd/ * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0. (ppc64_elf_merge_symbol_attribute): Merge localentry bits from dynamic objects. (is_elfv2_localentry0): New function. (ppc64_elf_tls_setup): Default params->plt_localentry0. (plt_stub_size): Adjust size for tls_get_addr_opt stub. (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved. (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for optimized localentry:0 stubs. (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve. (ppc64_elf_relocate_section): Leave nop unchanged for optimized localentry:0 stubs. (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in DT_PPC64_OPT. * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0. include/ * elf/ppc64.h (PPC64_OPT_LOCALENTRY): Define. ld/ * emultempl/ppc64elf.em (params): Init plt_localentry0 field. (enum ppc64_opt): New, replacing OPTION_* defines. Add OPTION_PLT_LOCALENTRY, and OPTION_NO_PLT_LOCALENTRY. (PARSE_AND_LIST_*): Support --plt-localentry and --no-plt-localentry. * testsuite/ld-powerpc/elfv2so.d: Update. * testsuite/ld-powerpc/powerpc.exp (TLS opt 5): Use --no-plt-localentry. * testsuite/ld-powerpc/tlsopt5.d: Update. |
||
---|---|---|
.. | ||
aarch64elf.em | ||
aix.em | ||
alphaelf.em | ||
arclinux.em | ||
armcoff.em | ||
armelf.em | ||
astring.sed | ||
avrelf.em | ||
beos.em | ||
bfin.em | ||
cr16elf.em | ||
crxelf.em | ||
elf32.em | ||
elf-generic.em | ||
epiphanyelf_4x4.em | ||
genelf.em | ||
generic.em | ||
gld960.em | ||
gld960c.em | ||
hppaelf.em | ||
ia64elf.em | ||
irix.em | ||
linux.em | ||
lnk960.em | ||
m68hc1xelf.em | ||
m68kcoff.em | ||
m68kelf.em | ||
metagelf.em | ||
mipself.em | ||
mmix-elfnmmo.em | ||
mmixelf.em | ||
mmo.em | ||
msp430.em | ||
nds32elf.em | ||
needrelax.em | ||
netbsd.em | ||
nios2elf.em | ||
ostring.sed | ||
pe.em | ||
pep.em | ||
ppc32elf.em | ||
ppc64elf.em | ||
pruelf.em | ||
README | ||
riscvelf.em | ||
rxelf.em | ||
scoreelf.em | ||
sh64elf.em | ||
solaris2.em | ||
spu_icache.o_c | ||
spu_icache.S | ||
spu_ovl.o_c | ||
spu_ovl.S | ||
spuelf.em | ||
sunos.em | ||
tic6xdsbt.em | ||
ticoff.em | ||
v850elf.em | ||
vanilla.em | ||
vms.em | ||
vxworks.em | ||
xtensaelf.em | ||
z80.em |
The files in this directory are sourced by genscripts.sh, after
setting some variables to substitute in, to produce
C source files that contain jump tables for each emulation.
Copyright (C) 2012-2017 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.