================
@@ -121,13 +123,26 @@ offloading::getOffloadEntryArray(Module &M, StringRef
SectionName) {
auto Linkage = Triple.isOSBinFormatCOFF() ? GlobalValue::WeakODRLinkage
: GlobalValue::ExternalLinkage;
+ // Mach-O uses linker-defined section boundary symbols with a special naming
+ // convention: \1section$start$<segment>$<section> (the \1 prefix suppresses
+ // the leading underscore that Mach-O normally adds to C symbols).
+ std::string MachOSection = "__LLVM,offload_entries";
+ std::string StartName, StopName;
+ if (Triple.isOSBinFormatMachO()) {
+ StartName = "\1section$start$__LLVM$offload_entries";
+ StopName = "\1section$end$__LLVM$offload_entries";
+ } else {
+ StartName = ("__start_" + SectionName).str();
+ StopName = ("__stop_" + SectionName).str();
+ }
+
auto *EntriesB =
new GlobalVariable(M, EntryType, /*isConstant=*/true, Linkage, EntryInit,
- "__start_" + SectionName);
+ StartName);
----------------
pvelesko wrote:
Added helper `getOffloadEntrySection`
https://github.com/llvm/llvm-project/pull/183991
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits