aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2023-12-01 17:18:14 +0100
committerDmitri Gribenko <gribozavr@gmail.com>2023-12-01 17:18:14 +0100
commit76f78ecc789d58baa3a88b2fe2a57428f07e5362 (patch)
treeaaddcf6097fa4c974c2988270128751669e2eb94 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parentd222fa4521531cc4ac14b8e157d231c108c003be (diff)
downloadllvm-76f78ecc789d58baa3a88b2fe2a57428f07e5362.zip
llvm-76f78ecc789d58baa3a88b2fe2a57428f07e5362.tar.gz
llvm-76f78ecc789d58baa3a88b2fe2a57428f07e5362.tar.bz2
Revert "Reland [X86] With large code model, put functions into .ltext with large section flag (#73037)"
This reverts commit 4bf8a688956a759b7b6b8d94f42d25c13c7af130. This commit seems to be breaking the semantics of the ObjectFile::isSectionText method, which breaks numba/llvmlite bindings.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 143a495..f3ba38081 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -616,7 +616,7 @@ static unsigned getEntrySizeForKind(SectionKind Kind) {
/// DataSections.
static StringRef getSectionPrefixForGlobal(SectionKind Kind, bool IsLarge) {
if (Kind.isText())
- return IsLarge ? ".ltext" : ".text";
+ return ".text";
if (Kind.isReadOnly())
return IsLarge ? ".lrodata" : ".rodata";
if (Kind.isBSS())
@@ -650,7 +650,10 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind,
Name = ".rodata.cst";
Name += utostr(EntrySize);
} else {
- Name = getSectionPrefixForGlobal(Kind, TM.isLargeGlobalObject(GO));
+ bool IsLarge = false;
+ if (auto *GV = dyn_cast<GlobalVariable>(GO))
+ IsLarge = TM.isLargeData(GV);
+ Name = getSectionPrefixForGlobal(Kind, IsLarge);
}
bool HasPrefix = false;
@@ -770,8 +773,12 @@ getGlobalObjectInfo(const GlobalObject *GO, const TargetMachine &TM) {
Group = C->getName();
IsComdat = C->getSelectionKind() == Comdat::Any;
}
- if (TM.isLargeGlobalObject(GO))
- Flags |= ELF::SHF_X86_64_LARGE;
+ if (auto *GV = dyn_cast<GlobalVariable>(GO)) {
+ if (TM.isLargeData(GV)) {
+ assert(TM.getTargetTriple().getArch() == Triple::x86_64);
+ Flags |= ELF::SHF_X86_64_LARGE;
+ }
+ }
return {Group, IsComdat, Flags};
}