Skip to content

Commit bab58c1

Browse files
authored
[Offload] Change section names for offload entries (#20509)
Follow the community change that renames the section for the offload entries from omp_offloading_entries to llvm_offload_entries.
1 parent cf605df commit bab58c1

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

clang/test/Driver/clang-offload-extract.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ __declspec(align(sizeof(void*) * 2))
6464
const void* padding[2] = {0, 0};
6565

6666
#ifdef _WIN32
67-
char __start_omp_offloading_entries = 1;
68-
char __stop_omp_offloading_entries = 1;
67+
char __start_llvm_offload_entries = 1;
68+
char __stop_llvm_offload_entries = 1;
6969
#endif
7070

7171
void __tgt_register_lib(void *desc) {}

clang/test/Driver/clang-offload-wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
// CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
130130
// CHECK-IR: [[ENTEND:@.+]] = external hidden constant [[ENTTY]]
131131

132-
// CHECK-IR: [[DUMMY:@.+]] = hidden constant [0 x [[ENTTY]]] zeroinitializer, section "omp_offloading_entries"
132+
// CHECK-IR: [[DUMMY:@.+]] = hidden constant [0 x [[ENTTY]]] zeroinitializer, section "llvm_offload_entries"
133133

134134
// CHECK-IR: [[OMP_BIN:@.+]] = internal unnamed_addr constant [[OMP_BINTY:\[[0-9]+ x i8\]]] c"Content of device file3{{.+}}"
135135
// CHECK-IR: [[OMP_INFO:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr [[OMP_BIN]] to i64), i64 24], section ".tgtimg", align 16

clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,9 @@ class BinaryWrapper {
10061006
/// library. It is defined as follows
10071007
///
10081008
/// __attribute__((visibility("hidden")))
1009-
/// extern __tgt_offload_entry *__start_omp_offloading_entries;
1009+
/// extern __tgt_offload_entry *__start_llvm_offload_entries;
10101010
/// __attribute__((visibility("hidden")))
1011-
/// extern __tgt_offload_entry *__stop_omp_offloading_entries;
1011+
/// extern __tgt_offload_entry *__stop_llvm_offload_entries;
10121012
///
10131013
/// static const char Image0[] = { <Bufs.front() contents> };
10141014
/// ...
@@ -1018,23 +1018,23 @@ class BinaryWrapper {
10181018
/// {
10191019
/// Image0, /*ImageStart*/
10201020
/// Image0 + sizeof(Image0), /*ImageEnd*/
1021-
/// __start_omp_offloading_entries, /*EntriesBegin*/
1022-
/// __stop_omp_offloading_entries /*EntriesEnd*/
1021+
/// __start_llvm_offload_entries, /*EntriesBegin*/
1022+
/// __stop_llvm_offload_entries /*EntriesEnd*/
10231023
/// },
10241024
/// ...
10251025
/// {
10261026
/// ImageN, /*ImageStart*/
10271027
/// ImageN + sizeof(ImageN), /*ImageEnd*/
1028-
/// __start_omp_offloading_entries, /*EntriesBegin*/
1029-
/// __stop_omp_offloading_entries /*EntriesEnd*/
1028+
/// __start_llvm_offload_entries, /*EntriesBegin*/
1029+
/// __stop_llvm_offload_entries /*EntriesEnd*/
10301030
/// }
10311031
/// };
10321032
///
10331033
/// static const __tgt_bin_desc BinDesc = {
10341034
/// sizeof(Images) / sizeof(Images[0]), /*NumDeviceImages*/
10351035
/// Images, /*DeviceImages*/
1036-
/// __start_omp_offloading_entries, /*HostEntriesBegin*/
1037-
/// __stop_omp_offloading_entries /*HostEntriesEnd*/
1036+
/// __start_llvm_offload_entries, /*HostEntriesBegin*/
1037+
/// __stop_llvm_offload_entries /*HostEntriesEnd*/
10381038
/// };
10391039
///
10401040
/// Global variable that represents BinDesc is returned.
@@ -1049,24 +1049,24 @@ class BinaryWrapper {
10491049
// Create external begin/end symbols for the offload entries table.
10501050
auto *EntriesStart = new GlobalVariable(
10511051
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
1052-
/*Initializer*/ nullptr, "__start_omp_offloading_entries");
1052+
/*Initializer*/ nullptr, "__start_llvm_offload_entries");
10531053
EntriesStart->setVisibility(GlobalValue::HiddenVisibility);
10541054
auto *EntriesStop = new GlobalVariable(
10551055
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
1056-
/*Initializer*/ nullptr, "__stop_omp_offloading_entries");
1056+
/*Initializer*/ nullptr, "__stop_llvm_offload_entries");
10571057
EntriesStop->setVisibility(GlobalValue::HiddenVisibility);
10581058

10591059
// We assume that external begin/end symbols that we have created above
10601060
// will be defined by the linker. But linker will do that only if linker
1061-
// inputs have section with "omp_offloading_entries" name which is not
1061+
// inputs have section with "llvm_offload_entries" name which is not
10621062
// guaranteed. So, we just create dummy zero sized object in the offload
10631063
// entries section to force linker to define those symbols.
10641064
auto *DummyInit =
10651065
ConstantAggregateZero::get(ArrayType::get(getEntryTy(), 0u));
10661066
auto *DummyEntry = new GlobalVariable(
10671067
M, DummyInit->getType(), true, GlobalVariable::ExternalLinkage,
10681068
DummyInit, "__dummy.omp_offloading.entry");
1069-
DummyEntry->setSection("omp_offloading_entries");
1069+
DummyEntry->setSection("llvm_offload_entries");
10701070
DummyEntry->setVisibility(GlobalValue::HiddenVisibility);
10711071

10721072
EntriesB = EntriesStart;

0 commit comments

Comments
 (0)