diff options
author | Petr Pavlu <petr.pavlu@arm.com> | 2018-07-11 20:17:54 +0000 |
---|---|---|
committer | Petr Pavlu <petr.pavlu@arm.com> | 2018-07-11 20:17:54 +0000 |
commit | a934f9da411056d9c54a693f8e45ba9485aa1cd0 (patch) | |
tree | 98cdb57e8d845b7f1038a37b8bd04094d610d671 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b90dd4b25b602cf71e5cd9e349cb671796f2a4cf (diff) | |
download | bcm5719-llvm-a934f9da411056d9c54a693f8e45ba9485aa1cd0.tar.gz bcm5719-llvm-a934f9da411056d9c54a693f8e45ba9485aa1cd0.zip |
Fix setting of empty implicit-section-name attribute
Code in `CodeGenModule::SetFunctionAttributes()` could set an empty
attribute `implicit-section-name` on a function that is affected by
`#pragma clang text="section"`. This is incorrect because the attribute
should contain a valid section name. If the function additionally also
used `__attribute__((section("section")))` then this could result in
emitting the function in a section with an empty name.
The patch fixes the issue by removing the problematic code that sets
empty `implicit-section-name` from
`CodeGenModule::SetFunctionAttributes()` because it is sufficient to set
this attribute only from a similar code in `setNonAliasAttributes()`
when the function is emitted.
Differential Revision: https://reviews.llvm.org/D48916
llvm-svn: 336842
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 13afd4bdb83..b412d3083f5 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1485,10 +1485,6 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F, setLinkageForGV(F, FD); setGVProperties(F, FD); - if (FD->getAttr<PragmaClangTextSectionAttr>()) { - F->addFnAttr("implicit-section-name"); - } - if (const SectionAttr *SA = FD->getAttr<SectionAttr>()) F->setSection(SA->getName()); |