1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/lib/MC
Daniel Sanders cd4dc5cad8 [mips] Correct the ordering of HI/LO pairs in the relocation table.
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
2016-05-06 13:49:25 +00:00
..
MCDisassembler
MCParser ARM: put extern __thread stubs in a special section. 2016-04-25 21:12:04 +00:00
CMakeLists.txt
ConstantPools.cpp
ELFObjectWriter.cpp [mips] Correct the ordering of HI/LO pairs in the relocation table. 2016-05-06 13:49:25 +00:00
LLVMBuild.txt
MachObjectWriter.cpp Reapply: "ARM: put correct symbol index on indirect pointers in __thread_ptr."" 2016-04-26 18:29:16 +00:00
MCAsmBackend.cpp MachO: enable .data_region directives everywhere 2016-04-21 23:00:17 +00:00
MCAsmInfo.cpp [MachO] Add MachO alt-entry directive support. 2016-03-15 01:43:05 +00:00
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp ARM: put extern __thread stubs in a special section. 2016-04-25 21:12:04 +00:00
MCAsmInfoELF.cpp
MCAsmStreamer.cpp [MC] Create unique .pdata sections for every .text section 2016-05-02 23:22:18 +00:00
MCAssembler.cpp [MCAssembler] Allow backend to finalize layout post-relaxation. 2016-04-27 21:26:13 +00:00
MCCodeEmitter.cpp
MCCodeGenInfo.cpp
MCCodeView.cpp
MCContext.cpp [MC] Create unique .pdata sections for every .text section 2016-05-02 23:22:18 +00:00
MCDwarf.cpp Read discriminators correctly from object file. 2016-04-28 22:09:37 +00:00
MCELFObjectTargetWriter.cpp
MCELFStreamer.cpp [mips] Use MipsMCExpr instead of MCSymbolRefExpr for all relocations. 2016-05-03 13:35:44 +00:00
MCExpr.cpp [mips] Use MipsMCExpr instead of MCSymbolRefExpr for all relocations. 2016-05-03 13:35:44 +00:00
MCFragment.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
MCInst.cpp
MCInstPrinter.cpp
MCInstrAnalysis.cpp
MCInstrDesc.cpp
MCLabel.cpp
MCLinkerOptimizationHint.cpp
MCMachObjectTargetWriter.cpp
MCMachOStreamer.cpp MachO: enable .data_region directives everywhere 2016-04-21 23:00:17 +00:00
MCNullStreamer.cpp
MCObjectFileInfo.cpp Add accidentally deleted "break" 2016-04-25 21:28:52 +00:00
MCObjectStreamer.cpp
MCObjectWriter.cpp
MCRegisterInfo.cpp
MCSchedule.cpp
MCSection.cpp
MCSectionCOFF.cpp
MCSectionELF.cpp
MCSectionMachO.cpp
MCStreamer.cpp [MC] Create unique .pdata sections for every .text section 2016-05-02 23:22:18 +00:00
MCSubtargetInfo.cpp
MCSymbol.cpp
MCSymbolELF.cpp
MCTargetOptions.cpp
MCValue.cpp
MCWin64EH.cpp [MC] Create unique .pdata sections for every .text section 2016-05-02 23:22:18 +00:00
MCWinEH.cpp [MC] Create unique .pdata sections for every .text section 2016-05-02 23:22:18 +00:00
StringTableBuilder.cpp Make StringTableBuilder to cache hash values. 2016-05-06 00:51:58 +00:00
SubtargetFeature.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
WinCOFFObjectWriter.cpp
WinCOFFStreamer.cpp [Object] Make .alt_entry directive parsing MachO specific. 2016-04-11 18:33:45 +00:00