aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-02-06 14:51:13 -0800
committerGitHub <noreply@github.com>2025-02-06 14:51:13 -0800
commit5399782508e9573b0d2f184b151997375a1dfdeb (patch)
tree8af15fe942a743dc3083ed80443263a731c9ea1e /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent8b65411b006cbe302dea7d00ff79abddd1403061 (diff)
downloadllvm-5399782508e9573b0d2f184b151997375a1dfdeb.zip
llvm-5399782508e9573b0d2f184b151997375a1dfdeb.tar.gz
llvm-5399782508e9573b0d2f184b151997375a1dfdeb.tar.bz2
[IR] Generalize Function's {set,get}SectionPrefix to GlobalObjects, the base class of {Function, GlobalVariable, IFunc} (#125757)
This is a split of https://github.com/llvm/llvm-project/pull/125756
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 3c2c7c8..6cbc4b9 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -687,6 +687,11 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind,
raw_svector_ostream(Name) << '.' << *Prefix;
HasPrefix = true;
}
+ } else if (const auto *GV = dyn_cast<GlobalVariable>(GO)) {
+ if (std::optional<StringRef> Prefix = GV->getSectionPrefix()) {
+ raw_svector_ostream(Name) << '.' << *Prefix;
+ HasPrefix = true;
+ }
}
if (UniqueSectionName) {