[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 12:32:25 PST 2023
================
@@ -1404,6 +1404,26 @@ template <class ELFT, class RelTy> void RelocationScanner::scanOne(RelTy *&i) {
if (expr == R_NONE)
return;
+ // Like other platforms, calls to the TLS helper routine on SystemZ carry
+ // two relocations, one for the helper routine itself, and a TLS marker
+ // relocation. When relaxing the TLS model, the helper routine is no longer
+ // needed, and its relocation should be removed. Unlike other platforms,
+ // on SystemZ the TLS marker routine typically comes *after* the helper
+ // routine relocation, so the getTlsGdRelaxSkip mechanism used by
+ // handleTlsRelocation does not work on this platform.
+ //
+ // Instead, check for this case here: if we are building a main executable
+ // (i.e. TLS relaxation applies), and the relocation *after* the current one
+ // is a TLS call marker instruction matching the current instruction, then
+ // skip this relocation.
+ if (config->emachine == EM_S390 && !config->shared) {
----------------
uweigand wrote:
I tried to find a better way, but didn't see anything obvious. Given how large and complex this function already is, would that single (normally very well-predicted) branch really be noticeable?
https://github.com/llvm/llvm-project/pull/75643
More information about the llvm-commits
mailing list