HardenedBSD/contrib/llvm/patches/patch-14-llvm-r215352-aarch64-dyn-loader.diff
2014-11-29 20:23:18 +00:00

138 lines
6.0 KiB
Diff

Pull in r215352 from upstream llvm trunk (by Tim Northover):
AArch64: add support for dynamic-loader relocations
LLD needs them, and it's good to be able to print them properly when
our object dumpers encounter them.
Patch by Daniel Stewart.
This is needed for supporting the upgrade to a newer LLDB snapshot.
Introduced here: http://svnweb.freebsd.org/changeset/base/275152
Index: test/tools/llvm-readobj/Inputs/relocs.obj.elf-aarch64
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/x-object
Index: test/tools/llvm-readobj/Inputs/relocs.py
===================================================================
--- test/tools/llvm-readobj/Inputs/relocs.py
+++ test/tools/llvm-readobj/Inputs/relocs.py
@@ -617,6 +617,8 @@ class Relocs_Elf_AArch64(Enum):
R_AARCH64_LDST32_ABS_LO12_NC = 0x11d
R_AARCH64_LDST64_ABS_LO12_NC = 0x11e
R_AARCH64_LDST128_ABS_LO12_NC = 0x12b
+ R_AARCH64_GOTREL64 = 0x133
+ R_AARCH64_GOTREL32 = 0x134
R_AARCH64_ADR_GOT_PAGE = 0x137
R_AARCH64_LD64_GOT_LO12_NC = 0x138
R_AARCH64_TLSLD_MOVW_DTPREL_G2 = 0x20b
@@ -660,6 +662,15 @@ class Relocs_Elf_AArch64(Enum):
R_AARCH64_TLSDESC_LD64_LO12_NC = 0x233
R_AARCH64_TLSDESC_ADD_LO12_NC = 0x234
R_AARCH64_TLSDESC_CALL = 0x239
+ R_AARCH64_COPY = 0x400
+ R_AARCH64_GLOB_DAT = 0x401
+ R_AARCH64_JUMP_SLOT = 0x402
+ R_AARCH64_RELATIVE = 0x403
+ R_AARCH64_TLS_DTPREL64 = 0x404
+ R_AARCH64_TLS_DTPMOD64 = 0x405
+ R_AARCH64_TLS_TPREL64 = 0x406
+ R_AARCH64_TLSDESC = 0x407
+ R_AARCH64_IRELATIVE = 0x408
class Relocs_Elf_ARM(Enum):
R_ARM_NONE = 0x00
Index: test/tools/llvm-readobj/reloc-types.test
===================================================================
--- test/tools/llvm-readobj/reloc-types.test
+++ test/tools/llvm-readobj/reloc-types.test
@@ -179,6 +179,8 @@ ELF-AARCH64: Type: R_AARCH64_LDST16_ABS_LO12_NC (2
ELF-AARCH64: Type: R_AARCH64_LDST32_ABS_LO12_NC (285)
ELF-AARCH64: Type: R_AARCH64_LDST64_ABS_LO12_NC (286)
ELF-AARCH64: Type: R_AARCH64_LDST128_ABS_LO12_NC (299)
+ELF-AARCH64: Type: R_AARCH64_GOTREL64 (307)
+ELF-AARCH64: Type: R_AARCH64_GOTREL32 (308)
ELF-AARCH64: Type: R_AARCH64_ADR_GOT_PAGE (311)
ELF-AARCH64: Type: R_AARCH64_LD64_GOT_LO12_NC (312)
ELF-AARCH64: Type: R_AARCH64_TLSLD_MOVW_DTPREL_G2 (523)
@@ -222,6 +224,15 @@ ELF-AARCH64: Type: R_AARCH64_TLSDESC_ADR_PAGE (562
ELF-AARCH64: Type: R_AARCH64_TLSDESC_LD64_LO12_NC (563)
ELF-AARCH64: Type: R_AARCH64_TLSDESC_ADD_LO12_NC (564)
ELF-AARCH64: Type: R_AARCH64_TLSDESC_CALL (569)
+ELF-AARCH64: Type: R_AARCH64_COPY (1024)
+ELF-AARCH64: Type: R_AARCH64_GLOB_DAT (1025)
+ELF-AARCH64: Type: R_AARCH64_JUMP_SLOT (1026)
+ELF-AARCH64: Type: R_AARCH64_RELATIVE (1027)
+ELF-AARCH64: Type: R_AARCH64_TLS_DTPREL64 (1028)
+ELF-AARCH64: Type: R_AARCH64_TLS_DTPMOD64 (1029)
+ELF-AARCH64: Type: R_AARCH64_TLS_TPREL64 (1030)
+ELF-AARCH64: Type: R_AARCH64_TLSDESC (1031)
+ELF-AARCH64: Type: R_AARCH64_IRELATIVE (1032)
ELF-ARM: Type: R_ARM_NONE (0)
ELF-ARM: Type: R_ARM_PC24 (1)
Index: include/llvm/Support/ELF.h
===================================================================
--- include/llvm/Support/ELF.h
+++ include/llvm/Support/ELF.h
@@ -653,6 +653,9 @@ enum {
R_AARCH64_LDST128_ABS_LO12_NC = 0x12b,
+ R_AARCH64_GOTREL64 = 0x133,
+ R_AARCH64_GOTREL32 = 0x134,
+
R_AARCH64_ADR_GOT_PAGE = 0x137,
R_AARCH64_LD64_GOT_LO12_NC = 0x138,
@@ -700,7 +703,17 @@ enum {
R_AARCH64_TLSDESC_LD64_LO12_NC = 0x233,
R_AARCH64_TLSDESC_ADD_LO12_NC = 0x234,
- R_AARCH64_TLSDESC_CALL = 0x239
+ R_AARCH64_TLSDESC_CALL = 0x239,
+
+ R_AARCH64_COPY = 0x400,
+ R_AARCH64_GLOB_DAT = 0x401,
+ R_AARCH64_JUMP_SLOT = 0x402,
+ R_AARCH64_RELATIVE = 0x403,
+ R_AARCH64_TLS_DTPREL64 = 0x404,
+ R_AARCH64_TLS_DTPMOD64 = 0x405,
+ R_AARCH64_TLS_TPREL64 = 0x406,
+ R_AARCH64_TLSDESC = 0x407,
+ R_AARCH64_IRELATIVE = 0x408
};
// ARM Specific e_flags
Index: lib/Object/ELF.cpp
===================================================================
--- lib/Object/ELF.cpp
+++ lib/Object/ELF.cpp
@@ -223,6 +223,8 @@ StringRef getELFRelocationTypeName(uint32_t Machin
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST32_ABS_LO12_NC);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST64_ABS_LO12_NC);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LDST128_ABS_LO12_NC);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GOTREL64);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GOTREL32);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_ADR_GOT_PAGE);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_LD64_GOT_LO12_NC);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSLD_MOVW_DTPREL_G2);
@@ -266,6 +268,15 @@ StringRef getELFRelocationTypeName(uint32_t Machin
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_LD64_LO12_NC);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_ADD_LO12_NC);
LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC_CALL);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_COPY);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_GLOB_DAT);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_JUMP_SLOT);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_RELATIVE);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_DTPREL64);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_DTPMOD64);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLS_TPREL64);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_TLSDESC);
+ LLVM_ELF_SWITCH_RELOC_TYPE_NAME(R_AARCH64_IRELATIVE);
default:
break;
}