1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[ARC] Prepare the implementation of relocation for LLD

Reviewers: ruiu, kparzysz, petecoup, rafael

Reviewed By: kparzysz

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D37556

llvm-svn: 313109
This commit is contained in:
Leslie Zhai 2017-09-13 01:49:49 +00:00
parent 2279e85466
commit b9f9bb4784
5 changed files with 107 additions and 0 deletions

View File

@ -430,6 +430,27 @@ enum {
#include "ELFRelocs/ARM.def" #include "ELFRelocs/ARM.def"
}; };
// ARC Specific e_flags
enum : unsigned {
EF_ARC_MACH_MSK = 0x000000ff,
EF_ARC_OSABI_MSK = 0x00000f00,
E_ARC_MACH_ARC600 = 0x00000002,
E_ARC_MACH_ARC601 = 0x00000004,
E_ARC_MACH_ARC700 = 0x00000003,
EF_ARC_CPU_ARCV2EM = 0x00000005,
EF_ARC_CPU_ARCV2HS = 0x00000006,
E_ARC_OSABI_ORIG = 0x00000000,
E_ARC_OSABI_V2 = 0x00000200,
E_ARC_OSABI_V3 = 0x00000300,
E_ARC_OSABI_V4 = 0x00000400,
EF_ARC_PIC = 0x00000100
};
// ELF Relocation types for ARC
enum {
#include "ELFRelocs/ARC.def"
};
// AVR specific e_flags // AVR specific e_flags
enum : unsigned { enum : unsigned {
EF_AVR_ARCH_AVR1 = 1, EF_AVR_ARCH_AVR1 = 1,

View File

@ -0,0 +1,74 @@
#ifndef ELF_RELOC
#error "ELF_RELOC must be defined"
#endif
ELF_RELOC(R_ARC_NONE, 0)
ELF_RELOC(R_ARC_8, 1)
ELF_RELOC(R_ARC_16, 2)
ELF_RELOC(R_ARC_24, 3)
ELF_RELOC(R_ARC_32, 4)
ELF_RELOC(R_ARC_N8, 8)
ELF_RELOC(R_ARC_N16, 9)
ELF_RELOC(R_ARC_N24, 10)
ELF_RELOC(R_ARC_N32, 11)
ELF_RELOC(R_ARC_SDA, 12)
ELF_RELOC(R_ARC_SECTOFF, 13)
ELF_RELOC(R_ARC_S21H_PCREL, 14)
ELF_RELOC(R_ARC_S21W_PCREL, 15)
ELF_RELOC(R_ARC_S25H_PCREL, 16)
ELF_RELOC(R_ARC_S25W_PCREL, 17)
ELF_RELOC(R_ARC_SDA32, 18)
ELF_RELOC(R_ARC_SDA_LDST, 19)
ELF_RELOC(R_ARC_SDA_LDST1, 20)
ELF_RELOC(R_ARC_SDA_LDST2, 21)
ELF_RELOC(R_ARC_SDA16_LD, 22)
ELF_RELOC(R_ARC_SDA16_LD1, 23)
ELF_RELOC(R_ARC_SDA16_LD2, 24)
ELF_RELOC(R_ARC_S13_PCREL, 25)
ELF_RELOC(R_ARC_W, 26)
ELF_RELOC(R_ARC_32_ME, 27)
ELF_RELOC(R_ARC_32_ME_S, 105)
ELF_RELOC(R_ARC_N32_ME, 28)
ELF_RELOC(R_ARC_SECTOFF_ME, 29)
ELF_RELOC(R_ARC_SDA32_ME, 30)
ELF_RELOC(R_ARC_W_ME, 31)
ELF_RELOC(R_AC_SECTOFF_U8, 35)
ELF_RELOC(R_AC_SECTOFF_U8_1, 36)
ELF_RELOC(R_AC_SECTOFF_U8_2, 37)
ELF_RELOC(R_AC_SECTOFF_S9, 38)
ELF_RELOC(R_AC_SECTOFF_S9_1, 39)
ELF_RELOC(R_AC_SECTOFF_S9_2, 40)
ELF_RELOC(R_ARC_SECTOFF_ME_1, 41)
ELF_RELOC(R_ARC_SECTOFF_ME_2, 42)
ELF_RELOC(R_ARC_SECTOFF_1, 43)
ELF_RELOC(R_ARC_SECTOFF_2, 44)
ELF_RELOC(R_ARC_SDA_12, 45)
ELF_RELOC(R_ARC_SDA16_ST2, 48)
ELF_RELOC(R_ARC_32_PCREL, 49)
ELF_RELOC(R_ARC_PC32, 50)
ELF_RELOC(R_ARC_GOT32, 59)
ELF_RELOC(R_ARC_GOTPC32, 51)
ELF_RELOC(R_ARC_PLT32, 52)
ELF_RELOC(R_ARC_COPY, 53)
ELF_RELOC(R_ARC_GLOB_DAT, 54)
ELF_RELOC(R_ARC_JMP_SLOT, 55)
ELF_RELOC(R_ARC_RELATIVE, 56)
ELF_RELOC(R_ARC_GOTOFF, 57)
ELF_RELOC(R_ARC_GOTPC, 58)
ELF_RELOC(R_ARC_S21W_PCREL_PLT, 60)
ELF_RELOC(R_ARC_S25H_PCREL_PLT, 61)
ELF_RELOC(R_ARC_JLI_SECTOFF, 63)
ELF_RELOC(R_ARC_TLS_DTPMOD, 66)
ELF_RELOC(R_ARC_TLS_TPOFF, 68)
ELF_RELOC(R_ARC_TLS_GD_GOT, 69)
ELF_RELOC(R_ARC_TLS_GD_LD, 70)
ELF_RELOC(R_ARC_TLS_GD_CALL, 71)
ELF_RELOC(R_ARC_TLS_IE_GOT, 72)
ELF_RELOC(R_ARC_TLS_DTPOFF, 67)
ELF_RELOC(R_ARC_TLS_DTPOFF_S9, 73)
ELF_RELOC(R_ARC_TLS_LE_S9, 74)
ELF_RELOC(R_ARC_TLS_LE_32, 75)
ELF_RELOC(R_ARC_S25W_PCREL_PLT, 76)
ELF_RELOC(R_ARC_S21H_PCREL_PLT, 77)
ELF_RELOC(R_ARC_NPS_CMEM16, 78)

View File

@ -49,6 +49,7 @@ module LLVM_BinaryFormat {
textual header "BinaryFormat/ELFRelocs/AArch64.def" textual header "BinaryFormat/ELFRelocs/AArch64.def"
textual header "BinaryFormat/ELFRelocs/AMDGPU.def" textual header "BinaryFormat/ELFRelocs/AMDGPU.def"
textual header "BinaryFormat/ELFRelocs/ARM.def" textual header "BinaryFormat/ELFRelocs/ARM.def"
textual header "BinaryFormat/ELFRelocs/ARC.def"
textual header "BinaryFormat/ELFRelocs/AVR.def" textual header "BinaryFormat/ELFRelocs/AVR.def"
textual header "BinaryFormat/ELFRelocs/BPF.def" textual header "BinaryFormat/ELFRelocs/BPF.def"
textual header "BinaryFormat/ELFRelocs/Hexagon.def" textual header "BinaryFormat/ELFRelocs/Hexagon.def"

View File

@ -58,6 +58,14 @@ StringRef llvm::object::getELFRelocationTypeName(uint32_t Machine,
break; break;
} }
break; break;
case ELF::EM_ARC_COMPACT:
case ELF::EM_ARC_COMPACT2:
switch (Type) {
#include "llvm/BinaryFormat/ELFRelocs/ARC.def"
default:
break;
}
break;
case ELF::EM_AVR: case ELF::EM_AVR:
switch (Type) { switch (Type) {
#include "llvm/BinaryFormat/ELFRelocs/AVR.def" #include "llvm/BinaryFormat/ELFRelocs/AVR.def"

View File

@ -577,6 +577,9 @@ void ScalarEnumerationTraits<ELFYAML::ELF_REL>::enumeration(
case ELF::EM_ARM: case ELF::EM_ARM:
#include "llvm/BinaryFormat/ELFRelocs/ARM.def" #include "llvm/BinaryFormat/ELFRelocs/ARM.def"
break; break;
case ELF::EM_ARC:
#include "llvm/BinaryFormat/ELFRelocs/ARC.def"
break;
case ELF::EM_RISCV: case ELF::EM_RISCV:
#include "llvm/BinaryFormat/ELFRelocs/RISCV.def" #include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
break; break;