[lld] [lld] Add target support for SystemZ (s390x) (PR #75643)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 19 17:42:48 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) {
----------------
MaskRay wrote:
This adds overhead for other architectures and the ppc64 is not a good example to follow. Is it possible to not make other architectures pay the branch cost ?
https://github.com/llvm/llvm-project/pull/75643
More information about the llvm-commits
mailing list