[llvm] r313109 - [ARC] Prepare the implementation of relocation for LLD
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 12 18:52:26 PDT 2017
Tests?
On Tue, Sep 12, 2017 at 6:49 PM, Leslie Zhai via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: xiangzhai
> Date: Tue Sep 12 18:49:49 2017
> New Revision: 313109
>
> URL: http://llvm.org/viewvc/llvm-project?rev=313109&view=rev
> Log:
> [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
>
> Added:
> llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARC.def
> Modified:
> llvm/trunk/include/llvm/BinaryFormat/ELF.h
> llvm/trunk/include/llvm/module.modulemap
> llvm/trunk/lib/Object/ELF.cpp
> llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
>
> Modified: llvm/trunk/include/llvm/BinaryFormat/ELF.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=313109&r1=313108&r2=313109&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/BinaryFormat/ELF.h (original)
> +++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Tue Sep 12 18:49:49 2017
> @@ -430,6 +430,27 @@ enum {
> #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
> enum : unsigned {
> EF_AVR_ARCH_AVR1 = 1,
>
> Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARC.def
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARC.def?rev=313109&view=auto
> ==============================================================================
> --- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARC.def (added)
> +++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARC.def Tue Sep 12 18:49:49 2017
> @@ -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)
>
> Modified: llvm/trunk/include/llvm/module.modulemap
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/module.modulemap?rev=313109&r1=313108&r2=313109&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/module.modulemap (original)
> +++ llvm/trunk/include/llvm/module.modulemap Tue Sep 12 18:49:49 2017
> @@ -49,6 +49,7 @@ module LLVM_BinaryFormat {
> textual header "BinaryFormat/ELFRelocs/AArch64.def"
> textual header "BinaryFormat/ELFRelocs/AMDGPU.def"
> textual header "BinaryFormat/ELFRelocs/ARM.def"
> + textual header "BinaryFormat/ELFRelocs/ARC.def"
> textual header "BinaryFormat/ELFRelocs/AVR.def"
> textual header "BinaryFormat/ELFRelocs/BPF.def"
> textual header "BinaryFormat/ELFRelocs/Hexagon.def"
>
> Modified: llvm/trunk/lib/Object/ELF.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELF.cpp?rev=313109&r1=313108&r2=313109&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Object/ELF.cpp (original)
> +++ llvm/trunk/lib/Object/ELF.cpp Tue Sep 12 18:49:49 2017
> @@ -58,6 +58,14 @@ StringRef llvm::object::getELFRelocation
> 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:
> switch (Type) {
> #include "llvm/BinaryFormat/ELFRelocs/AVR.def"
>
> Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=313109&r1=313108&r2=313109&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
> +++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Tue Sep 12 18:49:49 2017
> @@ -577,6 +577,9 @@ void ScalarEnumerationTraits<ELFYAML::EL
> case ELF::EM_ARM:
> #include "llvm/BinaryFormat/ELFRelocs/ARM.def"
> break;
> + case ELF::EM_ARC:
> +#include "llvm/BinaryFormat/ELFRelocs/ARC.def"
> + break;
> case ELF::EM_RISCV:
> #include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
> break;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
--
Davide
"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
More information about the llvm-commits
mailing list