aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
diff options
context:
space:
mode:
authorSnehasish Kumar <snehasishk@google.com>2021-04-21 14:41:12 -0700
committerSnehasish Kumar <snehasishk@google.com>2021-04-21 21:51:33 -0700
commit8077d0ff5c662dacbc69831a2c5acff10b759c48 (patch)
treee3fe5448d9ebe59a236ec7049faee6d1215766a2 /llvm/lib/CodeGen/MachineFunctionSplitter.cpp
parente4fa0b307f7fe2c3db7442c719f643287f08eed4 (diff)
downloadllvm-8077d0ff5c662dacbc69831a2c5acff10b759c48.zip
llvm-8077d0ff5c662dacbc69831a2c5acff10b759c48.tar.gz
llvm-8077d0ff5c662dacbc69831a2c5acff10b759c48.tar.bz2
[CodeGen] Do not split functions with attr "implicit-section-name".
The #pragma clang section can be used at a coarse granularity to specify the section used for bss/data/text/rodata for global objects. When split functions is enabled, the function may be split into two parts violating user expectations. Reference: https://clang.llvm.org/docs/LanguageExtensions.html#specifying-section-names-for-global-objects-pragma-clang-section Differential Revision: https://reviews.llvm.org/D101004
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunctionSplitter.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunctionSplitter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
index 294e3c2..2bb69e0 100644
--- a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
@@ -101,7 +101,8 @@ bool MachineFunctionSplitter::runOnMachineFunction(MachineFunction &MF) {
// since the split part may not be placed in a contiguous region. It may also
// be more beneficial to augment the linker to ensure contiguous layout of
// split functions within the same section as specified by the attribute.
- if (!MF.getFunction().getSection().empty())
+ if (!MF.getFunction().getSection().empty() ||
+ MF.getFunction().hasFnAttribute("implicit-section-name"))
return false;
// We don't want to proceed further for cold functions