From 86dc172f95fba3c71ed8ca93915e9566317540a6 Mon Sep 17 00:00:00 2001 From: Hansang Bae Date: Wed, 29 Oct 2025 13:06:03 -0700 Subject: [PATCH 1/2] [Offload] Change section names for offload entries Follow the community change that renames the section for the offload entries from omp_offloading_entries to llvm_offload_entries. --- clang/test/Driver/clang-offload-wrapper.c | 2 +- .../ClangOffloadWrapper.cpp | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/clang/test/Driver/clang-offload-wrapper.c b/clang/test/Driver/clang-offload-wrapper.c index a32433a5c1da0..5efd52d025452 100644 --- a/clang/test/Driver/clang-offload-wrapper.c +++ b/clang/test/Driver/clang-offload-wrapper.c @@ -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 diff --git a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp index 4814ef05b1561..822b3e100c258 100644 --- a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp +++ b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp @@ -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[] = { }; /// ... @@ -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. @@ -1049,16 +1049,16 @@ 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 = @@ -1066,7 +1066,7 @@ class BinaryWrapper { auto *DummyEntry = new GlobalVariable( M, DummyInit->getType(), true, GlobalVariable::ExternalLinkage, DummyInit, "__dummy.omp_offloading.entry"); - DummyEntry->setSection("omp_offloading_entries"); + DummyEntry->setSection("llvm_offload_entries"); DummyEntry->setVisibility(GlobalValue::HiddenVisibility); EntriesB = EntriesStart; From 1ea05ffbad42d58d39271bb5541effae65af9b33 Mon Sep 17 00:00:00 2001 From: Hansang Bae Date: Wed, 29 Oct 2025 15:57:59 -0700 Subject: [PATCH 2/2] Update affected test --- clang/test/Driver/clang-offload-extract.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/test/Driver/clang-offload-extract.c b/clang/test/Driver/clang-offload-extract.c index 196495893633e..94b68fe38e261 100644 --- a/clang/test/Driver/clang-offload-extract.c +++ b/clang/test/Driver/clang-offload-extract.c @@ -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) {}