Skip to content

[X86][APX] Suppress EGPR/NDD instructions for relocations #136660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 29, 2025

Conversation

fzou1
Copy link
Contributor

@fzou1 fzou1 commented Apr 22, 2025

Suppress EGPR/NDD instructions for relocations to avoid APX relocation types emitted. This is to keep backward compatibility with old version of linkers without APX support. The use case is to try APX features with LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in 2032.
If there are APX relocation types, the old version of linkers would raise "unsupported relocation type" error. Example:

$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4

Introduce an option (-mapx-relax-relocations) to control the emission of the
new APX relocations. It's off by default to keep backward compatibility with
older version of ld and other linkers without APX support. And EGPR and NDD are
also suppressed to avoid the instructions updated incorrectly by older version
of linker.
@fzou1 fzou1 requested review from MaskRay and KanRobert April 22, 2025 06:50
@llvmbot llvmbot added clang Clang issues not falling into any other category lld backend:X86 clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen IR generation bugs: mangling, exceptions, etc. mc Machine (object) code lld:ELF LTO Link time optimization (regular/full LTO or ThinLTO) labels Apr 22, 2025
@fzou1 fzou1 requested a review from phoebewang April 22, 2025 06:51
@llvmbot
Copy link
Member

llvmbot commented Apr 22, 2025

@llvm/pr-subscribers-mc
@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-backend-x86

Author: Feng Zou (fzou1)

Changes

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.


Patch is 57.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/136660.diff

37 Files Affected:

  • (modified) clang/CMakeLists.txt (+3)
  • (modified) clang/cmake/caches/Fuchsia-stage2.cmake (+1)
  • (modified) clang/cmake/caches/Fuchsia.cmake (+1)
  • (modified) clang/include/clang/Basic/CodeGenOptions.def (+1)
  • (modified) clang/include/clang/Config/config.h.cmake (+3)
  • (modified) clang/include/clang/Driver/Options.td (+3)
  • (modified) clang/include/clang/Driver/ToolChain.h (+3)
  • (modified) clang/lib/CodeGen/BackendUtil.cpp (+1)
  • (modified) clang/lib/Driver/ToolChain.cpp (+4)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+10)
  • (modified) clang/test/Driver/relax.s (+12-3)
  • (modified) clang/tools/driver/cc1as_main.cpp (+5)
  • (modified) lld/ELF/Arch/X86_64.cpp (+3-3)
  • (modified) lld/test/ELF/tls-opt.s (+78-33)
  • (modified) lld/test/ELF/x86-64-gotpc-no-relax-err.s (+7-2)
  • (modified) lld/test/ELF/x86-64-gotpc-relax-nopic.s (+25-10)
  • (modified) lld/test/ELF/x86-64-gotpc-relax.s (+64-27)
  • (modified) lld/test/ELF/x86-64-tlsdesc-gd.s (+32-5)
  • (modified) llvm/include/llvm/MC/MCTargetOptions.h (+2)
  • (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+2)
  • (modified) llvm/lib/LTO/LTO.cpp (+1)
  • (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+10)
  • (modified) llvm/lib/Target/X86/CMakeLists.txt (+1)
  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h (+22)
  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp (+13-7)
  • (modified) llvm/lib/Target/X86/X86.h (+1)
  • (modified) llvm/lib/Target/X86/X86InstrInfo.cpp (+1-16)
  • (added) llvm/lib/Target/X86/X86SuppressEGPRAndNDDForReloc.cpp (+145)
  • (modified) llvm/lib/Target/X86/X86TargetMachine.cpp (+2)
  • (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (+1)
  • (added) llvm/test/CodeGen/X86/apx/tls-desc.ll (+96)
  • (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (+3)
  • (modified) llvm/test/MC/ELF/relocation-alias.s (+7-1)
  • (modified) llvm/test/MC/X86/elf-reloc-tls.s (+15-1)
  • (modified) llvm/test/MC/X86/gotpcrelx.s (+48-1)
  • (modified) llvm/test/MC/X86/tlsdesc-64.s (+7-1)
  • (modified) llvm/tools/gold/gold-plugin.cpp (+2)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c3f30e2a8e9c0..fa3063d6be9a7 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -219,6 +219,9 @@ set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
     "enable x86 relax relocations by default")
 
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL
+    "Enable x86 APX relax relocations by default")
+
 set(PPC_LINUX_DEFAULT_IEEELONGDOUBLE OFF CACHE BOOL
     "Enable IEEE binary128 as default long double format on PowerPC Linux.")
 
diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 99890b8246ad7..22eef24b611a8 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -49,6 +49,7 @@ set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL "")
 
 # TODO(#67176): relative-vtables doesn't play well with different default
 # visibilities. Making everything hidden visibility causes other complications
diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 83336589da305..550d94d1ec6a5 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -89,6 +89,7 @@ set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL "")
 
 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def
index c5990fb248689..875facd6cfc63 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -201,6 +201,7 @@ CODEGENOPT(UniqueInternalLinkageNames, 1, 0) ///< Internal Linkage symbols get u
 CODEGENOPT(SplitMachineFunctions, 1, 0) ///< Split machine functions using profile information.
 CODEGENOPT(PPCUseFullRegisterNames, 1, 0) ///< Print full register names in assembly
 CODEGENOPT(X86RelaxRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
+CODEGENOPT(X86APXRelaxRelocations, 1, 0) ///< -Wa,-mrelax-relocations={yes,no}
 CODEGENOPT(X86Sse2Avx        , 1, 0)   ///< -Wa,-msse2avx
 
 /// When false, this attempts to generate code as if the result of an
diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake
index 00c352b458c34..db7fc2ba45eaf 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -72,6 +72,9 @@
 /* enable x86 relax relocations by default */
 #cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
 
+/* enable x86 APX relax relocations by default */
+#cmakedefine01 ENABLE_X86_APX_RELAX_RELOCATIONS
+
 /* Enable IEEE binary128 as default long double format on PowerPC Linux. */
 #cmakedefine01 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
 
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 919c1c643d080..a3becf76a7671 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7442,6 +7442,9 @@ def mmapsyms_implicit : Flag<["-"], "mmapsyms=implicit">,
 def mrelax_relocations_no : Flag<["-"], "mrelax-relocations=no">,
     HelpText<"Disable x86 relax relocations">,
     MarshallingInfoNegativeFlag<CodeGenOpts<"X86RelaxRelocations">>;
+def mapx_relax_relocations_yes : Flag<["-"], "mapx-relax-relocations=yes">,
+    HelpText<"Enable x86 APX relax relocations">,
+    MarshallingInfoNegativeFlag<CodeGenOpts<"X86APXRelaxRelocations">>;
 def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
   HelpText<"Save temporary labels in the symbol table. "
            "Note this may change .s semantics and shouldn't generally be used "
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index d0059673d6a67..ef90956e25de0 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -473,6 +473,9 @@ class ToolChain {
   /// Check whether to enable x86 relax relocations by default.
   virtual bool useRelaxRelocations() const;
 
+  /// Check whether to enable x86 APX relax relocations by default.
+  virtual bool useAPXRelaxRelocations() const;
+
   /// Check whether use IEEE binary128 as long double format by default.
   bool defaultToIEEELongDouble() const;
 
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f7eb853beb23c..72643631f39fc 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -513,6 +513,7 @@ static bool initTargetOptions(const CompilerInstance &CI,
   Options.MCOptions.Crel = CodeGenOpts.Crel;
   Options.MCOptions.ImplicitMapSyms = CodeGenOpts.ImplicitMapSyms;
   Options.MCOptions.X86RelaxRelocations = CodeGenOpts.X86RelaxRelocations;
+  Options.MCOptions.X86APXRelaxRelocations = CodeGenOpts.X86APXRelaxRelocations;
   Options.MCOptions.CompressDebugSections =
       CodeGenOpts.getCompressDebugSections();
   if (CodeGenOpts.OutputAsmVariant != 3) // 3 (default): not specified
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 5cd5755e01587..c7bf259a678bd 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -192,6 +192,10 @@ bool ToolChain::useRelaxRelocations() const {
   return ENABLE_X86_RELAX_RELOCATIONS;
 }
 
+bool ToolChain::useAPXRelaxRelocations() const {
+  return ENABLE_X86_APX_RELAX_RELOCATIONS;
+}
+
 bool ToolChain::defaultToIEEELongDouble() const {
   return PPC_LINUX_DEFAULT_IEEELONGDOUBLE && getTriple().isOSLinux();
 }
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f2f5231933c88..b1630dcca7306 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2602,6 +2602,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
   bool Crel = false, ExperimentalCrel = false;
   bool ImplicitMapSyms = false;
   bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
+  bool UseAPXRelaxRelocations =
+      C.getDefaultToolChain().useAPXRelaxRelocations();
   bool UseNoExecStack = false;
   bool Msa = false;
   const char *MipsTargetFeature = nullptr;
@@ -2663,6 +2665,12 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
           checkArg(IsELF, {"yes", "no"});
           continue;
         }
+        if (Equal.first == "-mapx-relax-relocations" ||
+            Equal.first == "--mapx-relax-relocations") {
+          UseAPXRelaxRelocations = Equal.second == "yes";
+          checkArg(IsELF, {"yes", "no"});
+          continue;
+        }
         if (Value == "-msse2avx") {
           CmdArgs.push_back("-msse2avx");
           continue;
@@ -2874,6 +2882,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
     CmdArgs.push_back("-mmsa");
   if (!UseRelaxRelocations)
     CmdArgs.push_back("-mrelax-relocations=no");
+  if (UseAPXRelaxRelocations)
+    CmdArgs.push_back("-mapx-relax-relocations=yes");
   if (UseNoExecStack)
     CmdArgs.push_back("-mnoexecstack");
   if (MipsTargetFeature != nullptr) {
diff --git a/clang/test/Driver/relax.s b/clang/test/Driver/relax.s
index 7b084de7e6be2..d3b58509f57bb 100644
--- a/clang/test/Driver/relax.s
+++ b/clang/test/Driver/relax.s
@@ -4,11 +4,20 @@
 // CHECK: "-cc1as"
 // CHECK: "-mrelax-relocations=no"
 
+// RUN: %clang -### -c --target=x86_64-pc-linux -integrated-as -Wa,--mapx-relax-relocations=yes %s 2>&1 | FileCheck %s --check-prefix=APXREL_OPTION
+
+// APXREL_OPTION: "-cc1as"
+// APXREL_OPTION: "-mapx-relax-relocations=yes"
+
+// RUN: %clang -cc1as -triple x86_64-pc-linux %s -o %t -filetype obj -mapx-relax-relocations=yes
+// RUN: llvm-readobj -r %t | FileCheck --check-prefix=APXREL %s
 // RUN: %clang -cc1as -triple x86_64-pc-linux %s -o %t -filetype obj
-// RUN: llvm-readobj -r %t | FileCheck --check-prefix=REL %s
+// RUN: llvm-readobj -r %t | FileCheck --check-prefix=NOAPXREL %s
 
-// REL: R_X86_64_REX_GOTPCRELX foo
-// REL: R_X86_64_CODE_4_GOTPCRELX foo
+// APXREL: R_X86_64_REX_GOTPCRELX foo
+// APXREL: R_X86_64_CODE_4_GOTPCRELX foo
+// NOAPXREL: R_X86_64_REX_GOTPCRELX foo
+// NOAPXREL: R_X86_64_GOTPCREL foo
 
         movq	foo@GOTPCREL(%rip), %rax
         movq	foo@GOTPCREL(%rip), %r16
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b98fc5ead100f..5654ea91f1349 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -171,6 +171,8 @@ struct AssemblerInvocation {
   LLVM_PREFERRED_TYPE(bool)
   unsigned X86RelaxRelocations : 1;
   LLVM_PREFERRED_TYPE(bool)
+  unsigned X86APXRelaxRelocations : 1;
+  LLVM_PREFERRED_TYPE(bool)
   unsigned X86Sse2Avx : 1;
 
   /// The name of the relocation model to use.
@@ -216,6 +218,7 @@ struct AssemblerInvocation {
     Crel = false;
     ImplicitMapsyms = 0;
     X86RelaxRelocations = 0;
+    X86APXRelaxRelocations = 0;
     X86Sse2Avx = 0;
   }
 
@@ -388,6 +391,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
   Opts.Crel = Args.hasArg(OPT_crel);
   Opts.ImplicitMapsyms = Args.hasArg(OPT_mmapsyms_implicit);
   Opts.X86RelaxRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
+  Opts.X86APXRelaxRelocations = Args.hasArg(OPT_mapx_relax_relocations_yes);
   Opts.X86Sse2Avx = Args.hasArg(OPT_msse2avx);
 
   Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
@@ -449,6 +453,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
   MCOptions.Crel = Opts.Crel;
   MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms;
   MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations;
+  MCOptions.X86APXRelaxRelocations = Opts.X86APXRelaxRelocations;
   MCOptions.X86Sse2Avx = Opts.X86Sse2Avx;
   MCOptions.CompressDebugSections = Opts.CompressDebugSections;
   MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 0c4fd00cab65c..28fdf4f0c8d80 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -912,9 +912,9 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
   case R_X86_64_CODE_4_GOTPC32_TLSDESC:
   case R_X86_64_TLSDESC_CALL:
   case R_X86_64_TLSGD:
-    if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
+    if (rel.expr == R_RELAX_TLS_GD_TO_LE && ctx.arg.relax) {
       relaxTlsGdToLe(loc, rel, val);
-    } else if (rel.expr == R_RELAX_TLS_GD_TO_IE) {
+    } else if (rel.expr == R_RELAX_TLS_GD_TO_IE && ctx.arg.relax) {
       relaxTlsGdToIe(loc, rel, val);
     } else {
       checkInt(ctx, loc, val, 32, rel);
@@ -932,7 +932,7 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
   case R_X86_64_GOTTPOFF:
   case R_X86_64_CODE_4_GOTTPOFF:
   case R_X86_64_CODE_6_GOTTPOFF:
-    if (rel.expr == R_RELAX_TLS_IE_TO_LE) {
+    if (rel.expr == R_RELAX_TLS_IE_TO_LE && ctx.arg.relax) {
       relaxTlsIeToLe(loc, rel, val);
     } else {
       checkInt(ctx, loc, val, 32, rel);
diff --git a/lld/test/ELF/tls-opt.s b/lld/test/ELF/tls-opt.s
index 466dda0ef2e7b..cf8b46e088ddd 100644
--- a/lld/test/ELF/tls-opt.s
+++ b/lld/test/ELF/tls-opt.s
@@ -1,44 +1,84 @@
 // REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -x86-apx-relax-relocations=true
 // RUN: ld.lld %t.o -o %t1
 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
-// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t1 --no-relax
+// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
+// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,NOAPXRELAX %s
 
 // NORELOC:      Relocations [
 // NORELOC-NEXT: ]
 
 // DISASM:      <_start>:
-// DISASM-NEXT:   movq $-8, %rax
-// DISASM-NEXT:   movq $-8, %r15
-// DISASM-NEXT:   leaq -8(%rax), %rax
-// DISASM-NEXT:   leaq -8(%r15), %r15
-// DISASM-NEXT:   addq $-8, %rsp
-// DISASM-NEXT:   addq $-8, %r12
-// DISASM-NEXT:   movq $-4, %rax
-// DISASM-NEXT:   movq $-4, %r15
-// DISASM-NEXT:   leaq -4(%rax), %rax
-// DISASM-NEXT:   leaq -4(%r15), %r15
-// DISASM-NEXT:   addq $-4, %rsp
-// DISASM-NEXT:   addq $-4, %r12
+// APXRELAX-NEXT:   movq $-8, %rax
+// APXRELAX-NEXT:   movq $-8, %r15
+// APXRELAX-NEXT:   leaq -8(%rax), %rax
+// APXRELAX-NEXT:   leaq -8(%r15), %r15
+// APXRELAX-NEXT:   addq $-8, %rsp
+// APXRELAX-NEXT:   addq $-8, %r12
+// APXRELAX-NEXT:   movq $-4, %rax
+// APXRELAX-NEXT:   movq $-4, %r15
+// APXRELAX-NEXT:   leaq -4(%rax), %rax
+// APXRELAX-NEXT:   leaq -4(%r15), %r15
+// APXRELAX-NEXT:   addq $-4, %rsp
+// APXRELAX-NEXT:   addq $-4, %r12
+
+// NOAPXRELAX-NEXT:   movq -12(%rip), %rax
+// NOAPXRELAX-NEXT:   movq -12(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rsp
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r12
+// NOAPXRELAX-NEXT:   movq -8(%rip), %rax
+// NOAPXRELAX-NEXT:   movq -8(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -8(%rip), %rax
+// NOAPXRELAX-NEXT:   addq -8(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -8(%rip), %rsp
+// NOAPXRELAX-NEXT:   addq -8(%rip), %r12
+
 # EGPR
-// DISASM-NEXT:   movq $-8, %r16
-// DISASM-NEXT:   movq $-8, %r20
-// DISASM-NEXT:   movq $-4, %r16
-// DISASM-NEXT:   addq $-8, %r16
-// DISASM-NEXT:   addq $-8, %r28
-// DISASM-NEXT:   addq $-4, %r16
+// APXRELAX-NEXT:   movq $-8, %r16
+// APXRELAX-NEXT:   movq $-8, %r20
+// APXRELAX-NEXT:   movq $-4, %r16
+// APXRELAX-NEXT:   addq $-8, %r16
+// APXRELAX-NEXT:   addq $-8, %r28
+// APXRELAX-NEXT:   addq $-4, %r16
+
+// NOAPXRELAX-NEXT: movq -12(%rip), %r16
+// NOAPXRELAX-NEXT: movq -12(%rip), %r20
+// NOAPXRELAX-NEXT: movq -8(%rip), %r16
+// NOAPXRELAX-NEXT: addq -12(%rip), %r16
+// NOAPXRELAX-NEXT: addq -12(%rip), %r28
+// NOAPXRELAX-NEXT: addq -8(%rip), %r16
+
 # NDD
-// DISASM-NEXT:   addq $-8, %r16, %r16
-// DISASM-NEXT:   addq $-8, %r16, %r20
-// DISASM-NEXT:   addq $-8, %r16, %rax
-// DISASM-NEXT:   addq $-8, %rax, %r16
-// DISASM-NEXT:   addq $-8, %r8, %r16
-// DISASM-NEXT:   addq $-8, %rax, %r12
+// APXRELAX-NEXT:   addq $-8, %r16, %r16
+// APXRELAX-NEXT:   addq $-8, %r16, %r20
+// APXRELAX-NEXT:   addq $-8, %r16, %rax
+// APXRELAX-NEXT:   addq $-8, %rax, %r16
+// APXRELAX-NEXT:   addq $-8, %r8, %r16
+// APXRELAX-NEXT:   addq $-8, %rax, %r12
+
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %r16
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %r20
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %rax
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax, %r16
+// NOAPXRELAX-NEXT:   addq %r8, -12(%rip), %r16
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax, %r12
+
 # NDD + NF
-// DISASM-NEXT:   {nf} addq $-8, %r8, %r16
-// DISASM-NEXT:   {nf} addq $-8, %rax, %r12
+// APXRELAX-NEXT:   {nf} addq $-8, %r8, %r16
+// APXRELAX-NEXT:   {nf} addq $-8, %rax, %r12
+
+// NOAPXRELAX-NEXT:   {nf} addq %r8, -12(%rip), %r16
+// NOAPXRELAX-NEXT:   {nf} addq -12(%rip), %rax, %r12
+
 # NF
-// DISASM-NEXT:   {nf} addq $-8, %r12
+// APXRELAX-NEXT:   {nf} addq $-8, %r12
+// NOAPXRELAX-NEXT:   {nf} addq -12(%rip), %r12
 
 // LD to LE:
 // DISASM-NEXT:   movq %fs:0, %rax
@@ -47,10 +87,15 @@
 // DISASM-NEXT:   leaq -4(%rax), %rcx
 
 // GD to LE:
-// DISASM-NEXT:   movq %fs:0, %rax
-// DISASM-NEXT:   leaq -8(%rax), %rax
-// DISASM-NEXT:   movq %fs:0, %rax
-// DISASM-NEXT:   leaq -4(%rax), %rax
+// APXRELAX-NEXT:   movq %fs:0, %rax
+// APXRELAX-NEXT:   leaq -8(%rax), %rax
+// APXRELAX-NEXT:   movq %fs:0, %rax
+// APXRELAX-NEXT:   leaq -4(%rax), %rax
+
+// NOAPXRELAX-NEXT:   leaq -12(%rip), %rdi
+// NOAPXRELAX-NEXT:   callq 0x20126c
+// NOAPXRELAX-NEXT:   leaq -8(%rip), %rdi
+// NOAPXRELAX-NEXT:   callq 0x20127c
 
 // LD to LE:
 // DISASM:     <_DTPOFF64_1>:
diff --git a/lld/test/ELF/x86-64-gotpc-no-relax-err.s b/lld/test/ELF/x86-64-gotpc-no-relax-err.s
index 8452090e2c35a..c2628404a5516 100644
--- a/lld/test/ELF/x86-64-gotpc-no-relax-err.s
+++ b/lld/test/ELF/x86-64-gotpc-no-relax-err.s
@@ -1,7 +1,10 @@
 # REQUIRES: x86
 # RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o -x86-apx-relax-relocations=true
+# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error: --check-prefixes=CHECK,APXRELAX
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
-# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error: --check-prefixes=CHECK,NOAPXRELAX
 
 ## Test diagnostics for unrelaxed GOTPCRELX overflows. In addition, test that there is no
 ## `>>> defined in` for linker synthesized __stop_* symbols (there is no
@@ -13,9 +16,11 @@
 # CHECK-NEXT: error: {{.*}}:(.text+0x9): relocation R_X86_64_REX_GOTPCRELX out of range: 2147483659 is not in [-2147483648, 2147483647]; references '__stop_data'
 # CHECK-NEXT: >>> defined in <internal>
 # CHECK-EMPTY:
-# CHECK-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_CODE_4_GOTPCRELX out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
+# APXRELAX-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_CODE_4_GOTPCRELX out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
+# NOAPXRELAX-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_GOTPCREL out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
 # CHECK-NEXT: >>> defined in <internal>
 
+
 #--- a.s
   movl __stop_data@GOTPCREL(%rip), %eax  # out of range
   movq __stop_data@GOTPCREL(%rip), %rax  # out of range
diff --git a/lld/test/ELF/x86-64-gotpc-relax-nopic.s b/lld/test/ELF/x86-64-gotpc-relax-nopic.s
index be55c7d7006fe..67a155bfe0d76 100644
--- a/lld/test/ELF/x86-64-gotpc-relax-nopic.s
+++ b/lld/test/ELF/x86-64-gotpc-relax-nopic.s
@@ -1,8 +1,13 @@
 # REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -x86-apx-relax-relocations=true
+# RUN: ld.lld %t.o -o %t1
+# RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s
+# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: ld.lld %t.o -o %t1
 # RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s
-# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefix=DISASM %s
+# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefixes=DISASM,NOAPXRELAX %s
 
 ## There is no relocations.
 # SYMRELOC:      Relocations [
@@ -34,15 +39,25 @@
 # DISASM-NEXT:                 subq  $0x203290, %rbp
 # DISASM-NEXT:                 xorq  $0x203290, %r8
 # DISASM-NEXT:                 testq $0x203290, %r15
-# DISASM-NEXT:   20123f:       adcq  $0x203290, %r16
-# DISASM-NEXT:                 addq  $0x203290, %r17
-# DISASM-NEXT:                 andq  $0x203290, %r18
-# DISASM-NEXT:                 cmpq  $0x203290, %r19
-# DISASM-NEXT:                 orq   $0x203290, %r20
-# DISASM-NEXT:                 sbbq  $0x203290, %r21
-# DISASM-NEXT:                 subq  $0x203290, %r22
-# DISASM-NEXT:                 xorq  $0x203290, %r23
-# DISASM-NEXT:                 testq $0x203290, %r24
+# APXRELAX-NEXT:   20123f:       adcq  $0x203290, %r16
+# APXRELAX-NEXT:                 addq  $0x203290, %r17
+# APXRELAX-NEXT:                 andq  $0x203290, %r18
+# APXRELAX-NEXT:                 cmpq  $0x203290, %r19
+# APXRELAX-NEXT:                 orq   $0x203290, %r20
+# APXRELAX-NEXT:                 sbbq  $0x203290, %r21
+# APXRELAX-NEXT:                 subq  $0x203290, %r22
+# APXRELAX-NEXT:                 xorq  $0x203290, %r23
+# APXRELAX-NEXT:                 testq $0x203290, %r24
+
+# NOAPXRELAX-NEXT:   20123f:       adcq  0x1041(%rip), %r16
+# N...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Apr 22, 2025

@llvm/pr-subscribers-lld

Author: Feng Zou (fzou1)

Changes

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.


Patch is 57.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/136660.diff

37 Files Affected:

  • (modified) clang/CMakeLists.txt (+3)
  • (modified) clang/cmake/caches/Fuchsia-stage2.cmake (+1)
  • (modified) clang/cmake/caches/Fuchsia.cmake (+1)
  • (modified) clang/include/clang/Basic/CodeGenOptions.def (+1)
  • (modified) clang/include/clang/Config/config.h.cmake (+3)
  • (modified) clang/include/clang/Driver/Options.td (+3)
  • (modified) clang/include/clang/Driver/ToolChain.h (+3)
  • (modified) clang/lib/CodeGen/BackendUtil.cpp (+1)
  • (modified) clang/lib/Driver/ToolChain.cpp (+4)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (+10)
  • (modified) clang/test/Driver/relax.s (+12-3)
  • (modified) clang/tools/driver/cc1as_main.cpp (+5)
  • (modified) lld/ELF/Arch/X86_64.cpp (+3-3)
  • (modified) lld/test/ELF/tls-opt.s (+78-33)
  • (modified) lld/test/ELF/x86-64-gotpc-no-relax-err.s (+7-2)
  • (modified) lld/test/ELF/x86-64-gotpc-relax-nopic.s (+25-10)
  • (modified) lld/test/ELF/x86-64-gotpc-relax.s (+64-27)
  • (modified) lld/test/ELF/x86-64-tlsdesc-gd.s (+32-5)
  • (modified) llvm/include/llvm/MC/MCTargetOptions.h (+2)
  • (modified) llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h (+2)
  • (modified) llvm/lib/LTO/LTO.cpp (+1)
  • (modified) llvm/lib/MC/MCTargetOptionsCommandFlags.cpp (+10)
  • (modified) llvm/lib/Target/X86/CMakeLists.txt (+1)
  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h (+22)
  • (modified) llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp (+13-7)
  • (modified) llvm/lib/Target/X86/X86.h (+1)
  • (modified) llvm/lib/Target/X86/X86InstrInfo.cpp (+1-16)
  • (added) llvm/lib/Target/X86/X86SuppressEGPRAndNDDForReloc.cpp (+145)
  • (modified) llvm/lib/Target/X86/X86TargetMachine.cpp (+2)
  • (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (+1)
  • (added) llvm/test/CodeGen/X86/apx/tls-desc.ll (+96)
  • (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (+3)
  • (modified) llvm/test/MC/ELF/relocation-alias.s (+7-1)
  • (modified) llvm/test/MC/X86/elf-reloc-tls.s (+15-1)
  • (modified) llvm/test/MC/X86/gotpcrelx.s (+48-1)
  • (modified) llvm/test/MC/X86/tlsdesc-64.s (+7-1)
  • (modified) llvm/tools/gold/gold-plugin.cpp (+2)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c3f30e2a8e9c0..fa3063d6be9a7 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -219,6 +219,9 @@ set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
     "enable x86 relax relocations by default")
 
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL
+    "Enable x86 APX relax relocations by default")
+
 set(PPC_LINUX_DEFAULT_IEEELONGDOUBLE OFF CACHE BOOL
     "Enable IEEE binary128 as default long double format on PowerPC Linux.")
 
diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake
index 99890b8246ad7..22eef24b611a8 100644
--- a/clang/cmake/caches/Fuchsia-stage2.cmake
+++ b/clang/cmake/caches/Fuchsia-stage2.cmake
@@ -49,6 +49,7 @@ set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL "")
 
 # TODO(#67176): relative-vtables doesn't play well with different default
 # visibilities. Making everything hidden visibility causes other complications
diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake
index 83336589da305..550d94d1ec6a5 100644
--- a/clang/cmake/caches/Fuchsia.cmake
+++ b/clang/cmake/caches/Fuchsia.cmake
@@ -89,6 +89,7 @@ set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "")
 set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
+set(ENABLE_X86_APX_RELAX_RELOCATIONS OFF CACHE BOOL "")
 
 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES ON CACHE BOOL "")
diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def
index c5990fb248689..875facd6cfc63 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -201,6 +201,7 @@ CODEGENOPT(UniqueInternalLinkageNames, 1, 0) ///< Internal Linkage symbols get u
 CODEGENOPT(SplitMachineFunctions, 1, 0) ///< Split machine functions using profile information.
 CODEGENOPT(PPCUseFullRegisterNames, 1, 0) ///< Print full register names in assembly
 CODEGENOPT(X86RelaxRelocations, 1, 1) ///< -Wa,-mrelax-relocations={yes,no}
+CODEGENOPT(X86APXRelaxRelocations, 1, 0) ///< -Wa,-mrelax-relocations={yes,no}
 CODEGENOPT(X86Sse2Avx        , 1, 0)   ///< -Wa,-msse2avx
 
 /// When false, this attempts to generate code as if the result of an
diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake
index 00c352b458c34..db7fc2ba45eaf 100644
--- a/clang/include/clang/Config/config.h.cmake
+++ b/clang/include/clang/Config/config.h.cmake
@@ -72,6 +72,9 @@
 /* enable x86 relax relocations by default */
 #cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS
 
+/* enable x86 APX relax relocations by default */
+#cmakedefine01 ENABLE_X86_APX_RELAX_RELOCATIONS
+
 /* Enable IEEE binary128 as default long double format on PowerPC Linux. */
 #cmakedefine01 PPC_LINUX_DEFAULT_IEEELONGDOUBLE
 
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 919c1c643d080..a3becf76a7671 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -7442,6 +7442,9 @@ def mmapsyms_implicit : Flag<["-"], "mmapsyms=implicit">,
 def mrelax_relocations_no : Flag<["-"], "mrelax-relocations=no">,
     HelpText<"Disable x86 relax relocations">,
     MarshallingInfoNegativeFlag<CodeGenOpts<"X86RelaxRelocations">>;
+def mapx_relax_relocations_yes : Flag<["-"], "mapx-relax-relocations=yes">,
+    HelpText<"Enable x86 APX relax relocations">,
+    MarshallingInfoNegativeFlag<CodeGenOpts<"X86APXRelaxRelocations">>;
 def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
   HelpText<"Save temporary labels in the symbol table. "
            "Note this may change .s semantics and shouldn't generally be used "
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index d0059673d6a67..ef90956e25de0 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -473,6 +473,9 @@ class ToolChain {
   /// Check whether to enable x86 relax relocations by default.
   virtual bool useRelaxRelocations() const;
 
+  /// Check whether to enable x86 APX relax relocations by default.
+  virtual bool useAPXRelaxRelocations() const;
+
   /// Check whether use IEEE binary128 as long double format by default.
   bool defaultToIEEELongDouble() const;
 
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index f7eb853beb23c..72643631f39fc 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -513,6 +513,7 @@ static bool initTargetOptions(const CompilerInstance &CI,
   Options.MCOptions.Crel = CodeGenOpts.Crel;
   Options.MCOptions.ImplicitMapSyms = CodeGenOpts.ImplicitMapSyms;
   Options.MCOptions.X86RelaxRelocations = CodeGenOpts.X86RelaxRelocations;
+  Options.MCOptions.X86APXRelaxRelocations = CodeGenOpts.X86APXRelaxRelocations;
   Options.MCOptions.CompressDebugSections =
       CodeGenOpts.getCompressDebugSections();
   if (CodeGenOpts.OutputAsmVariant != 3) // 3 (default): not specified
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 5cd5755e01587..c7bf259a678bd 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -192,6 +192,10 @@ bool ToolChain::useRelaxRelocations() const {
   return ENABLE_X86_RELAX_RELOCATIONS;
 }
 
+bool ToolChain::useAPXRelaxRelocations() const {
+  return ENABLE_X86_APX_RELAX_RELOCATIONS;
+}
+
 bool ToolChain::defaultToIEEELongDouble() const {
   return PPC_LINUX_DEFAULT_IEEELONGDOUBLE && getTriple().isOSLinux();
 }
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f2f5231933c88..b1630dcca7306 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2602,6 +2602,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
   bool Crel = false, ExperimentalCrel = false;
   bool ImplicitMapSyms = false;
   bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
+  bool UseAPXRelaxRelocations =
+      C.getDefaultToolChain().useAPXRelaxRelocations();
   bool UseNoExecStack = false;
   bool Msa = false;
   const char *MipsTargetFeature = nullptr;
@@ -2663,6 +2665,12 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
           checkArg(IsELF, {"yes", "no"});
           continue;
         }
+        if (Equal.first == "-mapx-relax-relocations" ||
+            Equal.first == "--mapx-relax-relocations") {
+          UseAPXRelaxRelocations = Equal.second == "yes";
+          checkArg(IsELF, {"yes", "no"});
+          continue;
+        }
         if (Value == "-msse2avx") {
           CmdArgs.push_back("-msse2avx");
           continue;
@@ -2874,6 +2882,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
     CmdArgs.push_back("-mmsa");
   if (!UseRelaxRelocations)
     CmdArgs.push_back("-mrelax-relocations=no");
+  if (UseAPXRelaxRelocations)
+    CmdArgs.push_back("-mapx-relax-relocations=yes");
   if (UseNoExecStack)
     CmdArgs.push_back("-mnoexecstack");
   if (MipsTargetFeature != nullptr) {
diff --git a/clang/test/Driver/relax.s b/clang/test/Driver/relax.s
index 7b084de7e6be2..d3b58509f57bb 100644
--- a/clang/test/Driver/relax.s
+++ b/clang/test/Driver/relax.s
@@ -4,11 +4,20 @@
 // CHECK: "-cc1as"
 // CHECK: "-mrelax-relocations=no"
 
+// RUN: %clang -### -c --target=x86_64-pc-linux -integrated-as -Wa,--mapx-relax-relocations=yes %s 2>&1 | FileCheck %s --check-prefix=APXREL_OPTION
+
+// APXREL_OPTION: "-cc1as"
+// APXREL_OPTION: "-mapx-relax-relocations=yes"
+
+// RUN: %clang -cc1as -triple x86_64-pc-linux %s -o %t -filetype obj -mapx-relax-relocations=yes
+// RUN: llvm-readobj -r %t | FileCheck --check-prefix=APXREL %s
 // RUN: %clang -cc1as -triple x86_64-pc-linux %s -o %t -filetype obj
-// RUN: llvm-readobj -r %t | FileCheck --check-prefix=REL %s
+// RUN: llvm-readobj -r %t | FileCheck --check-prefix=NOAPXREL %s
 
-// REL: R_X86_64_REX_GOTPCRELX foo
-// REL: R_X86_64_CODE_4_GOTPCRELX foo
+// APXREL: R_X86_64_REX_GOTPCRELX foo
+// APXREL: R_X86_64_CODE_4_GOTPCRELX foo
+// NOAPXREL: R_X86_64_REX_GOTPCRELX foo
+// NOAPXREL: R_X86_64_GOTPCREL foo
 
         movq	foo@GOTPCREL(%rip), %rax
         movq	foo@GOTPCREL(%rip), %r16
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp
index b98fc5ead100f..5654ea91f1349 100644
--- a/clang/tools/driver/cc1as_main.cpp
+++ b/clang/tools/driver/cc1as_main.cpp
@@ -171,6 +171,8 @@ struct AssemblerInvocation {
   LLVM_PREFERRED_TYPE(bool)
   unsigned X86RelaxRelocations : 1;
   LLVM_PREFERRED_TYPE(bool)
+  unsigned X86APXRelaxRelocations : 1;
+  LLVM_PREFERRED_TYPE(bool)
   unsigned X86Sse2Avx : 1;
 
   /// The name of the relocation model to use.
@@ -216,6 +218,7 @@ struct AssemblerInvocation {
     Crel = false;
     ImplicitMapsyms = 0;
     X86RelaxRelocations = 0;
+    X86APXRelaxRelocations = 0;
     X86Sse2Avx = 0;
   }
 
@@ -388,6 +391,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
   Opts.Crel = Args.hasArg(OPT_crel);
   Opts.ImplicitMapsyms = Args.hasArg(OPT_mmapsyms_implicit);
   Opts.X86RelaxRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
+  Opts.X86APXRelaxRelocations = Args.hasArg(OPT_mapx_relax_relocations_yes);
   Opts.X86Sse2Avx = Args.hasArg(OPT_msse2avx);
 
   Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
@@ -449,6 +453,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
   MCOptions.Crel = Opts.Crel;
   MCOptions.ImplicitMapSyms = Opts.ImplicitMapsyms;
   MCOptions.X86RelaxRelocations = Opts.X86RelaxRelocations;
+  MCOptions.X86APXRelaxRelocations = Opts.X86APXRelaxRelocations;
   MCOptions.X86Sse2Avx = Opts.X86Sse2Avx;
   MCOptions.CompressDebugSections = Opts.CompressDebugSections;
   MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp
index 0c4fd00cab65c..28fdf4f0c8d80 100644
--- a/lld/ELF/Arch/X86_64.cpp
+++ b/lld/ELF/Arch/X86_64.cpp
@@ -912,9 +912,9 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
   case R_X86_64_CODE_4_GOTPC32_TLSDESC:
   case R_X86_64_TLSDESC_CALL:
   case R_X86_64_TLSGD:
-    if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
+    if (rel.expr == R_RELAX_TLS_GD_TO_LE && ctx.arg.relax) {
       relaxTlsGdToLe(loc, rel, val);
-    } else if (rel.expr == R_RELAX_TLS_GD_TO_IE) {
+    } else if (rel.expr == R_RELAX_TLS_GD_TO_IE && ctx.arg.relax) {
       relaxTlsGdToIe(loc, rel, val);
     } else {
       checkInt(ctx, loc, val, 32, rel);
@@ -932,7 +932,7 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
   case R_X86_64_GOTTPOFF:
   case R_X86_64_CODE_4_GOTTPOFF:
   case R_X86_64_CODE_6_GOTTPOFF:
-    if (rel.expr == R_RELAX_TLS_IE_TO_LE) {
+    if (rel.expr == R_RELAX_TLS_IE_TO_LE && ctx.arg.relax) {
       relaxTlsIeToLe(loc, rel, val);
     } else {
       checkInt(ctx, loc, val, 32, rel);
diff --git a/lld/test/ELF/tls-opt.s b/lld/test/ELF/tls-opt.s
index 466dda0ef2e7b..cf8b46e088ddd 100644
--- a/lld/test/ELF/tls-opt.s
+++ b/lld/test/ELF/tls-opt.s
@@ -1,44 +1,84 @@
 // REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -x86-apx-relax-relocations=true
 // RUN: ld.lld %t.o -o %t1
 // RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
-// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: ld.lld %t.o -o %t1 --no-relax
+// RUN: llvm-readobj -r %t1 | FileCheck --check-prefix=NORELOC %s
+// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,NOAPXRELAX %s
 
 // NORELOC:      Relocations [
 // NORELOC-NEXT: ]
 
 // DISASM:      <_start>:
-// DISASM-NEXT:   movq $-8, %rax
-// DISASM-NEXT:   movq $-8, %r15
-// DISASM-NEXT:   leaq -8(%rax), %rax
-// DISASM-NEXT:   leaq -8(%r15), %r15
-// DISASM-NEXT:   addq $-8, %rsp
-// DISASM-NEXT:   addq $-8, %r12
-// DISASM-NEXT:   movq $-4, %rax
-// DISASM-NEXT:   movq $-4, %r15
-// DISASM-NEXT:   leaq -4(%rax), %rax
-// DISASM-NEXT:   leaq -4(%r15), %r15
-// DISASM-NEXT:   addq $-4, %rsp
-// DISASM-NEXT:   addq $-4, %r12
+// APXRELAX-NEXT:   movq $-8, %rax
+// APXRELAX-NEXT:   movq $-8, %r15
+// APXRELAX-NEXT:   leaq -8(%rax), %rax
+// APXRELAX-NEXT:   leaq -8(%r15), %r15
+// APXRELAX-NEXT:   addq $-8, %rsp
+// APXRELAX-NEXT:   addq $-8, %r12
+// APXRELAX-NEXT:   movq $-4, %rax
+// APXRELAX-NEXT:   movq $-4, %r15
+// APXRELAX-NEXT:   leaq -4(%rax), %rax
+// APXRELAX-NEXT:   leaq -4(%r15), %r15
+// APXRELAX-NEXT:   addq $-4, %rsp
+// APXRELAX-NEXT:   addq $-4, %r12
+
+// NOAPXRELAX-NEXT:   movq -12(%rip), %rax
+// NOAPXRELAX-NEXT:   movq -12(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rsp
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r12
+// NOAPXRELAX-NEXT:   movq -8(%rip), %rax
+// NOAPXRELAX-NEXT:   movq -8(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -8(%rip), %rax
+// NOAPXRELAX-NEXT:   addq -8(%rip), %r15
+// NOAPXRELAX-NEXT:   addq -8(%rip), %rsp
+// NOAPXRELAX-NEXT:   addq -8(%rip), %r12
+
 # EGPR
-// DISASM-NEXT:   movq $-8, %r16
-// DISASM-NEXT:   movq $-8, %r20
-// DISASM-NEXT:   movq $-4, %r16
-// DISASM-NEXT:   addq $-8, %r16
-// DISASM-NEXT:   addq $-8, %r28
-// DISASM-NEXT:   addq $-4, %r16
+// APXRELAX-NEXT:   movq $-8, %r16
+// APXRELAX-NEXT:   movq $-8, %r20
+// APXRELAX-NEXT:   movq $-4, %r16
+// APXRELAX-NEXT:   addq $-8, %r16
+// APXRELAX-NEXT:   addq $-8, %r28
+// APXRELAX-NEXT:   addq $-4, %r16
+
+// NOAPXRELAX-NEXT: movq -12(%rip), %r16
+// NOAPXRELAX-NEXT: movq -12(%rip), %r20
+// NOAPXRELAX-NEXT: movq -8(%rip), %r16
+// NOAPXRELAX-NEXT: addq -12(%rip), %r16
+// NOAPXRELAX-NEXT: addq -12(%rip), %r28
+// NOAPXRELAX-NEXT: addq -8(%rip), %r16
+
 # NDD
-// DISASM-NEXT:   addq $-8, %r16, %r16
-// DISASM-NEXT:   addq $-8, %r16, %r20
-// DISASM-NEXT:   addq $-8, %r16, %rax
-// DISASM-NEXT:   addq $-8, %rax, %r16
-// DISASM-NEXT:   addq $-8, %r8, %r16
-// DISASM-NEXT:   addq $-8, %rax, %r12
+// APXRELAX-NEXT:   addq $-8, %r16, %r16
+// APXRELAX-NEXT:   addq $-8, %r16, %r20
+// APXRELAX-NEXT:   addq $-8, %r16, %rax
+// APXRELAX-NEXT:   addq $-8, %rax, %r16
+// APXRELAX-NEXT:   addq $-8, %r8, %r16
+// APXRELAX-NEXT:   addq $-8, %rax, %r12
+
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %r16
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %r20
+// NOAPXRELAX-NEXT:   addq -12(%rip), %r16, %rax
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax, %r16
+// NOAPXRELAX-NEXT:   addq %r8, -12(%rip), %r16
+// NOAPXRELAX-NEXT:   addq -12(%rip), %rax, %r12
+
 # NDD + NF
-// DISASM-NEXT:   {nf} addq $-8, %r8, %r16
-// DISASM-NEXT:   {nf} addq $-8, %rax, %r12
+// APXRELAX-NEXT:   {nf} addq $-8, %r8, %r16
+// APXRELAX-NEXT:   {nf} addq $-8, %rax, %r12
+
+// NOAPXRELAX-NEXT:   {nf} addq %r8, -12(%rip), %r16
+// NOAPXRELAX-NEXT:   {nf} addq -12(%rip), %rax, %r12
+
 # NF
-// DISASM-NEXT:   {nf} addq $-8, %r12
+// APXRELAX-NEXT:   {nf} addq $-8, %r12
+// NOAPXRELAX-NEXT:   {nf} addq -12(%rip), %r12
 
 // LD to LE:
 // DISASM-NEXT:   movq %fs:0, %rax
@@ -47,10 +87,15 @@
 // DISASM-NEXT:   leaq -4(%rax), %rcx
 
 // GD to LE:
-// DISASM-NEXT:   movq %fs:0, %rax
-// DISASM-NEXT:   leaq -8(%rax), %rax
-// DISASM-NEXT:   movq %fs:0, %rax
-// DISASM-NEXT:   leaq -4(%rax), %rax
+// APXRELAX-NEXT:   movq %fs:0, %rax
+// APXRELAX-NEXT:   leaq -8(%rax), %rax
+// APXRELAX-NEXT:   movq %fs:0, %rax
+// APXRELAX-NEXT:   leaq -4(%rax), %rax
+
+// NOAPXRELAX-NEXT:   leaq -12(%rip), %rdi
+// NOAPXRELAX-NEXT:   callq 0x20126c
+// NOAPXRELAX-NEXT:   leaq -8(%rip), %rdi
+// NOAPXRELAX-NEXT:   callq 0x20127c
 
 // LD to LE:
 // DISASM:     <_DTPOFF64_1>:
diff --git a/lld/test/ELF/x86-64-gotpc-no-relax-err.s b/lld/test/ELF/x86-64-gotpc-no-relax-err.s
index 8452090e2c35a..c2628404a5516 100644
--- a/lld/test/ELF/x86-64-gotpc-no-relax-err.s
+++ b/lld/test/ELF/x86-64-gotpc-no-relax-err.s
@@ -1,7 +1,10 @@
 # REQUIRES: x86
 # RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o -x86-apx-relax-relocations=true
+# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error: --check-prefixes=CHECK,APXRELAX
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
-# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+# RUN: not ld.lld --no-relax -T %t/lds %t/a.o -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error: --check-prefixes=CHECK,NOAPXRELAX
 
 ## Test diagnostics for unrelaxed GOTPCRELX overflows. In addition, test that there is no
 ## `>>> defined in` for linker synthesized __stop_* symbols (there is no
@@ -13,9 +16,11 @@
 # CHECK-NEXT: error: {{.*}}:(.text+0x9): relocation R_X86_64_REX_GOTPCRELX out of range: 2147483659 is not in [-2147483648, 2147483647]; references '__stop_data'
 # CHECK-NEXT: >>> defined in <internal>
 # CHECK-EMPTY:
-# CHECK-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_CODE_4_GOTPCRELX out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
+# APXRELAX-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_CODE_4_GOTPCRELX out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
+# NOAPXRELAX-NEXT: error: {{.*}}:(.text+0x11): relocation R_X86_64_GOTPCREL out of range: 2147483651 is not in [-2147483648, 2147483647]; references '__stop_data'
 # CHECK-NEXT: >>> defined in <internal>
 
+
 #--- a.s
   movl __stop_data@GOTPCREL(%rip), %eax  # out of range
   movq __stop_data@GOTPCREL(%rip), %rax  # out of range
diff --git a/lld/test/ELF/x86-64-gotpc-relax-nopic.s b/lld/test/ELF/x86-64-gotpc-relax-nopic.s
index be55c7d7006fe..67a155bfe0d76 100644
--- a/lld/test/ELF/x86-64-gotpc-relax-nopic.s
+++ b/lld/test/ELF/x86-64-gotpc-relax-nopic.s
@@ -1,8 +1,13 @@
 # REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -x86-apx-relax-relocations=true
+# RUN: ld.lld %t.o -o %t1
+# RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s
+# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s
+
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: ld.lld %t.o -o %t1
 # RUN: llvm-readobj --symbols -r %t1 | FileCheck --check-prefix=SYMRELOC %s
-# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefix=DISASM %s
+# RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t1 | FileCheck --check-prefixes=DISASM,NOAPXRELAX %s
 
 ## There is no relocations.
 # SYMRELOC:      Relocations [
@@ -34,15 +39,25 @@
 # DISASM-NEXT:                 subq  $0x203290, %rbp
 # DISASM-NEXT:                 xorq  $0x203290, %r8
 # DISASM-NEXT:                 testq $0x203290, %r15
-# DISASM-NEXT:   20123f:       adcq  $0x203290, %r16
-# DISASM-NEXT:                 addq  $0x203290, %r17
-# DISASM-NEXT:                 andq  $0x203290, %r18
-# DISASM-NEXT:                 cmpq  $0x203290, %r19
-# DISASM-NEXT:                 orq   $0x203290, %r20
-# DISASM-NEXT:                 sbbq  $0x203290, %r21
-# DISASM-NEXT:                 subq  $0x203290, %r22
-# DISASM-NEXT:                 xorq  $0x203290, %r23
-# DISASM-NEXT:                 testq $0x203290, %r24
+# APXRELAX-NEXT:   20123f:       adcq  $0x203290, %r16
+# APXRELAX-NEXT:                 addq  $0x203290, %r17
+# APXRELAX-NEXT:                 andq  $0x203290, %r18
+# APXRELAX-NEXT:                 cmpq  $0x203290, %r19
+# APXRELAX-NEXT:                 orq   $0x203290, %r20
+# APXRELAX-NEXT:                 sbbq  $0x203290, %r21
+# APXRELAX-NEXT:                 subq  $0x203290, %r22
+# APXRELAX-NEXT:                 xorq  $0x203290, %r23
+# APXRELAX-NEXT:                 testq $0x203290, %r24
+
+# NOAPXRELAX-NEXT:   20123f:       adcq  0x1041(%rip), %r16
+# N...
[truncated]

@KanRobert
Copy link
Contributor

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.

Not understand this. IIUC, either we should not emit APX instructions at all, which is controlled by -m[no-]apxf, or we should not relax the all the relocations, which is controlled by -Wl,--no-relax.

@fzou1
Copy link
Contributor Author

fzou1 commented Apr 22, 2025

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.

Not understand this. IIUC, either we should not emit APX instructions at all, which is controlled by -m[no-]apxf, or we should not relax the all the relocations, which is controlled by -Wl,--no-relax.

If the APX relocation types are emitted in MC, they cannot be recognized by old version of linkers. It leads to APX features unavailable on existing Linux OSes with old version of linkers. --no-relax just disables the GOT optimization in linker, and it cannot resolve the link error of unsupported relocation type as mentioned above.

@KanRobert
Copy link
Contributor

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.

Not understand this. IIUC, either we should not emit APX instructions at all, which is controlled by -m[no-]apxf, or we should not relax the all the relocations, which is controlled by -Wl,--no-relax.

If the APX relocation types are emitted in MC, they cannot be recognized by old version of linkers. It leads to APX features unavailable on existing Linux OSes with old version of linkers. --no-relax just disables the GOT optimization in linker, and it cannot resolve the link error of unsupported relocation type as mentioned above.

But if you just old relocations for APX instructions and no-relax is not used. Wouldn't the old linker do the relaxation incorrectly and silently?

@fzou1
Copy link
Contributor Author

fzou1 commented Apr 23, 2025

Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.

Not understand this. IIUC, either we should not emit APX instructions at all, which is controlled by -m[no-]apxf, or we should not relax the all the relocations, which is controlled by -Wl,--no-relax.

If the APX relocation types are emitted in MC, they cannot be recognized by old version of linkers. It leads to APX features unavailable on existing Linux OSes with old version of linkers. --no-relax just disables the GOT optimization in linker, and it cannot resolve the link error of unsupported relocation type as mentioned above.

But if you just old relocations for APX instructions and no-relax is not used. Wouldn't the old linker do the relaxation incorrectly and silently?

No, the old linker will do wrong thing. Here we added a pass to suppress EGPR and NDD/NF instructions for that.

@fzou1
Copy link
Contributor Author

fzou1 commented Apr 25, 2025

Any comments?

// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s

// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: ld.lld %t.o -o %t1 --no-relax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check no-relax?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are instructions with APX EGPR or NDD/NF instructions in the test, and the R_X86_64_GOTTPOFF relocation is emitted. so we add this to suppress link relaxation for TLS relocation in LLD linker. I wonder if we need to emit warning or error in MC for this case (if users write such assembly code).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we didn't suppress link relaxation for non APX instruciton before, right?

@@ -912,9 +912,9 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
case R_X86_64_TLSDESC_CALL:
case R_X86_64_TLSGD:
if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
if (rel.expr == R_RELAX_TLS_GD_TO_LE && ctx.arg.relax) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we need to change it. I assume the problem happens only when using old lld with new compiler. There's nothing to do with the new lld here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the tests or user programs having APX EGPR/NDD/NF pass with "-no-relax" option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to handle this case? The new lld has the ability to hanlde APX relocations. lld still does the ralax with "-no-relax" for the reset 3 relocations before the APX changes, isn't it?

@@ -89,6 +89,7 @@ set(sources
GISel/X86InstructionSelector.cpp
GISel/X86LegalizerInfo.cpp
GISel/X86RegisterBankInfo.cpp
X86SuppressAPXForReloc.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put it in alphabetic order?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

X86EnableAPXForRelocation)
return false;
const X86Subtarget &ST = MF.getSubtarget<X86Subtarget>();
if (!ST.hasEGPR() && !ST.hasNDD() && !ST.hasNF())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why checking hasNF?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are NF instructions for GOT_6_GOTTPOFF.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only ADD64rm_NF_ND use GOT_6_GOTTPOFF. ADD64rm_NF uses REX2 encoding and should no problem if not using EGPR?

@@ -912,9 +912,9 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
case R_X86_64_TLSDESC_CALL:
case R_X86_64_TLSGD:
if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
if (rel.expr == R_RELAX_TLS_GD_TO_LE && ctx.arg.relax) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use --no-relax to suppress TLS relaxation as well as GOTPCREL optimization.

@@ -912,9 +912,9 @@ void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
case R_X86_64_CODE_4_GOTPC32_TLSDESC:
case R_X86_64_TLSDESC_CALL:
case R_X86_64_TLSGD:
if (rel.expr == R_RELAX_TLS_GD_TO_LE) {
if (rel.expr == R_RELAX_TLS_GD_TO_LE && ctx.arg.relax) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the tests or user programs having APX EGPR/NDD/NF pass with "-no-relax" option.

// RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t1 | FileCheck --check-prefixes=DISASM,APXRELAX %s

// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: ld.lld %t.o -o %t1 --no-relax
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are instructions with APX EGPR or NDD/NF instructions in the test, and the R_X86_64_GOTTPOFF relocation is emitted. so we add this to suppress link relaxation for TLS relocation in LLD linker. I wonder if we need to emit warning or error in MC for this case (if users write such assembly code).

case X86::SBB64rm:
case X86::SUB64rm:
case X86::XOR64rm: {
for (auto &MO : MI.operands()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can find the operand with X86::AddrDisp directly.

Comment on lines 141 to 142
case X86::ADD64rm_ND:
case X86::ADD64rm_NF_ND: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to split the EGPR and NDD handling. We don't need to go through a lot of code if EGPR is not enabled.

@KanRobert
Copy link
Contributor

Any comments?

Still not understand the requirement...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/16860

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteAttach.py (1207 of 2152)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteCompletion.py (1208 of 2152)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteFork.py (1209 of 2152)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteForkNonStop.py (1210 of 2152)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteForkResume.py (1211 of 2152)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteExitCode.py (1212 of 2152)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteHostInfo.py (1213 of 2152)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteModuleInfo.py (1214 of 2152)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteAuxvSupport.py (1215 of 2152)
UNRESOLVED: lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py (1216 of 2152)
******************** TEST 'lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/variables -p TestDAP_variables.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision bd6addc032b1ea764494e2de135b5b2c46ee6aca)
  clang revision bd6addc032b1ea764494e2de135b5b2c46ee6aca
  llvm revision bd6addc032b1ea764494e2de135b5b2c46ee6aca
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_darwin_dwarf_missing_obj (TestDAP_variables.TestDAP_variables) (requires one of macosx, darwin, ios, tvos, watchos, bridgeos, iphonesimulator, watchsimulator, appletvsimulator) 
UNSUPPORTED: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_darwin_dwarf_missing_obj_with_symbol_ondemand_enabled (TestDAP_variables.TestDAP_variables) (requires one of macosx, darwin, ios, tvos, watchos, bridgeos, iphonesimulator, watchsimulator, appletvsimulator) 
========= DEBUG ADAPTER PROTOCOL LOGS =========
1745927725.626282930 --> (stdin/stdout) {"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}
1745927725.628283978 <-- (stdin/stdout) {"body":{"$__lldb_version":"lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision bd6addc032b1ea764494e2de135b5b2c46ee6aca)\n  clang revision bd6addc032b1ea764494e2de135b5b2c46ee6aca\n  llvm revision bd6addc032b1ea764494e2de135b5b2c46ee6aca","completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"default":false,"filter":"cpp_catch","label":"C++ Catch"},{"default":false,"filter":"cpp_throw","label":"C++ Throw"},{"default":false,"filter":"objc_catch","label":"Objective-C Catch"},{"default":false,"filter":"objc_throw","label":"Objective-C Throw"}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionInfoRequest":true,"supportsExceptionOptions":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsRestartRequest":true,"supportsSetVariable":true,"supportsStepInTargetsRequest":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true},"command":"initialize","request_seq":1,"seq":0,"success":true,"type":"response"}
1745927725.628560066 --> (stdin/stdout) {"command":"launch","type":"request","arguments":{"program":"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/variables/TestDAP_variables.test_indexedVariables/a.out","initCommands":["settings clear -all","settings set symbols.enable-external-lookup false","settings set target.inherit-tcc true","settings set target.disable-aslr false","settings set target.detach-on-error false","settings set target.auto-apply-fixits false","settings set plugin.process.gdb-remote.packet-timeout 60","settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"","settings set use-color false","settings set show-statusline false"],"disableASLR":false,"enableAutoVariableSummaries":false,"enableSyntheticChildDebugging":false,"displayExtendedBacktrace":false},"seq":2}
1745927725.628784657 <-- (stdin/stdout) {"body":{"category":"console","output":"Running initCommands:\n"},"event":"output","seq":0,"type":"event"}
1745927725.628806591 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings clear -all\n"},"event":"output","seq":0,"type":"event"}
1745927725.628818274 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set symbols.enable-external-lookup false\n"},"event":"output","seq":0,"type":"event"}
1745927725.628827572 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.inherit-tcc true\n"},"event":"output","seq":0,"type":"event"}
1745927725.628836155 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.disable-aslr false\n"},"event":"output","seq":0,"type":"event"}
1745927725.628844023 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.detach-on-error false\n"},"event":"output","seq":0,"type":"event"}
1745927725.628851891 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set target.auto-apply-fixits false\n"},"event":"output","seq":0,"type":"event"}
1745927725.628859997 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set plugin.process.gdb-remote.packet-timeout 60\n"},"event":"output","seq":0,"type":"event"}
1745927725.628880978 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"\n"},"event":"output","seq":0,"type":"event"}
1745927725.628891230 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set use-color false\n"},"event":"output","seq":0,"type":"event"}
1745927725.628899097 <-- (stdin/stdout) {"body":{"category":"console","output":"(lldb) settings set show-statusline false\n"},"event":"output","seq":0,"type":"event"}
1745927725.704024553 <-- (stdin/stdout) {"command":"launch","request_seq":2,"seq":0,"success":true,"type":"response"}
1745927725.704060555 <-- (stdin/stdout) {"body":{"module":{"addressRange":"281472828997632","id":"46771E9A-54FF-F825-3560-60BC1C8B4A44-C1108BF8","name":"ld-linux-aarch64.so.1","path":"/usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":0,"type":"event"}
1745927725.704087496 <-- (stdin/stdout) {"body":{"isLocalProcess":true,"name":"/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/variables/TestDAP_variables.test_indexedVariables/a.out","startMethod":"launch","systemProcessId":3999788},"event":"process","seq":0,"type":"event"}
1745927725.704097986 <-- (stdin/stdout) {"event":"initialized","seq":0,"type":"event"}
1745927725.704105139 <-- (stdin/stdout) {"body":{"module":{"addressRange":"281472829231104","id":"4A8F74F7-08C0-3C8C-B911-12040A09904C-51F3DA5C","name":"[vdso]","path":"[vdso]","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":0,"type":"event"}

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/155/builds/8781

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stdout):
--
# RUN: at line 1
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe -mattr=+egpr C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe' -mattr=+egpr 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll' -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o'
# RUN: at line 2
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-objdump.exe --no-print-imm-hex -dr C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll --check-prefix=TLSDESC
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-objdump.exe' --no-print-imm-hex -dr 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe' 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll' --check-prefix=TLSDESC
# RUN: at line 3
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe -filetype=obj -triple=x86_64 - -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o
# executed command: echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe' -filetype=obj -triple=x86_64 - -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o'
# RUN: at line 5
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe -mattr=+egpr C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll -mtriple=x86_64 -filetype=obj -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o -x86-enable-apx-for-relocation=true
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe' -mattr=+egpr 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll' -mtriple=x86_64 -filetype=obj -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o' -x86-enable-apx-for-relocation=true
# RUN: at line 6
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-objdump.exe --no-print-imm-hex -dr C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll --check-prefix=GOTTPOFF_APXRELAX
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-objdump.exe' --no-print-imm-hex -dr 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe' 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\CodeGen\X86\apx\tls.ll' --check-prefix=GOTTPOFF_APXRELAX
# RUN: at line 7
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe -filetype=obj -triple=x86_64 - -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o
# executed command: echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llvm-mc.exe' -filetype=obj -triple=x86_64 - -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o'
# RUN: at line 8
ld.lld  C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.so
# executed command: ld.lld 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.o' 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp1.o' -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\CodeGen\X86\apx\Output\tls.ll.tmp.so'
# .---command stderr------------
# | 'ld.lld': command not found
# `-----------------------------
# error: command failed with exit status: 127

--

********************


fzou1 added a commit to fzou1/llvm-project that referenced this pull request Apr 29, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/12600

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
ld.lld: error: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o:(function f2: .text+0x43): unknown relocation (44) against symbol j

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-x86_64-debian-fast running on gribozavr4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/56/builds/24594

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mattr=+egpr /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mattr=+egpr /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-objdump --no-print-imm-hex -dr /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-objdump --no-print-imm-hex -dr /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mattr=+egpr /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llc -mattr=+egpr /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-objdump --no-print-imm-hex -dr /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-objdump --no-print-imm-hex -dr /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/FileCheck /b/1/clang-x86_64-debian-fast/llvm.src/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /b/1/clang-x86_64-debian-fast/llvm.obj/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/b/1/clang-x86_64-debian-fast/llvm.obj/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-debian-cpp20 running on clang-debian-cpp20 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/108/builds/12234

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llc -mattr=+egpr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llc -mattr=+egpr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-objdump --no-print-imm-hex -dr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-objdump --no-print-imm-hex -dr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llc -mattr=+egpr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llc -mattr=+egpr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-objdump --no-print-imm-hex -dr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/FileCheck /vol/worker/clang-debian-cpp20/clang-debian-cpp20/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-objdump --no-print-imm-hex -dr /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/vol/worker/clang-debian-cpp20/clang-debian-cpp20/build/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/9322

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mattr=+egpr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mattr=+egpr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --no-print-imm-hex -dr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --no-print-imm-hex -dr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mattr=+egpr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mattr=+egpr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --no-print-imm-hex -dr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-objdump --no-print-imm-hex -dr /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/9147

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
ld.lld: error: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o:(function f2: .text+0x43): unknown relocation (44) against symbol j

--

********************

Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llc -mattr=+egpr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
ld.lld: error: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o:(function f2: .text+0x43): unknown relocation (44) against symbol j

--

********************


fzou1 added a commit that referenced this pull request Apr 29, 2025
The test introduced in #136660, may be failed as ld.lld command not
found.
@fzou1
Copy link
Contributor Author

fzou1 commented Apr 29, 2025

Sorry. The test failure had been fixed in #137794.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-global-isel running on linaro-clang-aarch64-global-isel while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/125/builds/7219

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
ld.lld: error: /home/tcwg-buildbot/worker/clang-aarch64-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o:(function f2: .text+0x43): unknown relocation (44) against symbol j

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3275

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -mattr=+egpr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -mattr=+egpr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-objdump --no-print-imm-hex -dr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-objdump --no-print-imm-hex -dr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -mattr=+egpr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -mattr=+egpr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-objdump --no-print-imm-hex -dr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-objdump --no-print-imm-hex -dr /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-armv7-global-isel running on linaro-clang-armv7-global-isel while building llvm at step 7 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/39/builds/5888

Here is the relevant piece of the build log for the reference
Step 7 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llc -mattr=+egpr /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
ld.lld: error: /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o:(function f2: .text+0x43): unknown relocation (44) against symbol j

--

********************


@MaskRay
Copy link
Member

MaskRay commented Apr 29, 2025

We should avoid introducing a new cmake config for changes like this. You could utilize clang config file to specify the option.

lld change should have been separated

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2810

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/90/95' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-10012-90-95.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=95 GTEST_SHARD_INDEX=90 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 29, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/4349

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented May 3, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux-multistage running on systemz-1 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/98/builds/1349

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage1/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************

Step 11 (ninja check 2) failure: stage 2 checked (failure)
******************** TEST 'LLVM :: CodeGen/X86/apx/tls.ll' FAILED ********************
Exit Code: 127

Command Output (stderr):
--
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o # RUN: at line 1
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 --relocation-model=pic -enable-tlsdesc -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC # RUN: at line 2
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=TLSDESC
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 3
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true # RUN: at line 5
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llc -mattr=+egpr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll -mtriple=x86_64 -filetype=obj -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o -x86-enable-apx-for-relocation=true
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX # RUN: at line 6
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-objdump --no-print-imm-hex -dr /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/llvm/test/CodeGen/X86/apx/tls.ll --check-prefix=GOTTPOFF_APXRELAX
echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4' | /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o # RUN: at line 7
+ echo '.tbss; .globl b,c,d,e,f,g,h,i,j; b: .zero 4;c: .zero 4;d: .zero 4;e: .zero 4;f: .zero 4;g: .zero 4;h: .zero 4;i: .zero 4;j: .zero 4'
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/bin/llvm-mc -filetype=obj -triple=x86_64 - -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o
ld.lld  /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.so # RUN: at line 8
+ ld.lld /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp1.o -o /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.tmp.so
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/stage2/test/CodeGen/X86/apx/Output/tls.ll.script: line 7: ld.lld: command not found

--

********************


IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The test introduced in llvm#136660, may be failed as ld.lld command not
found.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The test introduced in llvm#136660, may be failed as ld.lld command not
found.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
The test introduced in llvm#136660, may be failed as ld.lld command not
found.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
The test introduced in llvm#136660, may be failed as ld.lld command not
found.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
Suppress EGPR/NDD instructions for relocations to avoid APX relocation
types emitted. This is to keep backward compatibility with old version
of linkers without APX support. The use case is to try APX features with
LLVM + old built-in linker on RHEL9 OS which is expected to be EOL in
2032.
If there are APX relocation types, the old version of linkers would
raise "unsupported relocation type" error. Example:
```
$ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
$ ld got.o -o got.exe
ld: got.o: unsupported relocation type 0x2b
...

$ cat got.s
...
movq foo@GOTPCREL(%rip), %r16

$ llvm-objdump -dr got.o
...
1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
```
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
The test introduced in llvm#136660, may be failed as ld.lld command not
found.
@fzou1
Copy link
Contributor Author

fzou1 commented May 13, 2025

We should avoid introducing a new cmake config for changes like this. You could utilize clang config file to specify the option.

lld change should have been separated

Sorry for late reply. The related cmake and LLD changes were reverted. Only a backend pass and option were added to suppress APX features for relocation. Thanks.

fzou1 added a commit to fzou1/llvm-project that referenced this pull request May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 clang:codegen IR generation bugs: mangling, exceptions, etc. clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category lld:ELF lld LTO Link time optimization (regular/full LTO or ThinLTO) mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants