summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-04-06 15:27:57 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-04-06 15:27:57 +0000
commit94a88d7165e5b921c175c93d1a8235738a68507a (patch)
tree8ba464707dbea8238fc624778dec932a430fa5ee /llvm/lib/MC/ELFObjectWriter.cpp
parentaf15b6dad95da8c70ec8be4ba5e93ad80ed1bd55 (diff)
downloadbcm5719-llvm-94a88d7165e5b921c175c93d1a8235738a68507a.tar.gz
bcm5719-llvm-94a88d7165e5b921c175c93d1a8235738a68507a.zip
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. llvm-svn: 234165
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 2004b1b8a2d..6105b25b8bf 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -300,6 +300,7 @@ class ELFObjectWriter : public MCObjectWriter {
bool
IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbolData &DataA,
+ const MCSymbolData *DataB,
const MCFragment &FB,
bool InSet,
bool IsPCRel) const override;
@@ -619,7 +620,7 @@ void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
if (ESize) {
int64_t Res;
- if (!ESize->EvaluateAsAbsolute(Res, Layout))
+ if (!ESize->evaluateKnownAbsolute(Res, Layout))
report_fatal_error("Size expression must be absolute.");
Size = Res;
}
@@ -1765,16 +1766,14 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
WriteDataSectionData(Asm, Layout, *Sections[i]);
}
-bool
-ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
- const MCSymbolData &DataA,
- const MCFragment &FB,
- bool InSet,
- bool IsPCRel) const {
- if (::isWeak(DataA))
+bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
+ const MCAssembler &Asm, const MCSymbolData &DataA,
+ const MCSymbolData *DataB, const MCFragment &FB, bool InSet,
+ bool IsPCRel) const {
+ if (!InSet && (::isWeak(DataA) || (DataB && ::isWeak(*DataB))))
return false;
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
- Asm, DataA, FB,InSet, IsPCRel);
+ Asm, DataA, DataB, FB, InSet, IsPCRel);
}
bool ELFObjectWriter::isWeak(const MCSymbolData &SD) const {
OpenPOWER on IntegriCloud