[clang] [llvm] [HIP][MacOS] Mach-O support and Darwin toolchain fixes (PR #183991)

Paulius Velesko via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 22:06:59 PDT 2026


================
@@ -141,6 +166,15 @@ offloading::getOffloadEntryArray(Module &M, StringRef SectionName) {
     DummyEntry->setSection(SectionName);
     DummyEntry->setAlignment(Align(object::OffloadBinary::getAlignment()));
     appendToCompilerUsed(M, DummyEntry);
+  } else if (Triple.isOSBinFormatMachO()) {
+    // Mach-O needs a dummy variable in the section (like ELF) to ensure the
+    // linker provides the section boundary symbols.
+    auto *DummyEntry = new GlobalVariable(
+        M, ZeroInitilaizer->getType(), true, GlobalVariable::InternalLinkage,
+        ZeroInitilaizer, "__dummy." + SectionName);
----------------
pvelesko wrote:

@jhuber6 added tests

https://github.com/llvm/llvm-project/pull/183991


More information about the llvm-commits mailing list