diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b412d3083f5..68868708888 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1387,8 +1387,10 @@ void CodeGenModule::setNonAliasAttributes(GlobalDecl GD, F->addAttributes(llvm::AttributeList::FunctionIndex, Attrs); } } - - if (const SectionAttr *SA = D->getAttr<SectionAttr>()) + + if (const auto *CSA = D->getAttr<CodeSegAttr>()) + GO->setSection(CSA->getName()); + else if (const auto *SA = D->getAttr<SectionAttr>()) GO->setSection(SA->getName()); } @@ -1485,8 +1487,10 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, setLinkageForGV(F, FD); setGVProperties(F, FD); - if (const SectionAttr *SA = FD->getAttr<SectionAttr>()) - F->setSection(SA->getName()); + if (const auto *CSA = FD->getAttr<CodeSegAttr>()) + F->setSection(CSA->getName()); + else if (const auto *SA = FD->getAttr<SectionAttr>()) + F->setSection(SA->getName()); if (FD->isReplaceableGlobalAllocationFunction()) { // A replaceable global allocation function does not act like a builtin by |