diff options
author | Fangrui Song <i@maskray.me> | 2025-03-31 20:44:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-31 20:44:29 -0700 |
commit | dd862356e20d2d7e0d0356dff5bd80623c14febc (patch) | |
tree | b227d78e13fce00f12b2d82a2ed0f6eeddfbea33 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | 71cf59219162be67392b435dfcb9b280e1ff8681 (diff) | |
download | llvm-dd862356e20d2d7e0d0356dff5bd80623c14febc.zip llvm-dd862356e20d2d7e0d0356dff5bd80623c14febc.tar.gz llvm-dd862356e20d2d7e0d0356dff5bd80623c14febc.tar.bz2 |
AsmPrinter: Remove ELF's special lowerRelativeReference for unnamed_addr function
https://reviews.llvm.org/D17938 introduced lowerRelativeReference to
give ConstantExpr sub (A-B) special semantics in ELF: when `A` is an
`unnamed_addr` function, create a PLT-generating relocation. This was
intended for C++ relative vtables, but C++ relative vtable ended up
using DSOLocalEquivalent (lowerDSOLocalEquivalent).
This special treatment of `unnamed_addr` seems unusual.
Let's remove it. Only COFF needs an overload to generate a @IMGREL32
relocation specifier (llvm/test/MC/COFF/cross-section-relative.ll).
Pull Request: https://github.com/llvm/llvm-project/pull/132684
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 4c20c5d..c941529 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1233,24 +1233,6 @@ const MCExpr *TargetLoweringObjectFileELF::lowerSymbolDifference( return Res; } -const MCExpr *TargetLoweringObjectFileELF::lowerRelativeReference( - const GlobalValue *LHS, const GlobalValue *RHS, int64_t Addend, - std::optional<int64_t> PCRelativeOffset, const TargetMachine &TM) const { - // We may only use a PLT-relative relocation to refer to unnamed_addr - // functions. - if (!LHS->hasGlobalUnnamedAddr() || !LHS->getValueType()->isFunctionTy()) - return nullptr; - - // Basic correctness checks. - if (LHS->getType()->getPointerAddressSpace() != 0 || - RHS->getType()->getPointerAddressSpace() != 0 || LHS->isThreadLocal() || - RHS->isThreadLocal()) - return nullptr; - - return lowerSymbolDifference(TM.getSymbol(LHS), TM.getSymbol(RHS), Addend, - PCRelativeOffset); -} - // Reference the PLT entry of a function, optionally with a subtrahend (`RHS`). const MCExpr *TargetLoweringObjectFileELF::lowerDSOLocalEquivalent( const MCSymbol *LHS, const MCSymbol *RHS, int64_t Addend, |