[AArch64][6/6] LD support TLSLD load/store relocation types
authorJiong Wang <jiong.wang@arm.com>
Wed, 19 Aug 2015 10:26:56 +0000 (11:26 +0100)
committerJiong Wang <jiong.wang@arm.com>
Wed, 19 Aug 2015 15:57:38 +0000 (16:57 +0100)
2015-08-19  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
  types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
  BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
  BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
  BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
  BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
  BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
  BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
  BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC.
  (elfNN_aarch64_final_link_relocate): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/emit-relocs-531.s: New testcase.
  * ld-aarch64/emit-relocs-531-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-532.s: Likewise.
  * ld-aarch64/emit-relocs-533.s: Likewise.
  * ld-aarch64/emit-relocs-533-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-534.s: Likewise.
  * ld-aarch64/emit-relocs-535.s: Likewise.
  * ld-aarch64/emit-relocs-535-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-536.s: Likewise.
  * ld-aarch64/emit-relocs-537.s: Likewise.
  * ld-aarch64/emit-relocs-537-overflow.s: Likewise.
  * ld-aarch64/emit-relocs-538.s: Likewise.
  * ld-aarch64/emit-relocs-531.d: New expectation file.
  * ld-aarch64/emit-relocs-531-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-532.d: Likewise.
  * ld-aarch64/emit-relocs-533.d: Likewise.
  * ld-aarch64/emit-relocs-533-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-534.d: Likewise.
  * ld-aarch64/emit-relocs-535.d: Likewise.
  * ld-aarch64/emit-relocs-535-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-536.d: Likewise.
  * ld-aarch64/emit-relocs-537.d: Likewise.
  * ld-aarch64/emit-relocs-537-overflow.d: Likewise.
  * ld-aarch64/emit-relocs-538.d: Likewise.
  * ld-aarch64/aarch64-elf.exp: Run new testcases.

29 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-531-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-531.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-531.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-532.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-532.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-533.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-533.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-534.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-534.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-535.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-535.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-536.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-536.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-537.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-537.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-538.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-538.s [new file with mode: 0644]

index 4edf56d95dd56fb34e6db8af8c5254b0f1f9329e..dcd0e88b65e798c4395b1c77e24471561d9dab3d 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-19  Jiong Wang  <jiong.wang@arm.com>
+
+       * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
+       types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
+       BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
+       BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
+       BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
+       BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
+       BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
+       BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
+       BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC.
+       (elfNN_aarch64_final_link_relocate): Likewise.
+       * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
+       (_bfd_aarch64_elf_resolve_relocation): Likewise.
+
 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
 
        * reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
index 083bb0fdab274e20f15cff1e6eb3c73e151d2a8f..9935308bee774e4b8249141f5e74d2878eb02ed7 100644 (file)
    || (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           \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12   \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC        \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12   \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC        \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12   \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC        \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12    \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0       \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC    \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1       \
@@ -5312,6 +5320,14 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
index 82c6ec9fcb97a7abc97021364bdc88790ded89f1..34bd1a690226690d6ad58668b8c56fb0821daed7 100644 (file)
@@ -276,6 +276,14 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
     case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC:
     case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
       if (old_addend & ((1 << howto->rightshift) - 1))
        return bfd_reloc_overflow;
       /* Used for ldr*|str* rt, [rn, #uimm12] to provide the low order
@@ -409,6 +417,14 @@ _bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type,
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
+    case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
index d838cac8002b11a6101d2938f701ffb5c721b2a5..dbf7358aa7fc16921bce562cdaab3100ce37bb83 100644 (file)
@@ -1,3 +1,31 @@
+2015-08-19  Jiong Wang  <jiong.wang@arm.com>
+
+       * ld-aarch64/emit-relocs-531.s: New testcase.
+       * ld-aarch64/emit-relocs-531-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-532.s: Likewise.
+       * ld-aarch64/emit-relocs-533.s: Likewise.
+       * ld-aarch64/emit-relocs-533-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-534.s: Likewise.
+       * ld-aarch64/emit-relocs-535.s: Likewise.
+       * ld-aarch64/emit-relocs-535-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-536.s: Likewise.
+       * ld-aarch64/emit-relocs-537.s: Likewise.
+       * ld-aarch64/emit-relocs-537-overflow.s: Likewise.
+       * ld-aarch64/emit-relocs-538.s: Likewise.
+       * ld-aarch64/emit-relocs-531.d: New expectation file.
+       * ld-aarch64/emit-relocs-531-overflow.d: Likewise.
+       * ld-aarch64/emit-relocs-532.d: Likewise.
+       * ld-aarch64/emit-relocs-533.d: Likewise.
+       * ld-aarch64/emit-relocs-533-overflow.d: Likewise.
+       * ld-aarch64/emit-relocs-534.d: Likewise.
+       * ld-aarch64/emit-relocs-535.d: Likewise.
+       * ld-aarch64/emit-relocs-535-overflow.d: Likewise.
+       * ld-aarch64/emit-relocs-536.d: Likewise.
+       * ld-aarch64/emit-relocs-537.d: Likewise.
+       * ld-aarch64/emit-relocs-537-overflow.d: Likewise.
+       * ld-aarch64/emit-relocs-538.d: Likewise.
+       * ld-aarch64/aarch64-elf.exp: Run new testcases.
+
 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
 
        * ld-aarch64/emit-relocs-87.s: New testcase.
index b8e801f550aa40dd737d2893fd649abbc7fe07a1..cbbe6a914776bd8c6049318f64dd7b40ad0c5ebf 100644 (file)
@@ -136,6 +136,18 @@ run_dump_test "emit-relocs-528-overflow"
 run_dump_test "emit-relocs-529"
 run_dump_test "emit-relocs-529-overflow"
 run_dump_test "emit-relocs-530"
+run_dump_test "emit-relocs-531"
+run_dump_test "emit-relocs-531-overflow"
+run_dump_test "emit-relocs-532"
+run_dump_test "emit-relocs-533"
+run_dump_test "emit-relocs-533-overflow"
+run_dump_test "emit-relocs-534"
+run_dump_test "emit-relocs-535"
+run_dump_test "emit-relocs-535-overflow"
+run_dump_test "emit-relocs-536"
+run_dump_test "emit-relocs-537"
+run_dump_test "emit-relocs-537-overflow"
+run_dump_test "emit-relocs-538"
 
 # 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-531-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d
new file mode 100644 (file)
index 0000000..e22c7a4
--- /dev/null
@@ -0,0 +1,4 @@
+#source: emit-relocs-531-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST8_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s
new file mode 100644 (file)
index 0000000..812548a
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsb   x22, [x1, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531.d b/ld/testsuite/ld-aarch64/emit-relocs-531.d
new file mode 100644 (file)
index 0000000..588f127
--- /dev/null
@@ -0,0 +1,7 @@
+#source: emit-relocs-531.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      39801115        ldrsb   x21, \[x8,#4\]
+                       10000: R_AARCH64_TLSLD_LDST8_DTPREL_LO12        v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-531.s b/ld/testsuite/ld-aarch64/emit-relocs-531.s
new file mode 100644 (file)
index 0000000..2888cdd
--- /dev/null
@@ -0,0 +1,10 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsb   x21, [x8, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-532.d b/ld/testsuite/ld-aarch64/emit-relocs-532.d
new file mode 100644 (file)
index 0000000..f5f49b8
--- /dev/null
@@ -0,0 +1,9 @@
+#source: emit-relocs-532.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      3980109d        ldrsb   x29, \[x4,#4\]
+                       10000: R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC     v2
+   10004:      398020f2        ldrsb   x18, \[x7,#8\]
+                       10004: R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC     v3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-532.s b/ld/testsuite/ld-aarch64/emit-relocs-532.s
new file mode 100644 (file)
index 0000000..d8ef35f
--- /dev/null
@@ -0,0 +1,17 @@
+       .global v1
+       .global v2
+       .size   v2, 4100
+       .global v3
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .zero   4100
+v3:
+       .word   0xcafecafe
+
+       .text
+       ldrsb   x29, [x4, #:dtprel_lo12_nc:v2]
+
+       # should not issue overflow error.
+       ldrsb   x18, [x7, #:dtprel_lo12_nc:v3]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d
new file mode 100644 (file)
index 0000000..528693b
--- /dev/null
@@ -0,0 +1,4 @@
+#source: emit-relocs-533-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST16_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s
new file mode 100644 (file)
index 0000000..9a9cbcc
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsh   x2, [x17, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533.d b/ld/testsuite/ld-aarch64/emit-relocs-533.d
new file mode 100644 (file)
index 0000000..09b3d11
--- /dev/null
@@ -0,0 +1,7 @@
+#source: emit-relocs-533.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      798008eb        ldrsh   x11, \[x7,#4\]
+                       10000: R_AARCH64_TLSLD_LDST16_DTPREL_LO12       v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-533.s b/ld/testsuite/ld-aarch64/emit-relocs-533.s
new file mode 100644 (file)
index 0000000..9238ed2
--- /dev/null
@@ -0,0 +1,10 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsh   x11, [x7, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-534.d b/ld/testsuite/ld-aarch64/emit-relocs-534.d
new file mode 100644 (file)
index 0000000..e2fa478
--- /dev/null
@@ -0,0 +1,9 @@
+#source: emit-relocs-534.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      798009d6        ldrsh   x22, \[x14,#4\]
+                       10000: R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC    v2
+   10004:      79a71a28        ldrsh   x8, \[x17,#5004\]
+                       10004: R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC    v3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-534.s b/ld/testsuite/ld-aarch64/emit-relocs-534.s
new file mode 100644 (file)
index 0000000..4265046
--- /dev/null
@@ -0,0 +1,17 @@
+       .global v1
+       .global v2
+       .size   v2, 5000
+       .global v3
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .zero   5000
+v3:
+       .word   0xcafecafe
+
+       .text
+       ldrsh   x22, [x14, #:dtprel_lo12_nc:v2]
+
+       # should not issue overflow error.
+       ldrsh   x8, [x17, #:dtprel_lo12_nc:v3]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d
new file mode 100644 (file)
index 0000000..882edf4
--- /dev/null
@@ -0,0 +1,4 @@
+#source: emit-relocs-535-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST32_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s
new file mode 100644 (file)
index 0000000..33e632f
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsw  x2, [x17, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535.d b/ld/testsuite/ld-aarch64/emit-relocs-535.d
new file mode 100644 (file)
index 0000000..32766bf
--- /dev/null
@@ -0,0 +1,7 @@
+#source: emit-relocs-535.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      b9800661        ldrsw   x1, \[x19,#4\]
+                       10000: R_AARCH64_TLSLD_LDST32_DTPREL_LO12       v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-535.s b/ld/testsuite/ld-aarch64/emit-relocs-535.s
new file mode 100644 (file)
index 0000000..0b83a2a
--- /dev/null
@@ -0,0 +1,10 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldrsw   x1, [x19, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-536.d b/ld/testsuite/ld-aarch64/emit-relocs-536.d
new file mode 100644 (file)
index 0000000..862208a
--- /dev/null
@@ -0,0 +1,9 @@
+#source: emit-relocs-536.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      b98005d6        ldrsw   x22, \[x14,#4\]
+                       10000: R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC    v2
+   10004:      b9800628        ldrsw   x8, \[x17,#4\]
+                       10004: R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC    v3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-536.s b/ld/testsuite/ld-aarch64/emit-relocs-536.s
new file mode 100644 (file)
index 0000000..cb7d3d8
--- /dev/null
@@ -0,0 +1,17 @@
+       .global v1
+       .global v2
+       .size   v2, 16384
+       .global v3
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+v2:
+       .zero   16384
+v3:
+       .word   0xcafecafe
+
+       .text
+       ldrsw   x22, [x14, #:dtprel_lo12_nc:v2]
+
+       # should not issue overflow error.
+       ldrsw   x8, [x17, #:dtprel_lo12_nc:v3]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d
new file mode 100644 (file)
index 0000000..3ad6b2a
--- /dev/null
@@ -0,0 +1,4 @@
+#source: emit-relocs-537-overflow.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#error: .*\(.text\+0x\d+\): relocation truncated to fit: R_AARCH64_TLSLD_LDST64_DTPREL_LO12 against symbol `v2' .*
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s
new file mode 100644 (file)
index 0000000..a9903c3
--- /dev/null
@@ -0,0 +1,11 @@
+       .global v1
+       .size   v1, 4096
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .zero   4096
+v2:
+       .word   0xcafecafe
+
+       .text
+       ldr     x12, [x13, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537.d b/ld/testsuite/ld-aarch64/emit-relocs-537.d
new file mode 100644 (file)
index 0000000..82cc9bb
--- /dev/null
@@ -0,0 +1,7 @@
+#source: emit-relocs-537.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      f9400520        ldr     x0, \[x9,#8\]
+                       10000: R_AARCH64_TLSLD_LDST64_DTPREL_LO12       v2
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-537.s b/ld/testsuite/ld-aarch64/emit-relocs-537.s
new file mode 100644 (file)
index 0000000..00f9de3
--- /dev/null
@@ -0,0 +1,12 @@
+       .global v1
+       .global v2
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+       .word   0xdeaddead
+v2:
+       .word   0xcafecafe
+       .word   0xcafecafe
+
+       .text
+       ldr     x0, [x9, #:dtprel_lo12:v2]
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-538.d b/ld/testsuite/ld-aarch64/emit-relocs-538.d
new file mode 100644 (file)
index 0000000..dffde23
--- /dev/null
@@ -0,0 +1,9 @@
+#source: emit-relocs-538.s
+#ld: -T relocs.ld -e0 --emit-relocs
+#objdump: -dr
+#...
+0000000000010000 <.text>:
+   10000:      f9400482        ldr     x2, \[x4,#8\]
+                       10000: R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC    v2
+   10004:      f940062e        ldr     x14, \[x17,#8\]
+                       10004: R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC    v3
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-538.s b/ld/testsuite/ld-aarch64/emit-relocs-538.s
new file mode 100644 (file)
index 0000000..4822dd3
--- /dev/null
@@ -0,0 +1,19 @@
+       .global v1
+       .global v2
+       .size   v2, 32768
+       .global v3
+       .section        .tdata,"awT",%progbits
+v1:
+       .word   0xdeaddead
+       .word   0xdeaddead
+v2:
+       .zero   32768
+v3:
+       .word   0xcafecafe
+       .word   0xcafecafe
+
+       .text
+       ldr     x2, [x4, #:dtprel_lo12_nc:v2]
+
+       # should not issue overflow error.
+       ldr     x14, [x17, #:dtprel_lo12_nc:v3]
This page took 0.037658 seconds and 4 git commands to generate.