]> Git Repo - binutils.git/commitdiff
[AArch64][8/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12
authorJiong Wang <[email protected]>
Tue, 11 Aug 2015 16:44:30 +0000 (17:44 +0100)
committerJiong Wang <[email protected]>
Tue, 11 Aug 2015 20:26:41 +0000 (21:26 +0100)
2015-08-11  Jiong Wang  <[email protected]>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
  BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
  (aarch64_reloc_got_type): Likewise.
  (elfNN_aarch64_final_link_relocate): Likewise.
  (elfNN_aarch64_relocate_section): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/emit-relocs-529.s: New testcase.
  * ld-aarch64/emit-relocs-529-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-86.s: Likewise.
  * ld-aarch64/emit-relocs-86-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-529.d: New expectation file.
  * ld-aarch64/emit-relocs-529-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-86.d: Likewise.
  * ld-aarch64/emit-relocs-86-overflow.d: Likewise.
  * ld-aarch64/aarch64-elf.exp: Run new testcases.

13 files changed:
bfd/ChangeLog
bfd/elfnn-aarch64.c
bfd/elfxx-aarch64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/emit-relocs-529-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-529-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-529.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-529.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-86-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-86-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-86.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-86.s [new file with mode: 0644]

index 61554a7f377999bda230709498eb43a06cf9fa06..97fffdd92a850739746c27d0f351286473411b42 100644 (file)
@@ -1,3 +1,13 @@
+2015-08-11  Jiong Wang  <[email protected]>
+
+       * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
+       BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
+       (aarch64_reloc_got_type): Likewise.
+       (elfNN_aarch64_final_link_relocate): Likewise.
+       (elfNN_aarch64_relocate_section): Likewise.
+       * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
+       (_bfd_aarch64_elf_resolve_relocation): Likewise.
+
 2015-08-11  Jiong Wang  <[email protected]>
 
        * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12): New entry.
index 80beda72fb249c6e63678925723e6a0304455713..c8ad42184fe59fa584b191f63ae3e59e4524ca8f 100644 (file)
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19   \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC  \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1     \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12      \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC          \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21           \
@@ -4174,6 +4175,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type)
     case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
       return GOT_TLS_IE;
 
+    case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
@@ -5078,6 +5080,12 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
       *unresolved_reloc_p = FALSE;
       break;
 
+    case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
+      value = _bfd_aarch64_elf_resolve_relocation (bfd_r_type, place, value,
+                                                  signed_addend - dtpoff_base (info),
+                                                  weak_undef_p);
+      break;
+
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
index 75f518d09d8b87215eb84f57f3932524c38ebf32..a8617739c0d025ac7985ad06cc69ea8474347196 100644 (file)
@@ -249,6 +249,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
     case BFD_RELOC_AARCH64_ADD_LO12:
     case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
@@ -398,6 +399,7 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type,
     case BFD_RELOC_AARCH64_MOVW_G2_NC:
     case BFD_RELOC_AARCH64_MOVW_G2_S:
     case BFD_RELOC_AARCH64_MOVW_G3:
+    case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
       value = value + addend;
       break;
 
index d6188663eb9e074b95fc5f64f43903c7a79d5b10..dae1cbb54daaa8e48251db766d0ef2e7ddc00fab 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-11  Jiong Wang  <[email protected]>
+
+       * ld-aarch64/emit-relocs-529.s: New testcase.
+       * ld-aarch64/emit-relocs-529-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-86.s: Likewise.
+       * ld-aarch64/emit-relocs-86-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-529.d: New expectation file.
+       * ld-aarch64/emit-relocs-529-overflow.d: Likewise.
+       * ld-aarch64/emit-relocs-86.d: Likewise.
+       * ld-aarch64/emit-relocs-86-overflow.d: Likewise.
+       * ld-aarch64/aarch64-elf.exp: Run new testcases.
+
 2015-08-11  Jiong Wang  <[email protected]>
 
        * ld-aarch64/tls-small-ld.s: Update testcase.
index 0c0661036d5c1356c257914f2ecff9fa091ea1d6..c8a8aae227e78dbe2bf6d69a6bbd3bfa14aeff44 100644 (file)
@@ -59,6 +59,8 @@ run_dump_test "erratum843419"
 # Relocation Tests
 run_dump_test "weak-undefined"
 run_dump_test "emit-relocs-28"
+run_dump_test "emit-relocs-86"
+run_dump_test "emit-relocs-86-overflow"
 run_dump_test "emit-relocs-257"
 run_dump_test "emit-relocs-257-be"
 # 258 is tested in 257
@@ -109,6 +111,8 @@ run_dump_test "emit-relocs-309-low-bad"
 run_dump_test "emit-relocs-311"
 run_dump_test "emit-relocs-312"
 run_dump_test "emit-relocs-313"
+run_dump_test "emit-relocs-529"
+run_dump_test "emit-relocs-529-overflow"
 
 # test addend correctness when --emit-relocs specified for non-relocatable obj.
 run_dump_test "emit-relocs-local-addend"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-529-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-529-overflow.d
new file mode 100644 (file)
index 0000000..6635905
--- /dev/null
@@ -0,0 +1,4 @@
+#source: emit-relocs-529-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_ADD_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-529-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-529-overflow.s
new file mode 100644 (file)
index 0000000..deddcbf
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       add     x20, x9, #:dtprel_lo12:v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-529.d b/ld/testsuite/ld-aarch64/emit-relocs-529.d
new file mode 100644 (file)
index 0000000..e2286e5
--- /dev/null
@@ -0,0 +1,7 @@
+#source: emit-relocs-529.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      91001134        add     x20, x9, #0x4
+                       10000: R_AARCH64_TLSLD_ADD_DTPREL_LO12  v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-529.s b/ld/testsuite/ld-aarch64/emit-relocs-529.s
new file mode 100644 (file)
index 0000000..ec84f57
--- /dev/null
@@ -0,0 +1,10 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+
+       .text
+       add     x20, x9, #:dtprel_lo12:v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-86-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-86-overflow.d
new file mode 100644 (file)
index 0000000..fb727b3
--- /dev/null
@@ -0,0 +1,5 @@
+#source: emit-relocs-86-overflow.s
+#as: -mabi=ilp32
+#ld: -m aarch64linux32 -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-86-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-86-overflow.s
new file mode 100644 (file)
index 0000000..945a66c
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       add     w20, w9, #:dtprel_lo12:v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-86.d b/ld/testsuite/ld-aarch64/emit-relocs-86.d
new file mode 100644 (file)
index 0000000..c0f5aca
--- /dev/null
@@ -0,0 +1,8 @@
+#source: emit-relocs-86.s
+#as: -mabi=ilp32
+#ld: -m aarch64linux32 -e0 --emit-relocs
+#objdump: -dr
+#...
+00400094 <.text>:
+  400094:      11001134        add     w20, w9, #0x4
+                       400094: R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12     v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-86.s b/ld/testsuite/ld-aarch64/emit-relocs-86.s
new file mode 100644 (file)
index 0000000..d56d864
--- /dev/null
@@ -0,0 +1,10 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+
+       .text
+       add     w20, w9, #:dtprel_lo12:v2
This page took 0.061828 seconds and 4 git commands to generate.