Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rnk
Copy link
Collaborator

@rnk rnk commented Sep 9, 2025

Clang and other frontends generally need the LLVM data layout string in
order to generate LLVM IR modules for LLVM. MLIR clients often need it
as well, since MLIR users often lower to LLVM IR.

Before this change, the LLVM datalayout string was computed in the
LLVM${TGT}CodeGen library in the relevant TargetMachine subclass.
However, none of the logic for computing the data layout string requires
any details of code generation. Clients who want to avoid duplicating
this information were forced to link in LLVMCodeGen and all registered
targets, leading to bloated binaries. This happened in PR #145899,
which measurably increased binary size for some of our users.

By moving this information to the TargetParser library, we
can delete the duplicate datalayout strings in Clang, and retain the
ability to generate IR for unregistered targets.

This is intended to be a very mechanical LLVM-only change, but there is an immediately obvious follow-up to clang, which will be prepared separately.

The vast majority of data layouts are computable with two inputs: the triple and the "ABI name". There is only one exception, NVPTX, which has a cl::opt to enable short device pointers. I invented a "shortptr" ABI name to pass this option through the target independent interface. Everything else fits. Mips is a bit awkward because it uses a special MipsABIInfo abstraction, which includes members with codegen-like concepts like ABI physical registers that can't live in TargetParser. I think the string logic of looking for "n32" "n64" etc is reasonable to duplicate. We have plenty of other minor duplication to preserve layering.

rnk added 3 commits September 8, 2025 22:21
Clang and other frontends generally need the LLVM data layout string in
order to generate LLVM IR modules for LLVM. MLIR clients often need it
as well, since MLIR users often lower to LLVM IR.

Before this change, the LLVM datalayout string was computed in the
LLVM${TGT}CodeGen library in the relevant TargetMachine subclass.
However, none of the logic for computing the data layout string requires
any details of code generation. Clients who want to avoid duplicating
this information were forced to link in LLVMCodeGen and all registered
targets, leading to bloated binaries.

By moving this information to the DataLayout class in the IR file, we
can delete the duplicate datalayout strings in Clang, and retain the
ability to generate IR for unregistered targets.
@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2025

@llvm/pr-subscribers-backend-systemz
@llvm/pr-subscribers-backend-hexagon
@llvm/pr-subscribers-backend-m68k
@llvm/pr-subscribers-backend-mips
@llvm/pr-subscribers-backend-nvptx

@llvm/pr-subscribers-backend-arm

Author: Reid Kleckner (rnk)

Changes

Clang and other frontends generally need the LLVM data layout string in
order to generate LLVM IR modules for LLVM. MLIR clients often need it
as well, since MLIR users often lower to LLVM IR.

Before this change, the LLVM datalayout string was computed in the
LLVM${TGT}CodeGen library in the relevant TargetMachine subclass.
However, none of the logic for computing the data layout string requires
any details of code generation. Clients who want to avoid duplicating
this information were forced to link in LLVMCodeGen and all registered
targets, leading to bloated binaries. This happened in PR #145899,
which measurably increased binary size for some of our users.

By moving this information to the DataLayout class in the IR file, we
can delete the duplicate datalayout strings in Clang, and retain the
ability to generate IR for unregistered targets.

This is intended to be a very mechanical LLVM-only change, but there is an immediately obvious follow-up to clang, which will be prepared separately.

The vast majority of data layouts are computable with two inputs: the triple and the "ABI name". There is only one exception, NVPTX, which has a cl::opt to enable short device pointers. I invented a "shortptr" ABI name to pass this option through the target independent interface. Everything else fits. Mips is a bit awkward because it uses a special MipsABIInfo abstraction, which includes members with codegen-like concepts like ABI physical registers that can't live in TargetParser. I think the string logic of looking for "n32" "n64" etc is reasonable to duplicate. We have plenty of other minor duplication to preserve layering.


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

38 Files Affected:

  • (modified) llvm/benchmarks/RuntimeLibcalls.cpp (+1-4)
  • (modified) llvm/include/llvm/IR/DataLayout.h (-2)
  • (modified) llvm/include/llvm/TargetParser/Triple.h (+4)
  • (modified) llvm/lib/IR/DataLayout.cpp (-12)
  • (modified) llvm/lib/Target/AArch64/AArch64TargetMachine.cpp (+4-26)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (+1-20)
  • (modified) llvm/lib/Target/ARC/ARCTargetMachine.cpp (+3-6)
  • (modified) llvm/lib/Target/ARM/ARMTargetMachine.cpp (+8-63)
  • (modified) llvm/lib/Target/ARM/ARMTargetMachine.h (+1-2)
  • (modified) llvm/lib/Target/AVR/AVRTargetMachine.cpp (+2-5)
  • (modified) llvm/lib/Target/BPF/BPFTargetMachine.cpp (+1-9)
  • (modified) llvm/lib/Target/CSKY/CSKYTargetMachine.cpp (+1-16)
  • (modified) llvm/lib/Target/DirectX/DirectXTargetMachine.cpp (+2-5)
  • (modified) llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp (+4-8)
  • (modified) llvm/lib/Target/Lanai/LanaiTargetMachine.cpp (+1-12)
  • (modified) llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp (+1-8)
  • (modified) llvm/lib/Target/M68k/M68kTargetMachine.cpp (+2-31)
  • (modified) llvm/lib/Target/MSP430/MSP430TargetMachine.cpp (+2-7)
  • (modified) llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (+2-2)
  • (modified) llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.cpp (+5-6)
  • (modified) llvm/lib/Target/Mips/MCTargetDesc/MipsABIInfo.h (+1-2)
  • (modified) llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp (+1-1)
  • (modified) llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp (+1-1)
  • (modified) llvm/lib/Target/Mips/MipsTargetMachine.cpp (+5-41)
  • (modified) llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp (+9-27)
  • (modified) llvm/lib/Target/PowerPC/PPCTargetMachine.cpp (+2-54)
  • (modified) llvm/lib/Target/RISCV/RISCVTargetMachine.cpp (+4-36)
  • (modified) llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp (+1-22)
  • (modified) llvm/lib/Target/Sparc/SparcTargetMachine.cpp (+1-34)
  • (modified) llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp (+1-42)
  • (modified) llvm/lib/Target/VE/VETargetMachine.cpp (+1-33)
  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (+3-13)
  • (modified) llvm/lib/Target/X86/X86TargetMachine.cpp (+1-48)
  • (modified) llvm/lib/Target/Xtensa/XtensaTargetMachine.cpp (+1-9)
  • (modified) llvm/lib/TargetParser/CMakeLists.txt (+1)
  • (added) llvm/lib/TargetParser/TargetDataLayout.cpp (+631)
  • (modified) llvm/unittests/IR/DataLayoutTest.cpp (-7)
  • (modified) llvm/unittests/TargetParser/TripleTest.cpp (+9)
diff --git a/llvm/benchmarks/RuntimeLibcalls.cpp b/llvm/benchmarks/RuntimeLibcalls.cpp
index 9ac77bb74a3df..707bdca7ceab7 100644
--- a/llvm/benchmarks/RuntimeLibcalls.cpp
+++ b/llvm/benchmarks/RuntimeLibcalls.cpp
@@ -54,10 +54,7 @@ static std::vector<std::string> readSymbolsFromFile(StringRef InputFile) {
   // Hackily figure out if there's a prefix on the symbol names - llvm-nm
   // appears to not have a flag to skip this.
   llvm::Triple HostTriple(LLVM_HOST_TRIPLE);
-  std::string DummyDatalayout = "e";
-  DummyDatalayout += DataLayout::getManglingComponent(HostTriple);
-
-  DataLayout DL(DummyDatalayout);
+  DataLayout DL(HostTriple.computeDataLayout());
   char GlobalPrefix = DL.getGlobalPrefix();
 
   std::vector<std::string> Lines;
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index 2acae246c0b1e..5653ee7b6837d 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -303,8 +303,6 @@ class DataLayout {
     llvm_unreachable("invalid mangling mode");
   }
 
-  LLVM_ABI static const char *getManglingComponent(const Triple &T);
-
   /// Returns true if the specified type fits in a native integer type
   /// supported by the CPU.
   ///
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 8e12c6852075d..5a462ceafb639 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -1327,6 +1327,10 @@ class Triple {
                                            const VersionTuple &Version);
 
   LLVM_ABI ExceptionHandling getDefaultExceptionHandling() const;
+
+  /// Compute the LLVM IR data layout string based on the triple. Some targets
+  /// customize the layout based on the ABIName string.
+  LLVM_ABI std::string computeDataLayout(StringRef ABIName = "") const;
 };
 
 } // End llvm namespace
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index ed629d4e5ea22..77f9b997a2ebf 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -172,18 +172,6 @@ struct LessPointerAddrSpace {
 };
 } // namespace
 
-const char *DataLayout::getManglingComponent(const Triple &T) {
-  if (T.isOSBinFormatGOFF())
-    return "-m:l";
-  if (T.isOSBinFormatMachO())
-    return "-m:o";
-  if ((T.isOSWindows() || T.isUEFI()) && T.isOSBinFormatCOFF())
-    return T.getArch() == Triple::x86 ? "-m:x" : "-m:w";
-  if (T.isOSBinFormatXCOFF())
-    return "-m:a";
-  return "-m:e";
-}
-
 // Default primitive type specifications.
 // NOTE: These arrays must be sorted by type bit width.
 constexpr DataLayout::PrimitiveSpec DefaultIntSpecs[] = {
diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
index 4650b2d0c8151..dde1d88403bfe 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -295,27 +295,6 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
   return std::make_unique<AArch64_ELFTargetObjectFile>();
 }
 
-// Helper function to build a DataLayout string
-static std::string computeDataLayout(const Triple &TT,
-                                     const MCTargetOptions &Options,
-                                     bool LittleEndian) {
-  if (TT.isOSBinFormatMachO()) {
-    if (TT.getArch() == Triple::aarch64_32)
-      return "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-"
-             "n32:64-S128-Fn32";
-    return "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-"
-           "Fn32";
-  }
-  if (TT.isOSBinFormatCOFF())
-    return "e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-i64:64-i128:"
-           "128-n32:64-S128-Fn32";
-  std::string Endian = LittleEndian ? "e" : "E";
-  std::string Ptr32 = TT.getEnvironment() == Triple::GNUILP32 ? "-p:32:32" : "";
-  return Endian + "-m:e" + Ptr32 +
-         "-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-"
-         "n32:64-S128-Fn32";
-}
-
 static StringRef computeDefaultCPU(const Triple &TT, StringRef CPU) {
   if (CPU.empty() && TT.isArm64e())
     return "apple-a12";
@@ -368,11 +347,10 @@ AArch64TargetMachine::AArch64TargetMachine(const Target &T, const Triple &TT,
                                            std::optional<CodeModel::Model> CM,
                                            CodeGenOptLevel OL, bool JIT,
                                            bool LittleEndian)
-    : CodeGenTargetMachineImpl(
-          T, computeDataLayout(TT, Options.MCOptions, LittleEndian), TT,
-          computeDefaultCPU(TT, CPU), FS, Options,
-          getEffectiveRelocModel(TT, RM),
-          getEffectiveAArch64CodeModel(TT, CM, JIT), OL),
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT,
+                               computeDefaultCPU(TT, CPU), FS, Options,
+                               getEffectiveRelocModel(TT, RM),
+                               getEffectiveAArch64CodeModel(TT, CM, JIT), OL),
       TLOF(createTLOF(getTargetTriple())), isLittle(LittleEndian),
       UseNewSMEABILowering(EnableNewSMEABILowering) {
   initAsmInfo();
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 9afe7590fe4ef..92a587b5771b6 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -720,25 +720,6 @@ static MachineSchedRegistry GCNILPSchedRegistry(
     "Run GCN iterative scheduler for ILP scheduling (experimental)",
     createIterativeILPMachineScheduler);
 
-static StringRef computeDataLayout(const Triple &TT) {
-  if (TT.getArch() == Triple::r600) {
-    // 32-bit pointers.
-    return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128"
-           "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1";
-  }
-
-  // 32-bit private, local, and region pointers. 64-bit global, constant and
-  // flat. 160-bit non-integral fat buffer pointers that include a 128-bit
-  // buffer descriptor and a 32-bit offset, which are indexed by 32-bit values
-  // (address space 7), and 128-bit non-integral buffer resourcees (address
-  // space 8) which cannot be non-trivilally accessed by LLVM memory operations
-  // like getelementptr.
-  return "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32"
-         "-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-"
-         "v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-"
-         "v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9";
-}
-
 LLVM_READNONE
 static StringRef getGPUOrDefault(const Triple &TT, StringRef GPU) {
   if (!GPU.empty())
@@ -764,7 +745,7 @@ AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, const Triple &TT,
                                          std::optional<CodeModel::Model> CM,
                                          CodeGenOptLevel OptLevel)
     : CodeGenTargetMachineImpl(
-          T, computeDataLayout(TT), TT, getGPUOrDefault(TT, CPU), FS, Options,
+          T, TT.computeDataLayout(), TT, getGPUOrDefault(TT, CPU), FS, Options,
           getEffectiveRelocModel(RM),
           getEffectiveCodeModel(CM, CodeModel::Small), OptLevel),
       TLOF(createTLOF(getTargetTriple())) {
diff --git a/llvm/lib/Target/ARC/ARCTargetMachine.cpp b/llvm/lib/Target/ARC/ARCTargetMachine.cpp
index 370336394ba7f..8e1944062a2c3 100644
--- a/llvm/lib/Target/ARC/ARCTargetMachine.cpp
+++ b/llvm/lib/Target/ARC/ARCTargetMachine.cpp
@@ -33,12 +33,9 @@ ARCTargetMachine::ARCTargetMachine(const Target &T, const Triple &TT,
                                    std::optional<Reloc::Model> RM,
                                    std::optional<CodeModel::Model> CM,
                                    CodeGenOptLevel OL, bool JIT)
-    : CodeGenTargetMachineImpl(
-          T,
-          "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-"
-          "f32:32:32-i64:32-f64:32-a:0:32-n32",
-          TT, CPU, FS, Options, getRelocModel(RM),
-          getEffectiveCodeModel(CM, CodeModel::Small), OL),
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
+                               getRelocModel(RM),
+                               getEffectiveCodeModel(CM, CodeModel::Small), OL),
       TLOF(std::make_unique<TargetLoweringObjectFileELF>()),
       Subtarget(TT, std::string(CPU), std::string(FS), *this) {
   initAsmInfo();
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
index fedf9e2cf34b1..346776e0c4b25 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp
@@ -121,62 +121,6 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
   return std::make_unique<ARMElfTargetObjectFile>();
 }
 
-static std::string computeDataLayout(const Triple &TT,
-                                     const TargetOptions &Options,
-                                     bool isLittle) {
-  auto ABI = ARM::computeTargetABI(TT, Options.MCOptions.ABIName);
-  std::string Ret;
-
-  if (isLittle)
-    // Little endian.
-    Ret += "e";
-  else
-    // Big endian.
-    Ret += "E";
-
-  Ret += DataLayout::getManglingComponent(TT);
-
-  // Pointers are 32 bits and aligned to 32 bits.
-  Ret += "-p:32:32";
-
-  // Function pointers are aligned to 8 bits (because the LSB stores the
-  // ARM/Thumb state).
-  Ret += "-Fi8";
-
-  // ABIs other than APCS have 64 bit integers with natural alignment.
-  if (ABI != ARM::ARM_ABI_APCS)
-    Ret += "-i64:64";
-
-  // We have 64 bits floats. The APCS ABI requires them to be aligned to 32
-  // bits, others to 64 bits. We always try to align to 64 bits.
-  if (ABI == ARM::ARM_ABI_APCS)
-    Ret += "-f64:32:64";
-
-  // We have 128 and 64 bit vectors. The APCS ABI aligns them to 32 bits, others
-  // to 64. We always ty to give them natural alignment.
-  if (ABI == ARM::ARM_ABI_APCS)
-    Ret += "-v64:32:64-v128:32:128";
-  else if (ABI != ARM::ARM_ABI_AAPCS16)
-    Ret += "-v128:64:128";
-
-  // Try to align aggregates to 32 bits (the default is 64 bits, which has no
-  // particular hardware support on 32-bit ARM).
-  Ret += "-a:0:32";
-
-  // Integer registers are 32 bits.
-  Ret += "-n32";
-
-  // The stack is 64 bit aligned on AAPCS and 32 bit aligned everywhere else.
-  if (ABI == ARM::ARM_ABI_AAPCS16)
-    Ret += "-S128";
-  else if (ABI == ARM::ARM_ABI_AAPCS)
-    Ret += "-S64";
-  else
-    Ret += "-S32";
-
-  return Ret;
-}
-
 static Reloc::Model getEffectiveRelocModel(const Triple &TT,
                                            std::optional<Reloc::Model> RM) {
   if (!RM)
@@ -201,12 +145,13 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
                                            const TargetOptions &Options,
                                            std::optional<Reloc::Model> RM,
                                            std::optional<CodeModel::Model> CM,
-                                           CodeGenOptLevel OL, bool isLittle)
-    : CodeGenTargetMachineImpl(T, computeDataLayout(TT, Options, isLittle), TT,
-                               CPU, FS, Options, getEffectiveRelocModel(TT, RM),
-                               getEffectiveCodeModel(CM, CodeModel::Small), OL),
+                                           CodeGenOptLevel OL)
+    : CodeGenTargetMachineImpl(
+          T, TT.computeDataLayout(Options.MCOptions.ABIName), TT, CPU, FS,
+          Options, getEffectiveRelocModel(TT, RM),
+          getEffectiveCodeModel(CM, CodeModel::Small), OL),
       TargetABI(ARM::computeTargetABI(TT, Options.MCOptions.ABIName)),
-      TLOF(createTLOF(getTargetTriple())), isLittle(isLittle) {
+      TLOF(createTLOF(getTargetTriple())), isLittle(TT.isLittleEndian()) {
 
   // Default to triple-appropriate float ABI
   if (Options.FloatABIType == FloatABI::Default) {
@@ -334,7 +279,7 @@ ARMLETargetMachine::ARMLETargetMachine(const Target &T, const Triple &TT,
                                        std::optional<Reloc::Model> RM,
                                        std::optional<CodeModel::Model> CM,
                                        CodeGenOptLevel OL, bool JIT)
-    : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
+    : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
 
 ARMBETargetMachine::ARMBETargetMachine(const Target &T, const Triple &TT,
                                        StringRef CPU, StringRef FS,
@@ -342,7 +287,7 @@ ARMBETargetMachine::ARMBETargetMachine(const Target &T, const Triple &TT,
                                        std::optional<Reloc::Model> RM,
                                        std::optional<CodeModel::Model> CM,
                                        CodeGenOptLevel OL, bool JIT)
-    : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
+    : ARMBaseTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL) {}
 
 namespace {
 
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.h b/llvm/lib/Target/ARM/ARMTargetMachine.h
index 1d73af1da6d02..c417c4c8bae65 100644
--- a/llvm/lib/Target/ARM/ARMTargetMachine.h
+++ b/llvm/lib/Target/ARM/ARMTargetMachine.h
@@ -42,8 +42,7 @@ class ARMBaseTargetMachine : public CodeGenTargetMachineImpl {
   ARMBaseTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
                        StringRef FS, const TargetOptions &Options,
                        std::optional<Reloc::Model> RM,
-                       std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
-                       bool isLittle);
+                       std::optional<CodeModel::Model> CM, CodeGenOptLevel OL);
   ~ARMBaseTargetMachine() override;
 
   const ARMSubtarget *getSubtargetImpl(const Function &F) const override;
diff --git a/llvm/lib/Target/AVR/AVRTargetMachine.cpp b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
index fbd148478c894..f001d7974669a 100644
--- a/llvm/lib/Target/AVR/AVRTargetMachine.cpp
+++ b/llvm/lib/Target/AVR/AVRTargetMachine.cpp
@@ -28,9 +28,6 @@
 
 namespace llvm {
 
-static const char *AVRDataLayout =
-    "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8:16-a:8";
-
 /// Processes a CPU name.
 static StringRef getCPU(StringRef CPU) {
   if (CPU.empty() || CPU == "generic") {
@@ -50,8 +47,8 @@ AVRTargetMachine::AVRTargetMachine(const Target &T, const Triple &TT,
                                    std::optional<Reloc::Model> RM,
                                    std::optional<CodeModel::Model> CM,
                                    CodeGenOptLevel OL, bool JIT)
-    : CodeGenTargetMachineImpl(T, AVRDataLayout, TT, getCPU(CPU), FS, Options,
-                               getEffectiveRelocModel(RM),
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, getCPU(CPU), FS,
+                               Options, getEffectiveRelocModel(RM),
                                getEffectiveCodeModel(CM, CodeModel::Small), OL),
       SubTarget(TT, std::string(getCPU(CPU)), std::string(FS), *this) {
   this->TLOF = std::make_unique<AVRTargetObjectFile>();
diff --git a/llvm/lib/Target/BPF/BPFTargetMachine.cpp b/llvm/lib/Target/BPF/BPFTargetMachine.cpp
index 527a480354571..10b758647c735 100644
--- a/llvm/lib/Target/BPF/BPFTargetMachine.cpp
+++ b/llvm/lib/Target/BPF/BPFTargetMachine.cpp
@@ -59,14 +59,6 @@ extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeBPFTarget() {
   initializeBPFMIPreEmitCheckingPass(PR);
 }
 
-// DataLayout: little or big endian
-static std::string computeDataLayout(const Triple &TT) {
-  if (TT.getArch() == Triple::bpfeb)
-    return "E-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
-  else
-    return "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128";
-}
-
 static Reloc::Model getEffectiveRelocModel(std::optional<Reloc::Model> RM) {
   return RM.value_or(Reloc::PIC_);
 }
@@ -77,7 +69,7 @@ BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT,
                                    std::optional<Reloc::Model> RM,
                                    std::optional<CodeModel::Model> CM,
                                    CodeGenOptLevel OL, bool JIT)
-    : CodeGenTargetMachineImpl(T, computeDataLayout(TT), TT, CPU, FS, Options,
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
                                getEffectiveRelocModel(RM),
                                getEffectiveCodeModel(CM, CodeModel::Small), OL),
       TLOF(std::make_unique<TargetLoweringObjectFileELF>()),
diff --git a/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp b/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp
index ae6ef89fdcd07..d0058b9af14be 100644
--- a/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp
+++ b/llvm/lib/Target/CSKY/CSKYTargetMachine.cpp
@@ -33,28 +33,13 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTarget() {
   initializeCSKYDAGToDAGISelLegacyPass(*Registry);
 }
 
-static std::string computeDataLayout(const Triple &TT) {
-  std::string Ret;
-
-  // Only support little endian for now.
-  // TODO: Add support for big endian.
-  Ret += "e";
-
-  // CSKY is always 32-bit target with the CSKYv2 ABI as prefer now.
-  // It's a 4-byte aligned stack with ELF mangling only.
-  Ret += "-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32"
-         "-v128:32:32-a:0:32-Fi32-n32";
-
-  return Ret;
-}
-
 CSKYTargetMachine::CSKYTargetMachine(const Target &T, const Triple &TT,
                                      StringRef CPU, StringRef FS,
                                      const TargetOptions &Options,
                                      std::optional<Reloc::Model> RM,
                                      std::optional<CodeModel::Model> CM,
                                      CodeGenOptLevel OL, bool JIT)
-    : CodeGenTargetMachineImpl(T, computeDataLayout(TT), TT, CPU, FS, Options,
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
                                RM.value_or(Reloc::Static),
                                getEffectiveCodeModel(CM, CodeModel::Small), OL),
       TLOF(std::make_unique<CSKYELFTargetObjectFile>()) {
diff --git a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
index f5d5a73c926e9..bcf84403b2c0d 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -134,11 +134,8 @@ DirectXTargetMachine::DirectXTargetMachine(const Target &T, const Triple &TT,
                                            std::optional<Reloc::Model> RM,
                                            std::optional<CodeModel::Model> CM,
                                            CodeGenOptLevel OL, bool JIT)
-    : CodeGenTargetMachineImpl(
-          T,
-          "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-"
-          "f32:32-f64:64-n8:16:32:64",
-          TT, CPU, FS, Options, Reloc::Static, CodeModel::Small, OL),
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
+                               Reloc::Static, CodeModel::Small, OL),
       TLOF(std::make_unique<DXILTargetObjectFile>()),
       Subtarget(std::make_unique<DirectXSubtarget>(TT, CPU, FS, *this)) {
   initAsmInfo();
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index 66508fd767793..0afa04ab57e81 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -231,14 +231,10 @@ HexagonTargetMachine::HexagonTargetMachine(const Target &T, const Triple &TT,
     // Specify the vector alignment explicitly. For v512x1, the calculated
     // alignment would be 512*alignment(i1), which is 512 bytes, instead of
     // the required minimum of 64 bytes.
-    : CodeGenTargetMachineImpl(
-          T,
-          "e-m:e-p:32:32:32-a:0-n16:32-"
-          "i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-"
-          "v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048",
-          TT, CPU, FS, Options, getEffectiveRelocModel(RM),
-          getEffectiveCodeModel(CM, CodeModel::Small),
-          (HexagonNoOpt ? CodeGenOptLevel::None : OL)),
+    : CodeGenTargetMachineImpl(T, TT.computeDataLayout(), TT, CPU, FS, Options,
+                               getEffectiveRelocModel(RM),
+                               getEffectiveCodeModel(CM, CodeModel::Small),
+                  ...
[truncated]

Copy link

github-actions bot commented Sep 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@@ -59,6 +59,12 @@ static cl::opt<bool> DisableRequireStructuredCFG(
"unexpected regressions happen."),
cl::init(false), cl::Hidden);

static cl::opt<bool> UseShortPointersOpt(
Copy link
Contributor

Choose a reason for hiding this comment

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

This definitely should not be configurable by cl::opt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, but is that a blocking concern? I assume this is load bearing. It has tons of tests. As covered in the commit message, I modeled this as an ABI name string (which wasn't used for anything before) and moved on.

Copy link
Contributor

Choose a reason for hiding this comment

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

If this an ABI name string now, it should be passed via the dedicated --target-abi option. Not a blocker to me (not saying for @arsenm), but a FIXME would be nice.

Comment on lines 112 to 121
// Only support little endian for now.
// TODO: Add support for big endian.
Ret += "e";

// CSKY is always 32-bit target with the CSKYv2 ABI as prefer now.
// It's a 4-byte aligned stack with ELF mangling only.
Ret += "-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32"
"-v128:32:32-a:0:32-Fi32-n32";

return Ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

Directly return the full string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, done.

enum class MipsABI { Unknown, O32, N32, N64 };
}

// FIXME: This duplicates MipsABIInfo::computeTargetABI, but duplicating this is
Copy link
Contributor

Choose a reason for hiding this comment

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

I just ran into issues from this. MipsABIInfo is irredeemably broken. You should not be able to change the pointer size with a side flag. It should not be possible for Triple's getArchPointerBitWidth to be wrong

Copy link
Contributor

@s-barannikov s-barannikov Sep 9, 2025

Choose a reason for hiding this comment

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

It should not be possible for Triple's getArchPointerBitWidth to be wrong

Or we should delete this method. Pointers in different address spaces can have different sizes, and should be queried via DataLayout. There are only two uses of this method in the codebase (not counting transitive uses and uses in tests). One in Flang/tools/TargetSetup.h, the other in JITLink.h.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's transitively used in a lot more places. The platform pointer size is still a relevant property disconnected from any type. i.e., checking a type sized pointer is not always an option

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe those can be replaced with Triple.isArch64Bit() etc (I managed to do this locally).
Speaking of JITLink, it should really use the "pointer" size from parsed DWARF CIE in most places.

In any case, this is not related to this PR, but is an idea for a future change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Without looking at the specifics of these use cases, this would risk being incompatible with architectures that use more interesting pointer encodings than "machine word", such as CHERI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this Mips N32/N64 stuff is just old. If someone was adding this today, we'd model these things as "environments" in the triple, but at the time, it was inflexible and less extensible. The whole "triple" (how many components does it have now?) concept is not very principled.

To me, this is a lesser design flaw than --nvptx-use-short-ptrs, that's pretty crazy.

@rupprecht rupprecht requested a review from MaskRay September 9, 2025 13:55
@rengolin rengolin requested a review from rolfmorel September 9, 2025 14:17
return Ret;
}

// Helper function to build a DataLayout string
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Helper function to build a DataLayout string

Comment on lines +526 to +528
std::string Triple::computeDataLayout(StringRef ABIName) const {
switch (getArch()) {
case Triple::arm:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This may create extra friction for downstream custom backends, which now have another file to patch (to add their triple here). It's probably fine -- the patch would be tiny, and this would be worth the benefit it brings -- but I feel like it's still worth calling out. Is there any way to decouple it?

This is already the status quo (e.g. Triple.cpp has several cases like this), so it's not anything that needs to be solved in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does, it makes that use case slightly worse. I think @jyknight advocated for us leaning into target registration, and having a lighter weight ${TGT}TargetInfo library with these details. That would make things more pluggable. I'm compromising that goal for now to recover some short term MLIR client binary size savings and eliminate duplication with Clang.

It occurs to me that any downstream target will today need a clang local patch to add their data layout there, so this is net-zero for local modifications, even if it creates friction now.

@rengolin
Copy link
Member

rengolin commented Sep 9, 2025

Adding @rolfmorel as this may change our usage for the data layout construction in MLIR from target machine.

Ret += getManglingComponent(TT);

// Special features for z/OS.
if (TT.isOSzOS()) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to remove the isArch64Bit check? It's currently always true, but I guess this was added as preparation for when we may add support for 32-bit z/OS in the future ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arsenm asked me to remove all uses of isArch64Bit and replace them with direct architecture checks. I've done the same thing in all other functions (see the x86 one), but there was no analogue for systemz, since we don't have 32-bit z/OS support. I think we can remove this dead code for now. This will be the first and most obvious thing that needs to be addressed in any future 32-bit z/OS port. Also, this talk about 32-bit Linux support (yes, a different OS) comes to mind:
https://www.webpronews.com/linux-kernel-eyes-phasing-out-32-bit-support-for-security-gains/

Are folks really planning to add 32-bit z/OS support in the near future?

Copy link
Member

Choose a reason for hiding this comment

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

Not in the near future, but potentially at some point. (As opposed to Linux, 32-bit z/OS is unlikely to go away any time soon.) I guess it's OK to remove this for now then. @redstar FYI ...

@rolfmorel
Copy link
Contributor

Great!

Though to check: this enables us to obtain the right data layout string (and in turn the DataLayout struct) from a triple. So w.r.t. #145899, this means that on the MLIR side we do not have to go through TargetMachine. It doesn't help with regard to the triples needing to be registered by the backends, right?

If so, on the MLIR side, I don't think this enables us to get rid of all the AllTargets... CMake targets in

AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
AllTargetsInfos

and the request for backends to register their triples:
void initializeBackendsOnce() {
static const auto initOnce = [] {
// Ensure that the targets, that LLVM has been configured to support,
// are loaded into the TargetRegistry.
llvm::InitializeAllTargets();
llvm::InitializeAllTargetMCs();
return true;
}();
(void)initOnce; // Dummy usage.
}

Also on the MLIR side, we now have https://github.com/llvm/llvm-project/pull/154938/files#diff-14efa88fcf2e1013f43154bb29e5f9e75d1b0e544ecebadaf2806a04729ec23aR47-R64, i.e. obtaining the right / default feature flags from a target triple & CPU string. It seems unavoidable that this goes through TargetMachine. Though here too, this information can/should be independent of codegen. It is probably harder to break this information out of the backends.

Does anybody have any suggestions for minimizing the dependencies for

  1. checking that a triple str & cpu str & features str combination is valid?
  2. obtain the corresponding data layout?
  3. minimize dependencies in case we are interested in obtaining info through the MCSubtargetInfo interface for target specified as a triple & cpu str & features str?

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

LGTM. I think that moving DataLayout computation to TargetParser is a big improvement, and am willing to take it even with some rough edges.

@nikic
Copy link
Contributor

nikic commented Sep 11, 2025

@rolfmorel The information about cpus and target features for a triple is also part of TargetParser -- but the interface to access that information is pretty terrible right now (basically each target has its own bespoke APIs, there is no common way to query this across targets).

@rnk
Copy link
Collaborator Author

rnk commented Sep 11, 2025

I suppose I have to take the point that this isn't going to serve MLIR's needs entirely. In order to that, I think we need to move the information MLIR needs from LLVM${TGT}CodeGen to LLVM${TGT}Info (llvm/lib/${TGT}/TargetInfo) or LLVM${TGT}Desc (llvm/lib/Target/${TGT}/MCTargetDesc).

My change is actually not really a step in that direction. The main benefit of having the data layout always available in TargetParser for all known LLVM targets is that it reduces code duplication with frontends like clang (I can't remember if Rust also duplicates the data layouts) without complicating their test suites by requiring target registration.

It's hard for me to say how much of the information that MLIR needs should be hidden behind target registration or simply always available. There's a tradeoff between simplicity, abstraction, and extensibility to make on that question.

@rnk
Copy link
Collaborator Author

rnk commented Sep 11, 2025

SPIRV tests appear to be broken at head based on my local testing results, so I will push through the failed github checks.

@rnk rnk merged commit f3efbce into llvm:main Sep 11, 2025
10 of 11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 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 4 "build stage 1".

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

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja' (failure)
...
[5702/6512] Creating library symlink lib/libLLVMDWARFLinkerClassic.so
[5703/6512] Linking CXX shared library lib/libLLVMDWARFLinkerParallel.so.22.0git
[5704/6512] Creating library symlink lib/libLLVMDWARFLinkerParallel.so
[5705/6512] Linking CXX shared library lib/libLLVMSelectionDAG.so.22.0git
[5706/6512] Creating library symlink lib/libLLVMSelectionDAG.so
[5707/6512] Linking CXX shared library lib/libLLVMSparcCodeGen.so.22.0git
[5708/6512] Creating library symlink lib/libLLVMSparcCodeGen.so
[5709/6512] Linking CXX shared library lib/libLLVMVECodeGen.so.22.0git
[5710/6512] Creating library symlink lib/libLLVMVECodeGen.so
[5711/6512] Linking CXX shared library lib/libLLVMMSP430CodeGen.so.22.0git
FAILED: lib/libLLVMMSP430CodeGen.so.22.0git 
: && /usr/lib64/ccache/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMMSP430CodeGen.so.22.0git -o lib/libLLVMMSP430CodeGen.so.22.0git lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430BranchSelector.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelDAGToDAG.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430InstrInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430FrameLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MachineFunctionInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430RegisterInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430SelectionDAGInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430Subtarget.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430AsmPrinter.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MCInstLower.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib:"  lib/libLLVMAsmPrinter.so.22.0git  lib/libLLVMMSP430Desc.so.22.0git  lib/libLLVMMSP430Info.so.22.0git  lib/libLLVMSelectionDAG.so.22.0git  lib/libLLVMCodeGen.so.22.0git  lib/libLLVMCodeGenTypes.so.22.0git  lib/libLLVMTarget.so.22.0git  lib/libLLVMMC.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib && :
lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o: In function `llvm::RegisterTargetMachine<llvm::MSP430TargetMachine>::Allocator(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool)':
MSP430TargetMachine.cpp:(.text._ZN4llvm21RegisterTargetMachineINS_19MSP430TargetMachineEE9AllocatorERKNS_6TargetERKNS_6TripleENS_9StringRefES9_RKNS_13TargetOptionsESt8optionalINS_5Reloc5ModelEESD_INS_9CodeModel5ModelEENS_15CodeGenOptLevelEb[_ZN4llvm21RegisterTargetMachineINS_19MSP430TargetMachineEE9AllocatorERKNS_6TargetERKNS_6TripleENS_9StringRefES9_RKNS_13TargetOptionsESt8optionalINS_5Reloc5ModelEESD_INS_9CodeModel5ModelEENS_15CodeGenOptLevelEb]+0xa0): undefined reference to `llvm::Triple::computeDataLayout[abi:cxx11](llvm::StringRef) const'
lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o: In function `llvm::MSP430TargetMachine::MSP430TargetMachine(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool)':
MSP430TargetMachine.cpp:(.text._ZN4llvm19MSP430TargetMachineC2ERKNS_6TargetERKNS_6TripleENS_9StringRefES7_RKNS_13TargetOptionsESt8optionalINS_5Reloc5ModelEESB_INS_9CodeModel5ModelEENS_15CodeGenOptLevelEb+0x88): undefined reference to `llvm::Triple::computeDataLayout[abi:cxx11](llvm::StringRef) const'
collect2: error: ld returned 1 exit status
[5712/6512] Linking CXX shared library lib/libLLVMAVRCodeGen.so.22.0git
[5713/6512] Linking CXX shared library lib/libLLVMLanaiCodeGen.so.22.0git
[5714/6512] Linking CXX shared library lib/libLLVMXCoreCodeGen.so.22.0git
[5715/6512] Linking CXX shared library lib/libLLVMLoongArchCodeGen.so.22.0git
[5716/6512] Linking CXX shared library lib/libLLVMSystemZCodeGen.so.22.0git
[5717/6512] Linking CXX shared library lib/libLLVMWebAssemblyCodeGen.so.22.0git
[5718/6512] Linking CXX shared library lib/libLLVMGlobalISel.so.22.0git
[5719/6512] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGDebugInfo.cpp.o
[5720/6512] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVInstrInfo.cpp.o
[5721/6512] Building CXX object tools/clang/tools/extra/clang-tidy/modernize/CMakeFiles/obj.clangTidyModernizeModule.dir/LoopConvertUtils.cpp.o
[5722/6512] Building AMDGPUGenRegisterInfo.inc...
[5723/6512] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/Interp.cpp.o
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.cpp:9:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h: In instantiation of ‘bool clang::interp::BitCastPrim(clang::interp::InterpState&, clang::interp::CodePtr, bool, uint32_t, const llvm::fltSemantics*) [with clang::interp::PrimType Name = (clang::interp::PrimType)13; T = clang::interp::Pointer; uint32_t = unsigned int]’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/lib/AST/Opcodes.inc:2959:47:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h:3568:60: warning: parameter ‘TargetIsUCharOrByte’ set but not used [-Wunused-but-set-parameter]
 inline bool BitCastPrim(InterpState &S, CodePtr OpPC, bool TargetIsUCharOrByte,
                                                       ~~~~~^~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h: In instantiation of ‘bool clang::interp::CastFloatingIntegral(clang::interp::InterpState&, clang::interp::CodePtr, uint32_t) [with clang::interp::PrimType Name = (clang::interp::PrimType)10; T = clang::interp::Boolean; uint32_t = unsigned int]’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/lib/AST/Opcodes.inc:7431:49:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h:2556:51: warning: parameter ‘OpPC’ set but not used [-Wunused-but-set-parameter]
 bool CastFloatingIntegral(InterpState &S, CodePtr OpPC, uint32_t FPOI) {
                                           ~~~~~~~~^~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h:2556:66: warning: parameter ‘FPOI’ set but not used [-Wunused-but-set-parameter]
 bool CastFloatingIntegral(InterpState &S, CodePtr OpPC, uint32_t FPOI) {
                                                         ~~~~~~~~~^~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h: In instantiation of ‘bool clang::interp::Divc(clang::interp::InterpState&, clang::interp::CodePtr) [with clang::interp::PrimType Name = (clang::interp::PrimType)12; T = clang::interp::Floating]’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/tools/clang/lib/AST/Opcodes.inc:11579:30:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h:524:42: warning: parameter ‘OpPC’ set but not used [-Wunused-but-set-parameter]
 inline bool Divc(InterpState &S, CodePtr OpPC) {
                                  ~~~~~~~~^~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/clang/lib/AST/ByteCode/Interp.h: In instantiation of ‘bool clang::interp::Neg(clang::interp::InterpState&, clang::interp::CodePtr) [with clang::interp::PrimType Name = (clang::interp::PrimType)12; T = clang::interp::Floating]’:

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 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/15937

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[310/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaDefaultCapture.cpp.o
[311/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CXXMethodDecl.cpp.o
[312/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/DeclRefExpr.cpp.o
[313/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/QualTypeNamesTest.cpp.o
[314/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp.o
[315/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp.o
[316/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RewriterTest.cpp.o
[317/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/DependencyScanning/DependencyScannerTest.cpp.o
[318/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp.o
[319/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o
FAILED: tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/Tooling -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o -MF tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o.d -o tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/AST/ASTImporterTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/unittests/AST/ASTImporterTest.cpp
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[320/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTestDeclVisitor.cpp.o
[321/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/ReplacementsYamlTest.cpp.o
[322/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/MemberPointerTypeLoc.cpp.o
[323/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/NestedNameSpecifiers.cpp.o
[324/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/ParenExpr.cpp.o
[325/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/TemplateArgumentLocTraverser.cpp.o
[326/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/TraversalScope.cpp.o
[327/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTestTypeLocVisitor.cpp.o
[328/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RefactoringActionRulesTest.cpp.o
[329/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/MutationsTest.cpp.o
[330/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/SynthesisTest.cpp.o
[331/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/Attr.cpp.o
[332/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrder.cpp.o
[333/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/TreeTestBase.cpp.o
[334/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/InitListExprPostOrderNoQueue.cpp.o
[335/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RangeSelectorTest.cpp.o
[336/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/ToolingTest.cpp.o
[337/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RefactoringCallbacksTest.cpp.o
[338/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/SourceCodeBuildersTest.cpp.o
[339/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RefactoringTest.cpp.o
[340/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersNodeTest.cpp.o
[341/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/StencilTest.cpp.o
[342/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTestPostOrderVisitor.cpp.o
[343/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/Syntax/BuildTreeTest.cpp.o
[344/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/SourceCodeTest.cpp.o
[345/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersNarrowingTest.cpp.o
[346/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCompoundAssignOperator.cpp.o
[347/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksBinaryOperator.cpp.o
[348/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksUnaryOperator.cpp.o
[349/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksLeaf.cpp.o
[350/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/RecursiveASTVisitorTests/CallbacksCallExpr.cpp.o
[351/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/Tooling/TransformerTest.cpp.o
[352/1186] Building CXX object tools/clang/unittests/CMakeFiles/AllClangUnitTests.dir/ASTMatchers/ASTMatchersTraversalTest.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 11, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
416.063 [2243/192/4216] Creating library symlink lib/libLLVMInterpreter.so
416.071 [2242/192/4217] Creating library symlink lib/libLLVMAVRCodeGen.so
416.077 [2241/192/4218] Linking CXX shared library lib/libLLVMDWARFLinkerClassic.so.22.0git
416.080 [2240/192/4219] Creating library symlink lib/libLLVMDWARFLinkerParallel.so
416.096 [2239/192/4220] Linking CXX shared library lib/libLLVMLanaiCodeGen.so.22.0git
416.102 [2238/192/4221] Creating library symlink lib/libLLVMDWARFLinkerClassic.so
416.116 [2237/192/4222] Creating library symlink lib/libLLVMLanaiCodeGen.so
416.122 [2236/192/4223] Linking CXX shared library lib/libLLVMLoongArchCodeGen.so.22.0git
416.158 [2235/192/4224] Creating library symlink lib/libLLVMLoongArchCodeGen.so
416.266 [2234/192/4225] Linking CXX shared library lib/libLLVMMSP430CodeGen.so.22.0git
FAILED: lib/libLLVMMSP430CodeGen.so.22.0git 
: && /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections  -Xlinker --dependency-file=lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/link.d -shared -Wl,-soname,libLLVMMSP430CodeGen.so.22.0git -o lib/libLLVMMSP430CodeGen.so.22.0git lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430BranchSelector.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelDAGToDAG.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430InstrInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430FrameLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MachineFunctionInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430RegisterInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430SelectionDAGInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430Subtarget.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430AsmPrinter.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MCInstLower.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib:"  lib/libLLVMAsmPrinter.so.22.0git  lib/libLLVMMSP430Desc.so.22.0git  lib/libLLVMMSP430Info.so.22.0git  lib/libLLVMSelectionDAG.so.22.0git  lib/libLLVMCodeGen.so.22.0git  lib/libLLVMCodeGenTypes.so.22.0git  lib/libLLVMTarget.so.22.0git  lib/libLLVMMC.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && :
ld.lld: error: undefined symbol: llvm::Triple::computeDataLayout[abi:cxx11](llvm::StringRef) const
>>> referenced by MSP430TargetMachine.cpp
>>>               lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o:(llvm::MSP430TargetMachine::MSP430TargetMachine(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
416.289 [2234/191/4226] Linking CXX shared library lib/libLLVMSparcCodeGen.so.22.0git
416.328 [2234/190/4227] Linking CXX shared library lib/libLLVMMipsCodeGen.so.22.0git
416.372 [2234/189/4228] Linking CXX shared library lib/libLLVMPowerPCCodeGen.so.22.0git
416.376 [2234/188/4229] Linking CXX shared library lib/libLLVMSystemZCodeGen.so.22.0git
416.382 [2234/187/4230] Linking CXX shared library lib/libLLVMSPIRVCodeGen.so.22.0git
416.934 [2234/186/4231] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
417.127 [2234/185/4232] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaNVPTX.cpp.o
417.473 [2234/184/4233] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/ABIInfoImpl.cpp.o
417.986 [2234/183/4234] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
418.053 [2234/182/4235] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVISelLowering.cpp.o
418.100 [2234/181/4236] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
418.263 [2234/180/4237] Building CXX object tools/clang/lib/CrossTU/CMakeFiles/obj.clangCrossTU.dir/CrossTranslationUnit.cpp.o
418.372 [2234/179/4238] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaMIPS.cpp.o
418.429 [2234/178/4239] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/JumpDiagnostics.cpp.o
418.849 [2234/177/4240] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAccess.cpp.o
419.411 [2234/176/4241] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/ByteCodeEmitter.cpp.o
420.146 [2234/175/4242] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSystemZ.cpp.o
420.333 [2234/174/4243] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Type.cpp.o
420.598 [2234/173/4244] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
421.965 [2234/172/4245] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGAtomic.cpp.o
422.119 [2234/171/4246] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/MicrosoftMangle.cpp.o
422.391 [2234/170/4247] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSPIRV.cpp.o
422.464 [2234/169/4248] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o
422.556 [2234/168/4249] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaPPC.cpp.o
422.790 [2234/167/4250] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenCL.cpp.o
423.184 [2234/166/4251] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCXXScopeSpec.cpp.o
424.770 [2234/165/4252] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaWasm.cpp.o
424.774 [2234/164/4253] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/StmtPrinter.cpp.o
424.806 [2234/163/4254] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
424.847 [2234/162/4255] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGLoopInfo.cpp.o
424.988 [2234/161/4256] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSwift.cpp.o
425.501 [2234/160/4257] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/JSONNodeDumper.cpp.o
426.503 [2234/159/4258] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenACCClause.cpp.o

@mshockwave
Copy link
Member

LLVM Buildbot has detected a new failure on builder clang-ppc64le-rhel running on ppc64le-clang-rhel-test while building llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference

Step 5 (build-unified-tree) failure: build (failure)
...
416.063 [2243/192/4216] Creating library symlink lib/libLLVMInterpreter.so
416.071 [2242/192/4217] Creating library symlink lib/libLLVMAVRCodeGen.so
416.077 [2241/192/4218] Linking CXX shared library lib/libLLVMDWARFLinkerClassic.so.22.0git
416.080 [2240/192/4219] Creating library symlink lib/libLLVMDWARFLinkerParallel.so
416.096 [2239/192/4220] Linking CXX shared library lib/libLLVMLanaiCodeGen.so.22.0git
416.102 [2238/192/4221] Creating library symlink lib/libLLVMDWARFLinkerClassic.so
416.116 [2237/192/4222] Creating library symlink lib/libLLVMLanaiCodeGen.so
416.122 [2236/192/4223] Linking CXX shared library lib/libLLVMLoongArchCodeGen.so.22.0git
416.158 [2235/192/4224] Creating library symlink lib/libLLVMLoongArchCodeGen.so
416.266 [2234/192/4225] Linking CXX shared library lib/libLLVMMSP430CodeGen.so.22.0git
FAILED: lib/libLLVMMSP430CodeGen.so.22.0git 
: && /home/buildbots/llvm-external-buildbots/clang.19.1.7/bin/clang++ --gcc-toolchain=/gcc-toolchain/usr -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -Wl,--color-diagnostics   -Wl,--gc-sections  -Xlinker --dependency-file=lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/link.d -shared -Wl,-soname,libLLVMMSP430CodeGen.so.22.0git -o lib/libLLVMMSP430CodeGen.so.22.0git lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430BranchSelector.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelDAGToDAG.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430ISelLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430InstrInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430FrameLowering.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MachineFunctionInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430RegisterInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430SelectionDAGInfo.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430Subtarget.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430AsmPrinter.cpp.o lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430MCInstLower.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib:"  lib/libLLVMAsmPrinter.so.22.0git  lib/libLLVMMSP430Desc.so.22.0git  lib/libLLVMMSP430Info.so.22.0git  lib/libLLVMSelectionDAG.so.22.0git  lib/libLLVMCodeGen.so.22.0git  lib/libLLVMCodeGenTypes.so.22.0git  lib/libLLVMTarget.so.22.0git  lib/libLLVMMC.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-rhel-test/clang-ppc64le-rhel/build/lib && :
ld.lld: error: undefined symbol: llvm::Triple::computeDataLayout[abi:cxx11](llvm::StringRef) const
>>> referenced by MSP430TargetMachine.cpp
>>>               lib/Target/MSP430/CMakeFiles/LLVMMSP430CodeGen.dir/MSP430TargetMachine.cpp.o:(llvm::MSP430TargetMachine::MSP430TargetMachine(llvm::Target const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, llvm::TargetOptions const&, std::optional<llvm::Reloc::Model>, std::optional<llvm::CodeModel::Model>, llvm::CodeGenOptLevel, bool))
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
416.289 [2234/191/4226] Linking CXX shared library lib/libLLVMSparcCodeGen.so.22.0git
416.328 [2234/190/4227] Linking CXX shared library lib/libLLVMMipsCodeGen.so.22.0git
416.372 [2234/189/4228] Linking CXX shared library lib/libLLVMPowerPCCodeGen.so.22.0git
416.376 [2234/188/4229] Linking CXX shared library lib/libLLVMSystemZCodeGen.so.22.0git
416.382 [2234/187/4230] Linking CXX shared library lib/libLLVMSPIRVCodeGen.so.22.0git
416.934 [2234/186/4231] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
417.127 [2234/185/4232] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaNVPTX.cpp.o
417.473 [2234/184/4233] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/ABIInfoImpl.cpp.o
417.986 [2234/183/4234] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
418.053 [2234/182/4235] Building CXX object lib/Target/RISCV/CMakeFiles/LLVMRISCVCodeGen.dir/RISCVISelLowering.cpp.o
418.100 [2234/181/4236] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
418.263 [2234/180/4237] Building CXX object tools/clang/lib/CrossTU/CMakeFiles/obj.clangCrossTU.dir/CrossTranslationUnit.cpp.o
418.372 [2234/179/4238] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaMIPS.cpp.o
418.429 [2234/178/4239] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/JumpDiagnostics.cpp.o
418.849 [2234/177/4240] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAccess.cpp.o
419.411 [2234/176/4241] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/ByteCodeEmitter.cpp.o
420.146 [2234/175/4242] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSystemZ.cpp.o
420.333 [2234/174/4243] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Type.cpp.o
420.598 [2234/173/4244] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
421.965 [2234/172/4245] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGAtomic.cpp.o
422.119 [2234/171/4246] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/MicrosoftMangle.cpp.o
422.391 [2234/170/4247] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSPIRV.cpp.o
422.464 [2234/169/4248] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Expr.cpp.o
422.556 [2234/168/4249] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaPPC.cpp.o
422.790 [2234/167/4250] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenCL.cpp.o
423.184 [2234/166/4251] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCXXScopeSpec.cpp.o
424.770 [2234/165/4252] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaWasm.cpp.o
424.774 [2234/164/4253] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/StmtPrinter.cpp.o
424.806 [2234/163/4254] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
424.847 [2234/162/4255] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CGLoopInfo.cpp.o
424.988 [2234/161/4256] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaSwift.cpp.o
425.501 [2234/160/4257] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/JSONNodeDumper.cpp.o
426.503 [2234/159/4258] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenACCClause.cpp.o

This is probably caused by the fact that TargetParser is missing from MSP430CodeGen's link components.

@rnk
Copy link
Collaborator Author

rnk commented Sep 11, 2025

This is probably caused by the fact that TargetParser is missing from MSP430CodeGen's link components.

Yep, that should be fixed by 4ae520b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.