diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -446,7 +446,8 @@ /*AddSegmentInfo=*/false) || Name == getInstrProfSectionName(IPSK_covfun, Triple::ELF, /*AddSegmentInfo=*/false) || - Name == ".llvmbc" || Name == ".llvmcmd") + Name == ".llvmbc" || Name == ".llvmcmd" || + Name.startswith(".llvm.offloading.")) return SectionKind::getMetadata(); if (Name.empty() || Name[0] != '.') return K; diff --git a/llvm/test/CodeGen/X86/offload_sections.ll b/llvm/test/CodeGen/X86/offload_sections.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/X86/offload_sections.ll @@ -0,0 +1,6 @@ +; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s + +@llvm.embedded.object = hidden constant [1 x i8] c"\00", section ".llvm.offloading.dummy" +@llvm.compiler.used = appending global [1 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @llvm.embedded.object, i32 0, i32 0)], section "llvm.metadata" + +; CHECK-DAG: .section .llvm.offloading.dummy,""