llvm-project/lld/ELF/Arch
Fangrui Song 6cdd68e386 [PPC64] Define getThunkSectionSpacing() based on the range of R_PPC64_REL24
Suggested by Sean Fertile and Peter Smith.

Thunk section spacing decrease the total number of thunks. I measured a
decrease of 1% or less in some large programs, with no perceivable
slowdown in link time. Override getThunkSectionSpacing() to enable it.
0x2000000 is the farthest point R_PPC64_REL24 can reach. I tried several
numbers and found 0x2000000 works the best. Numbers near 0x2000000 work
as well but let's just use the simpler number.

As demonstrated by the updated tests, this essentially changes placement
of most thunks to the end of the output section. We leverage this
property to fix PR40740 reported by Alfredo Dal'Ava Júnior:

The output section .init consists of input sections from several object
files (crti.o crtbegin.o crtend.o crtn.o). Sections other than the last
one do not have a terminator. With this patch, we create the thunk after
the last .init input section and thus fix the issue. This is not
foolproof but works quite well for such sections (with no terminator) in
practice.

Reviewed By: ruiu, sfertile

Differential Revision: https://reviews.llvm.org/D61720

llvm-svn: 360405
2019-05-10 05:51:00 +00:00
..
AArch64.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AMDGPU.cpp Improve error message for unknown relocations. 2019-02-14 18:02:20 +00:00
ARM.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AVR.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Hexagon.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MSP430.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Mips.cpp [mips] Fix ld instruction in PLT entries on MIPS64 2019-05-07 20:26:23 +00:00
MipsArchTree.cpp ELF: De-template ELFFileBase. NFCI. 2019-04-05 20:16:26 +00:00
PPC.cpp Create an instance of Target after reading all input files. NFC. 2019-03-28 17:38:53 +00:00
PPC64.cpp [PPC64] Define getThunkSectionSpacing() based on the range of R_PPC64_REL24 2019-05-10 05:51:00 +00:00
RISCV.cpp [RISCV] Fix range check for HI20/LO12/RVC_LUI relocations 2019-04-09 11:39:23 +00:00
SPARCV9.cpp Inline a trivial function. NFC. 2019-03-28 01:37:48 +00:00
X86.cpp [ELF][X86] Allow R_386_TLS_LDO_32 and R_X86_64_DTPOFF{32,64} to preemptable local-dynamic symbols 2019-04-22 03:10:40 +00:00
X86_64.cpp [PPC64] toc-indirect to toc-relative relaxation 2019-05-07 04:26:05 +00:00