llvm-capstone/lld
Ulrich Weigand 347977c8b1 [lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739)
With the new SystemZ port we noticed that -pie executables generated
from files containing R_390_TLS_IEENT relocations will have unnecessary
relocations in their GOT:

                        9e8d8: R_390_TLS_TPOFF  *ABS*+0x18

This is caused by the config->isPic conditon in addTpOffsetGotEntry:

 static void addTpOffsetGotEntry(Symbol &sym) {
   in.got->addEntry(sym);
   uint64_t off = sym.getGotOffset();
   if (!sym.isPreemptible && !config->isPic) {
     in.got->addConstant({R_TPREL, target->symbolicRel, off, 0, &sym});
     return;
   }

It is correct that we need to retain a TPOFF relocation if the target
symbol is preemptible or if we're building a shared library. But when
building a -pie executable, those values are fixed at link time and
there's no need for any remaining dynamic relocation.

Note that the equivalent MIPS-specific code in MipsGotSection::build
checks for config->shared instead of config->isPic; we should use the
same check here. (Note also that on many other platforms we're not even
using addTpOffsetGotEntry in this case as an IE->LE relaxation is
applied before; we don't have this type of relaxation on SystemZ.)

(cherry picked from commit 6f907733e65d24edad65f763fb14402464bd578b)
2024-02-16 12:24:37 -08:00
..
cmake/modules [LLD] Fix llvm-driver cmake integration for LLD (#76305) 2024-01-11 19:05:46 -05:00
COFF [LLD] [COFF] Pick timestamps from the SOURCE_DATE_EPOCH variable (#81326) 2024-02-10 17:48:47 -08:00
Common [ELF] Claim recognized -z options. NFC 2024-01-21 17:43:05 -08:00
docs [LLD] [docs] Add more release notes for COFF and MinGW (#81977) 2024-02-16 05:48:29 -08:00
ELF [lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739) 2024-02-16 12:24:37 -08:00
include/lld/Common [NFC][LLD] Refactor some copy-paste into the Common library (#67598) 2023-09-28 00:06:48 +02:00
MachO [lld-macho][arm64] implement -objc_stubs_small (#78665) 2024-01-23 07:31:34 -08:00
MinGW [LLD] [MinGW] Implement the --lto-emit-asm and -plugin-opt=emit-llvm options (#81475) 2024-02-16 05:07:05 -08:00
test [lld/ELF] Avoid unnecessary TPOFF relocations in GOT for -pie (#81739) 2024-02-16 12:24:37 -08:00
tools/lld [llvm-driver] Fix usage of InitLLVM on Windows (#76306) 2024-01-11 19:08:28 -05:00
unittests Re-land [LLD] Allow usage of LLD as a library 2023-06-19 07:35:11 -04:00
utils [NFC][Py Reformat] Reformat python files in the rest of the dirs 2023-05-25 11:17:05 +02:00
wasm [lld][WebAssembly] Implement --start-lib/--end-lib (#78821) 2024-01-22 10:04:26 -08:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [lld] respect LLVM_EXTERNAL_LIT 2023-07-06 16:35:01 +02:00
CODE_OWNERS.TXT
LICENSE.TXT
README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.

Benchmarking

In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.

It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz

The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.