diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-12-14 09:28:27 -0800 |
---|---|---|
committer | Arthur Eubanks <aeubanks@google.com> | 2023-12-14 14:12:37 -0800 |
commit | 239a41e8f2ca84b2fa5e1426e2697a2bc436d218 (patch) | |
tree | 7c5ba93d04335fb77674909040423ffcf5723413 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | e692d0836003dead19070e5f7d199a48fa082f72 (diff) | |
download | llvm-239a41e8f2ca84b2fa5e1426e2697a2bc436d218.zip llvm-239a41e8f2ca84b2fa5e1426e2697a2bc436d218.tar.gz llvm-239a41e8f2ca84b2fa5e1426e2697a2bc436d218.tar.bz2 |
Re-Reland [X86] Respect code models more when determining if a global reference can fit in 32 bits (#75386)
For non-GlobalValue references, the small and medium code models can use
32 bit constants.
For GlobalValue references, use TargetMachine::isLargeGlobalObject().
Look through aliases for determining if a GlobalValue is small or large.
Even the large code model can reference small objects with 32 bit
constants as long as we're in no-pic mode, or if the reference is offset
from the GOT.
Original commit broke the build...
First reland broke large PIC builds referencing small data since it was using GOTOFF as a 32-bit constant.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 8e1a109..9a0dd92 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -649,7 +649,7 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind, Name = ".rodata.cst"; Name += utostr(EntrySize); } else { - Name = getSectionPrefixForGlobal(Kind, TM.isLargeGlobalObject(GO)); + Name = getSectionPrefixForGlobal(Kind, TM.isLargeGlobalValue(GO)); } bool HasPrefix = false; @@ -769,7 +769,7 @@ getGlobalObjectInfo(const GlobalObject *GO, const TargetMachine &TM) { Group = C->getName(); IsComdat = C->getSelectionKind() == Comdat::Any; } - if (TM.isLargeGlobalObject(GO)) + if (TM.isLargeGlobalValue(GO)) Flags |= ELF::SHF_X86_64_LARGE; return {Group, IsComdat, Flags}; } |