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]

Testsuite question - fail due to EOF


Hi all, 

I'm trying to fix relaxation code for aarch64/ilp32, and as part of
this work I add new tests to the ld testsuite. Some of them are added
pretty well, but I have problem with 3 new tests.

Namely, test system reports EOF in objdump output, and so test fails.
I added 5 tests, 2 of them are OK and 3 has this weird problem. I
create tests by the same pattern, and I'm surprised that some of them
are working, and some not.

The log for one of failing test:

/home/yury/work/glibc-img/binutils.src/build/ld/../gas/as-new -mabi=ilp32  -o tmpdir/tls-relax-gd-le.o /home/yury/work/glibc-img/binutils.src/ld/testsuite/ld-aarch64/tls-relax-gd-le.s
Executing on host: sh -c
{/home/yury/work/glibc-img/binutils.src/build/ld/../gas/as-new -mabi=ilp32  -o tmpdir/tls-relax-gd-le.o /home/yury/work/glibc-img/binutils.src/ld/testsuite/ld-aarch64/tls-relax-gd-le.s 2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]^M
./ld-new -z norelro -L/home/yury/work/glibc-img/binutils.src/ld/testsuite/ld-aarch64  -m aarch64linux32 -T relocs-ilp32.ld -e0 -o tmpdir/dump tmpdir/tls-relax-gd-le.o 
Executing on host: sh -c {./ld-new -z norelro -L/home/yury/work/glibc-img/binutils.src/ld/testsuite/ld-aarch64  -m aarch64linux32 -T relocs-ilp32.ld -e0 -o tmpdir/dump tmpdir/tls-relax-gd-le.o  2>&1}  /dev/null ld.tmp (timeout = 300)
spawn [open ...]^M
/home/yury/work/glibc-img/binutils.src/build/ld/../binutils/objdump -dr tmpdir/dump > tmpdir/dump.out
Executing on host: sh -c {/home/yury/work/glibc-img/binutils.src/build/ld/../binutils/objdump -dr tmpdir/dump > tmpdir/dump.out 2>ld.tmp}  /dev/null  (timeout = 300)
spawn [open ...]^M
extra regexps in
/home/yury/work/glibc-img/binutils.src/ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d
starting with "^ +10000:        d2a00000        movz    x0, #0x0, lsl
#16$"
EOF from tmpdir/dump.out

If I repeat that commands manually, tmpdir/dump.out becomes not empty,
and contains correct objdump output. The patch that adds tests is attached.

(The working test is ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d)

Thanks in any advise.

Yury.

---
 bfd/elfnn-aarch64.c                                | 10 ++++--
 ld/testsuite/ld-aarch64/aarch64-elf.exp            |  6 +++-
 ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d      | 40 ++++++++++++++++++++++
 ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d    | 10 ++++++
 .../ld-aarch64/tls-relax-gdesc-le-2-ilp32.d        | 19 ++++++++++
 ld/testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d | 12 +++++++
 6 files changed, 94 insertions(+), 3 deletions(-)
 create mode 100644 ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d
 create mode 100644 ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d
 create mode 100644 ld/testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d
 create mode 100644 ld/testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d

diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 740970c..aa4f3bd 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5644,11 +5644,17 @@ elfNN_aarch64_tls_relax (struct elf_aarch64_link_hash_table *globals,
       if (is_local)
 	{
 	  /* GD->LE relaxation:
-	     adrp x0, :tlsgd:var     =>   movz x0, :tprel_g1:var
+	     adrp x0, :tlsgd:var     =>   movz R0, :tprel_g1:var
 	     or
-	     adrp x0, :tlsdesc:var   =>   movz x0, :tprel_g1:var
+	     adrp x0, :tlsdesc:var   =>   movz R0, :tprel_g1:var
+
+	     Where R is x for LP64, and x for ilp32
 	   */
+#if ARCH_SIZE == 64
 	  bfd_putl32 (0xd2a00000, contents + rel->r_offset);
+#else
+	  bfd_putl32 (0x52a00000, contents + rel->r_offset);
+#endif
 	  return bfd_reloc_continue;
 	}
       else
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 6d1f87b..83bb7b0 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -187,10 +187,13 @@ run_dump_test "farcall-b-section"
 run_dump_test "farcall-bl-section"
 
 run_dump_test "tls-relax-all"
+run_dump_test "tls-relax-all-ilp32"
 run_dump_test "tls-relax-gd-le"
+run_dump_test "tls-relax-gd-le-ilp32"
 run_dump_test "tls-relax-gdesc-le"
-run_dump_test "tls-relax-gd-ie-ilp32"
+run_dump_test "tls-relax-gdesc-le-ilp32"
 run_dump_test "tls-relax-gd-ie"
+run_dump_test "tls-relax-gd-ie-ilp32"
 run_dump_test "tls-relax-large-gd-ie"
 run_dump_test "tls-relax-large-gd-ie-be"
 run_dump_test "tls-relax-large-gd-le"
@@ -206,6 +209,7 @@ run_dump_test "tls-relax-ld-le-tiny"
 run_dump_test "tls-desc-ie"
 run_dump_test "tls-relax-gdesc-ie-2"
 run_dump_test "tls-relax-gdesc-le-2"
+run_dump_test "tls-relax-gdesc-le-2-ilp32"
 run_dump_test "tls-relax-ie-le-2"
 run_dump_test "tls-relax-ie-le-3"
 run_dump_test "tls-tiny-gd"
diff --git a/ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d b/ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d
new file mode 100644
index 0000000..e602bf4
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tls-relax-all-ilp32.d
@@ -0,0 +1,40 @@
+#source: tls-relax-all.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld -e0
+#objdump: -dr
+#...
+ +10000:	a9bf7bfd 	stp	x29, x30, \[sp, #-16\]!
+ +10004:	910003fd 	mov	x29, sp
+ +10008:	90000080 	adrp	x0, 20000 <_GLOBAL_OFFSET_TABLE_>
+ +1000c:	f9400400 	ldr	x0, \[x0, #8\]
+ +10010:	d503201f 	nop
+ +10014:	d503201f 	nop
+ +10018:	d53bd041 	mrs	x1, tpidr_el0
+ +1001c:	8b000020 	add	x0, x1, x0
+ +10020:	b9400001 	ldr	w1, \[x0\]
+ +10024:	52a00000 	movz	w0, #0x0, lsl #16
+ +10028:	f2800180 	movk	x0, #0xc
+ +1002c:	d503201f 	nop
+ +10030:	d503201f 	nop
+ +10034:	d53bd042 	mrs	x2, tpidr_el0
+ +10038:	8b000040 	add	x0, x2, x0
+ +1003c:	b9400000 	ldr	w0, \[x0\]
+ +10040:	0b000021 	add	w1, w1, w0
+ +10044:	90000080 	adrp	x0, 20000 <_GLOBAL_OFFSET_TABLE_>
+ +10048:	b9400800 	ldr	w0, \[x0, #8\]
+ +1004c:	d53bd041 	mrs	x1, tpidr_el0
+ +10050:	0b000020 	add	w0, w1, w0
+ +10054:	b9400000 	ldr	w0, \[x0\]
+ +10058:	0b000021 	add	w1, w1, w0
+ +1005c:	52a00000 	movz	w0, #0x0, lsl #16
+ +10060:	f2800280 	movk	x0, #0x14
+ +10064:	d53bd041 	mrs	x1, tpidr_el0
+ +10068:	8b000020 	add	x0, x1, x0
+ +1006c:	b9400000 	ldr	w0, \[x0\]
+ +10070:	0b000021 	add	w1, w1, w0
+ +10074:	d53bd042 	mrs	x2, tpidr_el0
+ +10078:	d2a00000 	movz	x0, #0x0, lsl #16
+ +1007c:	f2800300 	movk	x0, #0x18
+ +10080:	8b000040 	add	x0, x2, x0
+ +10084:	b9400000 	ldr	w0, \[x0\]
+ +10088:	0b000020 	add	w0, w1, w0
diff --git a/ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d b/ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d
new file mode 100644
index 0000000..0a6d49a
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d
@@ -0,0 +1,10 @@
+#source: tls-relax-gd-le.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld -e0
+#objdump: -dr
+#...
+ +10000:	d2a00000 	movz	x0, #0x0, lsl #16
+ +10004:	f2800200 	movk	x0, #0x10
+ +10008:	d53bd041 	mrs	x1, tpidr_el0
+ +1000c:	8b000020 	add	x0, x1, x0
+ +10010:	b9400000 	ldr	w0, \[x0\]
diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d
new file mode 100644
index 0000000..04b0c0c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d
@@ -0,0 +1,19 @@
+#source: tls-relax-gdesc-le-2.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld -e0
+#objdump: -dr
+#...
+ +10000:	d2a00000 	movz	x0, #0x0, lsl #16
+ +10004:	d503201f 	nop
+ +10008:	d503201f 	nop
+ +1000c:	f2800200 	movk	x0, #0x10
+ +10010:	d503201f 	nop
+ +10014:	d503201f 	nop
+ +10018:	d503201f 	nop
+ +1001c:	d503201f 	nop
+ +10020:	d503201f 	nop
+ +10024:	d503201f 	nop
+ +10028:	d503201f 	nop
+ +1002c:	d53bd041 	mrs	x1, tpidr_el0
+ +10030:	8b000020 	add	x0, x1, x0
+ +10034:	b9400000 	ldr	w0, \[x0\]
diff --git a/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d
new file mode 100644
index 0000000..9c90813
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d
@@ -0,0 +1,12 @@
+#source: tls-relax-gdesc-le.s
+#as: -mabi=ilp32
+#ld: -m [aarch64_choose_ilp32_emul] -T relocs-ilp32.ld -e0
+#objdump: -dr
+#...
+ +10000:	d2a00000 	movz	x0, #0x0, lsl #16
+ +10004:	f2800200 	movk	x0, #0x10
+ +10008:	d503201f 	nop
+ +1000c:	d503201f 	nop
+ +10010:	d53bd041 	mrs	x1, tpidr_el0
+ +10014:	8b000020 	add	x0, x1, x0
+ +10018:	b9400000 	ldr	w0, \[x0\]
-- 
2.7.4


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