forked from OSchip/llvm-project
a463d31a64
Summary: There seems to have been a misunderstanding as to the meaning of 'offset' in the rules laid down by our ABI. The previous code believed that 'offset' meant the offset within the section that the relocation is applied to. However, it should have meant the offset from the symbol used in the relocation expression. This patch adds two fields to ELFRelocationEntry and uses them to correct the order of relocations for MIPS. These fields contain: * The original symbol before shouldRelocateWithSymbol() is considered. This ensures that R_MIPS_GOT16 is able to correctly distinguish between local and external symbols, allowing us to tell whether %got() requires a matching %lo() or not (local symbols require one, external symbols don't). It also prevents confusing cases where the fuzzy matching rules cause things like %hi(foo)/%lo(foo+3) and %hi(bar)/%lo(bar+1) to swap their %lo()'s. * The original offset before shouldRelocateWithSymbol() is considered. The existing Addend field is always zero when the object uses in place addends (because it's already moved it to the encoding) but MIPS needs to use the original offset to ensure that the linker correctly calculates the carry-in bit for %hi() and %got(). IAS ensures that unmatchable %hi()/%got() relocations are placed at the end of the table to ensure that the linker rejects the table (we're unable to report such errors directly). The alternatives to this risk accidental matching against inappropriate relocations which may silently compute incorrect values due to an incorrect carry bit between the %lo() and %hi()/%got(). Reviewers: sdardis Subscribers: dsanders, sdardis, rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D19718 llvm-svn: 268733 |
||
---|---|---|
.. | ||
MCDisassembler | ||
MCParser | ||
CMakeLists.txt | ||
ConstantPools.cpp | ||
ELFObjectWriter.cpp | ||
LLVMBuild.txt | ||
MCAsmBackend.cpp | ||
MCAsmInfo.cpp | ||
MCAsmInfoCOFF.cpp | ||
MCAsmInfoDarwin.cpp | ||
MCAsmInfoELF.cpp | ||
MCAsmStreamer.cpp | ||
MCAssembler.cpp | ||
MCCodeEmitter.cpp | ||
MCCodeGenInfo.cpp | ||
MCCodeView.cpp | ||
MCContext.cpp | ||
MCDwarf.cpp | ||
MCELFObjectTargetWriter.cpp | ||
MCELFStreamer.cpp | ||
MCExpr.cpp | ||
MCFragment.cpp | ||
MCInst.cpp | ||
MCInstPrinter.cpp | ||
MCInstrAnalysis.cpp | ||
MCInstrDesc.cpp | ||
MCLabel.cpp | ||
MCLinkerOptimizationHint.cpp | ||
MCMachOStreamer.cpp | ||
MCMachObjectTargetWriter.cpp | ||
MCNullStreamer.cpp | ||
MCObjectFileInfo.cpp | ||
MCObjectStreamer.cpp | ||
MCObjectWriter.cpp | ||
MCRegisterInfo.cpp | ||
MCSchedule.cpp | ||
MCSection.cpp | ||
MCSectionCOFF.cpp | ||
MCSectionELF.cpp | ||
MCSectionMachO.cpp | ||
MCStreamer.cpp | ||
MCSubtargetInfo.cpp | ||
MCSymbol.cpp | ||
MCSymbolELF.cpp | ||
MCTargetOptions.cpp | ||
MCValue.cpp | ||
MCWin64EH.cpp | ||
MCWinEH.cpp | ||
MachObjectWriter.cpp | ||
StringTableBuilder.cpp | ||
SubtargetFeature.cpp | ||
WinCOFFObjectWriter.cpp | ||
WinCOFFStreamer.cpp |