Be consistent when deciding if a relocation is needed.

Before when deciding if we needed a relocation in A-B, we wore only checking
if A was weak.

This fixes the asymmetry.

The "InSet" argument should probably be renamed to "ForValue", since InSet is
very MachO specific, but doing so in this patch would make it hard to read.

This fixes PR22815.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234165 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-04-06 15:27:57 +00:00
parent 6dc9f59df9
commit 9428f184be
8 changed files with 40 additions and 32 deletions
+6 -4
View File
@@ -172,6 +172,7 @@ public:
bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbolData &DataA,
const MCSymbolData *DataB,
const MCFragment &FB, bool InSet,
bool IsPCRel) const override;
@@ -649,16 +650,17 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
}
bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbolData &DataA, const MCFragment &FB,
bool InSet, bool IsPCRel) const {
const MCAssembler &Asm, const MCSymbolData &DataA,
const MCSymbolData *DataB, const MCFragment &FB, bool InSet,
bool IsPCRel) const {
// MS LINK expects to be able to replace all references to a function with a
// thunk to implement their /INCREMENTAL feature. Make sure we don't optimize
// away any relocations to functions.
if ((((DataA.getFlags() & COFF::SF_TypeMask) >> COFF::SF_TypeShift) >>
COFF::SCT_COMPLEX_TYPE_SHIFT) == COFF::IMAGE_SYM_DTYPE_FUNCTION)
return false;
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, DataA, FB,
InSet, IsPCRel);
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
Asm, DataA, DataB, FB, InSet, IsPCRel);
}
bool WinCOFFObjectWriter::isWeak(const MCSymbolData &SD) const {