diff options
| author | Mingming Liu <mingmingl@google.com> | 2025-02-06 14:51:13 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-06 14:51:13 -0800 |
| commit | 5399782508e9573b0d2f184b151997375a1dfdeb (patch) | |
| tree | 8af15fe942a743dc3083ed80443263a731c9ea1e /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
| parent | 8b65411b006cbe302dea7d00ff79abddd1403061 (diff) | |
[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.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 3c2c7c8c9fed..6cbc4b9776a1 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) { |
