Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/test/Driver/clang-offload-extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ __declspec(align(sizeof(void*) * 2))
const void* padding[2] = {0, 0};

#ifdef _WIN32
char __start_omp_offloading_entries = 1;
char __stop_omp_offloading_entries = 1;
char __start_llvm_offload_entries = 1;
char __stop_llvm_offload_entries = 1;
#endif

void __tgt_register_lib(void *desc) {}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/clang-offload-wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
// CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
// CHECK-IR: [[ENTEND:@.+]] = external hidden constant [[ENTTY]]

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

// CHECK-IR: [[OMP_BIN:@.+]] = internal unnamed_addr constant [[OMP_BINTY:\[[0-9]+ x i8\]]] c"Content of device file3{{.+}}"
// 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
Expand Down
24 changes: 12 additions & 12 deletions clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,9 @@ class BinaryWrapper {
/// library. It is defined as follows
///
/// __attribute__((visibility("hidden")))
/// extern __tgt_offload_entry *__start_omp_offloading_entries;
/// extern __tgt_offload_entry *__start_llvm_offload_entries;
/// __attribute__((visibility("hidden")))
/// extern __tgt_offload_entry *__stop_omp_offloading_entries;
/// extern __tgt_offload_entry *__stop_llvm_offload_entries;
///
/// static const char Image0[] = { <Bufs.front() contents> };
/// ...
Expand All @@ -1018,23 +1018,23 @@ class BinaryWrapper {
/// {
/// Image0, /*ImageStart*/
/// Image0 + sizeof(Image0), /*ImageEnd*/
/// __start_omp_offloading_entries, /*EntriesBegin*/
/// __stop_omp_offloading_entries /*EntriesEnd*/
/// __start_llvm_offload_entries, /*EntriesBegin*/
/// __stop_llvm_offload_entries /*EntriesEnd*/
/// },
/// ...
/// {
/// ImageN, /*ImageStart*/
/// ImageN + sizeof(ImageN), /*ImageEnd*/
/// __start_omp_offloading_entries, /*EntriesBegin*/
/// __stop_omp_offloading_entries /*EntriesEnd*/
/// __start_llvm_offload_entries, /*EntriesBegin*/
/// __stop_llvm_offload_entries /*EntriesEnd*/
/// }
/// };
///
/// static const __tgt_bin_desc BinDesc = {
/// sizeof(Images) / sizeof(Images[0]), /*NumDeviceImages*/
/// Images, /*DeviceImages*/
/// __start_omp_offloading_entries, /*HostEntriesBegin*/
/// __stop_omp_offloading_entries /*HostEntriesEnd*/
/// __start_llvm_offload_entries, /*HostEntriesBegin*/
/// __stop_llvm_offload_entries /*HostEntriesEnd*/
/// };
///
/// Global variable that represents BinDesc is returned.
Expand All @@ -1049,24 +1049,24 @@ class BinaryWrapper {
// Create external begin/end symbols for the offload entries table.
auto *EntriesStart = new GlobalVariable(
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
/*Initializer*/ nullptr, "__start_omp_offloading_entries");
/*Initializer*/ nullptr, "__start_llvm_offload_entries");
EntriesStart->setVisibility(GlobalValue::HiddenVisibility);
auto *EntriesStop = new GlobalVariable(
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
/*Initializer*/ nullptr, "__stop_omp_offloading_entries");
/*Initializer*/ nullptr, "__stop_llvm_offload_entries");
EntriesStop->setVisibility(GlobalValue::HiddenVisibility);

// We assume that external begin/end symbols that we have created above
// will be defined by the linker. But linker will do that only if linker
// inputs have section with "omp_offloading_entries" name which is not
// inputs have section with "llvm_offload_entries" name which is not
// guaranteed. So, we just create dummy zero sized object in the offload
// entries section to force linker to define those symbols.
auto *DummyInit =
ConstantAggregateZero::get(ArrayType::get(getEntryTy(), 0u));
auto *DummyEntry = new GlobalVariable(
M, DummyInit->getType(), true, GlobalVariable::ExternalLinkage,
DummyInit, "__dummy.omp_offloading.entry");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the __dummy.omp_offloading.entry be renamed to __dummy.llvm_offload.entry too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the name change is only for omp_offloading_entries -> llvm_offload_entries.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, the name change is only for omp_offloading_entries -> llvm_offload_entries.

Okay. Thanks.

DummyEntry->setSection("omp_offloading_entries");
DummyEntry->setSection("llvm_offload_entries");
DummyEntry->setVisibility(GlobalValue::HiddenVisibility);

EntriesB = EntriesStart;
Expand Down
Loading