From 5399782508e9573b0d2f184b151997375a1dfdeb Mon Sep 17 00:00:00 2001 From: Mingming Liu Date: Thu, 6 Feb 2025 14:51:13 -0800 Subject: [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 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') 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(GO)) { + if (std::optional Prefix = GV->getSectionPrefix()) { + raw_svector_ostream(Name) << '.' << *Prefix; + HasPrefix = true; + } } if (UniqueSectionName) { -- cgit v1.2.3