1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/include/llvm/BinaryFormat
Yonghong Song 1d0a1ee04d BPF: Add more relocation kinds
Currently, BPF only contains three relocations:
  R_BPF_NONE   for no relocation
  R_BPF_64_64  for LD_imm64 and normal 64-bit data relocation
  R_BPF_64_32  for call insn and normal 32-bit data relocation

Also .BTF and .BTF.ext sections contain symbols in allocated
program and data sections. These two sections reserved 32bit
space to hold the offset relative to the symbol's section.
When LLVM JIT is used, the LLVM ExecutionEngine RuntimeDyld
may attempt to resolve relocations for .BTF and .BTF.ext,
which we want to prevent. So we used R_BPF_NONE for such relocations.

This all works fine until when we try to do linking of
multiple objects.
  . R_BPF_64_64 handling of LD_imm64 vs. normal 64-bit data
    is different, so lld target->relocate() needs more context
    to do a correct job.
  . The same for R_BPF_64_32. More context is needed for
    lld target->relocate() to differentiate call insn vs.
    normal 32-bit data relocation.
  . Since relocations in .BTF and .BTF.ext are set to R_BPF_NONE,
    they will not be relocated properly when multiple .BTF/.BTF.ext
    sections are merged by lld.

This patch intends to address this issue by adding additional
relocation kinds:
  R_BPF_64_ABS64     for normal 64-bit data relocation
  R_BPF_64_ABS32     for normal 32-bit data relocation
  R_BPF_64_NODYLD32  for .BTF and .BTF.ext style relocations.
The old R_BPF_64_{64,32} semantics:
  R_BPF_64_64        for LD_imm64 relocation
  R_BPF_64_32        for call insn relocation

The existing R_BPF_64_64/R_BPF_64_32 mapping to numeric values
is maintained. They are the most common use cases for
bpf programs and we want to maintain backward compatibility
as much as possible.

ExecutionEngine RuntimeDyld BPF relocations are adjusted as well.
R_BPF_64_{ABS64,ABS32} relocations will be resolved properly and
other relocations will be ignored.
Two tests are added for RuntimeDyld. Not handling R_BPF_64_NODYLD32 in
RuntimeDyldELF.cpp will result in "Relocation type not implemented yet!"
fatal error.

FK_SecRel_4 usages in BPFAsmBackend.cpp and BPFELFObjectWriter.cpp
are removed as they are not triggered in BPF backend.
BPF backend used FK_SecRel_8 for LD_imm64 instruction operands.

Differential Revision: https://reviews.llvm.org/D102712
2021-05-25 08:19:13 -07:00
..
ELFRelocs BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
AMDGPUMetadataVerifier.h
COFF.h fix comment typo to cycle bots 2021-03-29 15:47:16 -04:00
Dwarf.def Add debug support for set types 2021-03-29 18:04:48 -07:00
Dwarf.h Reapply "[DebugInfo] Add new instruction and DIExpression operator for variadic debug values" 2021-03-05 12:32:05 +00:00
DynamicTags.def [llvm-readobj/elf] - AArch64: Handle AARCH64_VARIANT_PCS for GNUStyle 2020-12-17 11:09:53 -03:00
ELF.h AMDGPU/NFC: Replace EF_AMDGPU_MACH_AMDGCN_RESERVED_0X3E with EF_AMDGPU_MACH_AMDGCN_GFX1034 2021-05-18 15:11:50 -04:00
MachO.def
MachO.h [lld-macho] add code signature for native arm64 macOS 2021-02-24 17:05:23 -08:00
Magic.h
Minidump.h
MinidumpConstants.def
MsgPack.def
MsgPack.h
MsgPackDocument.h [docs] Fix doxygen comments wrongly attached to the llvm namespace 2021-04-07 01:20:18 +02:00
MsgPackReader.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
MsgPackWriter.h [llvm] Fix header guards (NFC) 2021-02-05 21:02:06 -08:00
Wasm.h [WebAssembly] Add TLS data segment flag: WASM_SEG_FLAG_TLS 2021-05-12 13:31:02 -07:00
WasmRelocs.def [WebAssembly] Fix PIC/GOT codegen for wasm64 2021-05-20 09:59:31 -07:00
WasmTraits.h
XCOFF.h [XCOFF][NFC] make csect properties optional for getXCOFFSection 2021-02-17 20:51:42 -05:00