1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/include/llvm/MC
Saleem Abdulrasool f56e4f6d3d RISCV: adjust handling of relocation emission for RISCV
This re-architects the RISCV relocation handling to bring the
implementation closer in line with the implementation in binutils.  We
would previously aggressively resolve the relocation.  With this
restructuring, we always will emit a paired relocation for any symbolic
difference of the type of S±T[±C] where S and T are labels and C is a
constant.

GAS has a special target hook controlled by `RELOC_EXPANSION_POSSIBLE`
which indicates that a fixup may be expanded into multiple relocations.
This is used by the RISCV backend to always emit a paired relocation -
either ADD[WIDTH] + SUB[WIDTH] for text relocations or SET[WIDTH] +
SUB[WIDTH] for a debug info relocation.  Irrespective of whether linker
relaxation support is enabled, symbolic difference is always emitted as
a paired relocation.

This change also sinks the target specific behaviour down into the
target specific area rather than exposing it to the shared relocation
handling.  In the process, we also sink the "special" handling for debug
information down into the RISCV target.  Although this improves the path
for the other targets, this is not necessarily entirely ideal either.
The changes in the debug info emission could be done through another
type of hook as this functionality would be required by any other target
which wishes to do linker relaxation.  However, as there are no other
targets in LLVM which currently do this, this is a reasonable thing to
do until such time as the code needs to be shared.

Improve the handling of the relocation (and add a reduced test case from
the Linux kernel) to ensure that we handle complex expressions for
symbolic difference.  This ensures that we correct relocate symbols with
the adddends normalized and associated with the addition portion of the
paired relocation.

This change also addresses some review comments from Alex Bradbury about
the relocations meant for use in the DWARF CFA being named incorrectly
(using ADD6 instead of SET6) in the original change which introduced the
relocation type.

This resolves the issues with the symbolic difference emission
sufficiently to enable building the Linux kernel with clang+IAS+lld
(without linker relaxation).

Resolves PR50153, PR50156!
Fixes: ClangBuiltLinux/linux#1023, ClangBuiltLinux/linux#1143

Reviewed By: nickdesaulniers, maskray

Differential Revision: https://reviews.llvm.org/D103539
2021-06-17 08:20:02 -07:00
..
MCDisassembler [MC][AMDGPU][llvm-objdump] Synthesized local labels in disassembly 2021-04-26 13:56:36 +01:00
MCParser [AArch64][MC] Remove unneeded "in .xxx directive" from diagnostics 2021-05-23 13:58:16 -07:00
ConstantPools.h
LaneBitmask.h [NFC] Add missing include to LaneBitmask.h to fix modules build 2021-06-07 18:43:00 +02:00
MachineLocation.h
MCAsmBackend.h RISCV: adjust handling of relocation emission for RISCV 2021-06-17 08:20:02 -07:00
MCAsmInfo.h [AIX] Print printable byte list as quoted string 2021-05-21 02:37:55 +00:00
MCAsmInfoCOFF.h
MCAsmInfoDarwin.h
MCAsmInfoELF.h
MCAsmInfoWasm.h
MCAsmInfoXCOFF.h
MCAsmLayout.h
MCAsmMacro.h
MCAssembler.h [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
MCCodeEmitter.h
MCCodeView.h
MCContext.h [MC][ELF] Emit unique sections for different flags 2021-05-26 11:51:29 +01:00
MCDirectives.h
MCDwarf.h RISCV: adjust handling of relocation emission for RISCV 2021-06-17 08:20:02 -07:00
MCELFObjectWriter.h MC: mark dump with LLVM_DUMP_METHOD 2021-05-27 10:47:39 -07:00
MCELFStreamer.h [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
MCExpr.h [AIX][TLS] Add ASM portion changes to support TLSGD relocations to XCOFF objects 2021-04-29 13:18:59 -05:00
MCFixedLenDisassembler.h
MCFixup.h RISCV: adjust handling of relocation emission for RISCV 2021-06-17 08:20:02 -07:00
MCFixupKindInfo.h
MCFragment.h
MCInst.h [MC] Add the ability to pass MCRegisterInfo to dump_pretty. 2021-05-14 18:21:57 -07:00
MCInstBuilder.h [WebAssembly] Support single-floating-point immediate value 2021-02-04 18:05:06 -08:00
MCInstPrinter.h [llvm-mc] Add -M to replace -riscv-no-aliases and -riscv-arch-reg-names 2021-05-26 10:43:32 -07:00
MCInstrAnalysis.h
MCInstrDesc.h [MC] MCInstrDesc.h - remove unnecessary <string> include. NFCI. 2021-04-21 15:07:00 +01:00
MCInstrInfo.h
MCInstrItineraries.h
MCLabel.h
MCLinkerOptimizationHint.h
MCMachObjectWriter.h
MCObjectFileInfo.h [MC] Add getLSDASection interface 2021-06-05 00:28:20 -07:00
MCObjectStreamer.h [XCOFF][DebugInfo] support DWARF for XCOFF for assembly output. 2021-03-04 21:07:52 -05:00
MCObjectWriter.h [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN 2021-03-09 09:59:47 -08:00
MCPseudoProbe.h [CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples. 2021-04-21 18:07:58 -07:00
MCRegister.h [MC] Add missing include (NFC) 2021-06-03 18:50:00 +02:00
MCRegisterInfo.h Add register size info back to MCRegisterClass 2021-03-23 15:04:44 -07:00
MCSchedule.h [MCA] Add support for in-order CPUs 2021-03-04 14:08:19 +03:00
MCSection.h
MCSectionCOFF.h
MCSectionELF.h [MC][ELF] Support for zero flag section groups 2021-02-16 14:23:40 -08:00
MCSectionMachO.h Support #pragma clang section directives on MachO targets 2021-02-25 09:30:10 -08:00
MCSectionWasm.h Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
MCSectionXCOFF.h [AIX][TLS] Add assert check of valid csect type for the storage mapping class XCOFF::XMC_UL 2021-03-08 14:18:57 -06:00
MCStreamer.h Implement DW_CFA_LLVM_* for Heterogeneous Debugging 2021-06-14 08:51:50 +05:30
MCSubtargetInfo.h AMDGPU: Add target id and code object v4 support 2021-03-24 11:54:05 -04:00
MCSymbol.h
MCSymbolCOFF.h
MCSymbolELF.h
MCSymbolMachO.h
MCSymbolWasm.h [WebAssembly][MC] Record limit constraints for table sizes 2021-03-24 09:44:22 +01:00
MCSymbolXCOFF.h
MCTargetOptions.h
MCTargetOptionsCommandFlags.h
MCValue.h
MCWasmObjectWriter.h [WebAssembly] Add new relocation for location relative data 2021-03-08 11:34:10 -08:00
MCWasmStreamer.h
MCWin64EH.h
MCWinCOFFObjectWriter.h
MCWinCOFFStreamer.h
MCWinEH.h
MCXCOFFObjectWriter.h
MCXCOFFStreamer.h
SectionKind.h [AIX][TLS] Generate TLS variables in assembly files 2021-03-02 18:22:48 -06:00
StringTableBuilder.h
SubtargetFeature.h