This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[AArch64][6/6] LD support TLSLD load/store relocation types


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.

From c2a8808d45ccbe3767ef02ec7a251cc1ed06c2c1 Mon Sep 17 00:00:00 2001
From: Jiong Wang <jiong.wang@arm.com>
Date: Wed, 19 Aug 2015 11:26:56 +0100
Subject: [PATCH 6/6] 6

---
 bfd/elfnn-aarch64.c                                | 16 ++++++++++++++++
 bfd/elfxx-aarch64.c                                | 16 ++++++++++++++++
 ld/testsuite/ld-aarch64/aarch64-elf.exp            | 12 ++++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d |  4 ++++
 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s | 11 +++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-531.d          |  7 +++++++
 ld/testsuite/ld-aarch64/emit-relocs-531.s          | 10 ++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-532.d          |  9 +++++++++
 ld/testsuite/ld-aarch64/emit-relocs-532.s          | 17 +++++++++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d |  4 ++++
 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s | 11 +++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-533.d          |  7 +++++++
 ld/testsuite/ld-aarch64/emit-relocs-533.s          | 10 ++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-534.d          |  9 +++++++++
 ld/testsuite/ld-aarch64/emit-relocs-534.s          | 17 +++++++++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d |  4 ++++
 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s | 11 +++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-535.d          |  7 +++++++
 ld/testsuite/ld-aarch64/emit-relocs-535.s          | 10 ++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-536.d          |  9 +++++++++
 ld/testsuite/ld-aarch64/emit-relocs-536.s          | 17 +++++++++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d |  4 ++++
 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s | 11 +++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-537.d          |  7 +++++++
 ld/testsuite/ld-aarch64/emit-relocs-537.s          | 12 ++++++++++++
 ld/testsuite/ld-aarch64/emit-relocs-538.d          |  9 +++++++++
 ld/testsuite/ld-aarch64/emit-relocs-538.s          | 19 +++++++++++++++++++
 27 files changed, 280 insertions(+)
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-531.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-532.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-533.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-534.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-535.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-536.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-537.s
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.d
 create mode 100644 ld/testsuite/ld-aarch64/emit-relocs-538.s

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 375208c..8e56b27 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -180,6 +180,14 @@
    || (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:
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 82c6ec9..34bd1a6 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -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:
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index b8e801f..cbbe6a9 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -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
index 0000000..e22c7a4
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.d
@@ -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
index 0000000..812548a
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-531-overflow.s
@@ -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
index 0000000..588f127
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-531.d
@@ -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
index 0000000..2888cdd
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-531.s
@@ -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
index 0000000..f5f49b8
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-532.d
@@ -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
index 0000000..d8ef35f
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-532.s
@@ -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
index 0000000..528693b
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.d
@@ -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
index 0000000..9a9cbcc
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-533-overflow.s
@@ -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
index 0000000..09b3d11
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-533.d
@@ -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
index 0000000..9238ed2
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-533.s
@@ -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
index 0000000..e2fa478
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-534.d
@@ -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
index 0000000..4265046
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-534.s
@@ -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
index 0000000..882edf4
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.d
@@ -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
index 0000000..33e632f
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-535-overflow.s
@@ -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
index 0000000..32766bf
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-535.d
@@ -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
index 0000000..0b83a2a
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-535.s
@@ -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
index 0000000..862208a
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-536.d
@@ -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
index 0000000..cb7d3d8
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-536.s
@@ -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
index 0000000..3ad6b2a
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.d
@@ -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
index 0000000..a9903c3
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-537-overflow.s
@@ -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
index 0000000..82cc9bb
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-537.d
@@ -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
index 0000000..00f9de3
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-537.s
@@ -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
index 0000000..dffde23
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-538.d
@@ -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
index 0000000..4822dd3
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-538.s
@@ -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]
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]