aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-12-12 11:58:50 -0800
committerH.J. Lu <hjl.tools@gmail.com>2019-12-12 12:03:45 -0800
commit8493b6651af3d2130d5f5f050905cd3d6e8a9c27 (patch)
tree8cde2b4c28190828a65d46ffa34a7cc5debd7c8e /ld
parent76cf450b4ce818b298451619e80e041e6eb4ec24 (diff)
downloadgdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.zip
gdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.tar.gz
gdb-8493b6651af3d2130d5f5f050905cd3d6e8a9c27.tar.bz2
i386: Add tests for -malign-branch-boundary and -malign-branch
Add tests for -malign-branch-boundary, -malign-branch and -mbranches-within-32B-boundaries. gas/ * testsuite/gas/i386/align-branch-1.s: New file. * testsuite/gas/i386/align-branch-1a.d: Likewise. * testsuite/gas/i386/align-branch-1b.d: Likewise. * testsuite/gas/i386/align-branch-1c.d: Likewise. * testsuite/gas/i386/align-branch-1d.d: Likewise. * testsuite/gas/i386/align-branch-1e.d: Likewise. * testsuite/gas/i386/align-branch-1f.d: Likewise. * testsuite/gas/i386/align-branch-1g.d: Likewise. * testsuite/gas/i386/align-branch-1h.d: Likewise. * testsuite/gas/i386/align-branch-2.s: Likewise. * testsuite/gas/i386/align-branch-2a.d: Likewise. * testsuite/gas/i386/align-branch-2b.d: Likewise. * testsuite/gas/i386/align-branch-2c.d: Likewise. * testsuite/gas/i386/align-branch-3.d: Likewise. * testsuite/gas/i386/align-branch-3.s: Likewise. * testsuite/gas/i386/align-branch-4.s: Likewise. * testsuite/gas/i386/align-branch-4a.d: Likewise. * testsuite/gas/i386/align-branch-4b.d: Likewise. * testsuite/gas/i386/align-branch-5.d: Likewise. * testsuite/gas/i386/align-branch-5.s: Likewise. * testsuite/gas/i386/align-branch-6.d: Likewise. * testsuite/gas/i386/align-branch-6.s: Likewise. * testsuite/gas/i386/align-branch-7.d: Likewise. * testsuite/gas/i386/align-branch-7.s: Likewise. * testsuite/gas/i386/align-branch-8.d: Likewise. * testsuite/gas/i386/align-branch-8.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-1.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1e.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1f.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-1h.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-2a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-3.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-3.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-4.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-4a.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-4b.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-5.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-6.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-7.s: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.d: Likewise. * testsuite/gas/i386/x86-64-align-branch-8.s: Likewise. * testsuite/gas/i386/i386.exp: Run new tests. ld/ * testsuite/ld-i386/align-branch-1.d: New file. * testsuite/ld-i386/align-branch-1.s: Likewise. * testsuite/ld-x86-64/align-branch-1.d: Likewise. * testsuite/ld-x86-64/align-branch-1.3: Likewise. * testsuite/ld-i386/i386.exp: Run the new test. * testsuite/ld-x86-64/x86-64.exp: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/testsuite/ld-i386/align-branch-1.d25
-rw-r--r--ld/testsuite/ld-i386/align-branch-1.s19
-rw-r--r--ld/testsuite/ld-i386/i386.exp1
-rw-r--r--ld/testsuite/ld-x86-64/align-branch-1.d21
-rw-r--r--ld/testsuite/ld-x86-64/align-branch-1.s17
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp1
7 files changed, 93 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index a704214..4b7e746 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2019-12-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-i386/align-branch-1.d: New file.
+ * testsuite/ld-i386/align-branch-1.s: Likewise.
+ * testsuite/ld-x86-64/align-branch-1.d: Likewise.
+ * testsuite/ld-x86-64/align-branch-1.3: Likewise.
+ * testsuite/ld-i386/i386.exp: Run the new test.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
2019-12-08 Alan Modra <amodra@gmail.com>
* testsuite/ld-elf/eh4.d: Match optional padding DW_CFA_nop in FDEs.
diff --git a/ld/testsuite/ld-i386/align-branch-1.d b/ld/testsuite/ld-i386/align-branch-1.d
new file mode 100644
index 0000000..9eb7287
--- /dev/null
+++ b/ld/testsuite/ld-i386/align-branch-1.d
@@ -0,0 +1,25 @@
+#as: --32 -mbranches-within-32B-boundaries
+#ld: -melf_i386
+#objdump: -dw
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 20 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 1c je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 85 ff test %edi,%edi
+ +[a-f0-9]+: 74 18 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: 65 a1 00 00 00 00 mov %gs:0x0,%eax
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: 8d 74 26 00 lea 0x0\(%esi,%eiz,1\),%esi
+ +[a-f0-9]+: 3e 3e 3e 8b 90 fc ff ff ff ds ds mov %ds:-0x4\(%eax\),%edx
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 00 je 8049024 <_start\+0x24>
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/align-branch-1.s b/ld/testsuite/ld-i386/align-branch-1.s
new file mode 100644
index 0000000..48edffb
--- /dev/null
+++ b/ld/testsuite/ld-i386/align-branch-1.s
@@ -0,0 +1,19 @@
+ .text
+ .globl _start
+_start:
+ testl %edx, %edx
+ je .L1
+ testl %edx, %edx
+ je .L1
+ testl %edi, %edi
+ je .L1
+ leal bar@tlsldm(%ebx), %eax
+ call ___tls_get_addr@PLT
+ movl bar@dtpoff(%eax), %edx
+ testl %edx, %edx
+ je .L1
+.L1:
+ ret
+ .section ".tdata", "awT", @progbits
+bar:
+ .long 10
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 3a1fd8b..8fe047b 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -495,6 +495,7 @@ run_dump_test "pr23854"
run_dump_test "pr23930"
run_dump_test "pr24322a"
run_dump_test "pr24322b"
+run_dump_test "align-branch-1"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-x86-64/align-branch-1.d b/ld/testsuite/ld-x86-64/align-branch-1.d
new file mode 100644
index 0000000..8567912
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/align-branch-1.d
@@ -0,0 +1,21 @@
+#as: --64 -mbranches-within-32B-boundaries
+#ld: -melf_x86_64
+#objdump: -dw
+#notarget: i?86-*-nacl* x86_64-*-nacl*
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+ +[a-f0-9]+: 85 d2 test %edx,%edx
+ +[a-f0-9]+: 74 21 je 401025 <_start\+0x25>
+ +[a-f0-9]+: 48 85 ff test %rdi,%rdi
+ +[a-f0-9]+: 74 1c je 401025 <_start\+0x25>
+ +[a-f0-9]+: 66 66 66 64 48 8b 04 25 00 00 00 00 data16 data16 data16 mov %fs:0x0,%rax
+ +[a-f0-9]+: 2e 2e 2e 2e 48 8b 98 fc ff ff ff cs cs cs mov %cs:-0x4\(%rax\),%rbx
+ +[a-f0-9]+: 48 85 db test %rbx,%rbx
+ +[a-f0-9]+: 74 00 je 401025 <_start\+0x25>
+ +[a-f0-9]+: c3 retq
+#pass
diff --git a/ld/testsuite/ld-x86-64/align-branch-1.s b/ld/testsuite/ld-x86-64/align-branch-1.s
new file mode 100644
index 0000000..5c60a37
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/align-branch-1.s
@@ -0,0 +1,17 @@
+ .text
+ .globl _start
+_start:
+ testl %edx, %edx
+ je .L1
+ testq %rdi, %rdi
+ je .L1
+ leaq bar@tlsld(%rip), %rdi
+ call __tls_get_addr@PLT
+ movq bar@dtpoff(%rax), %rbx
+ testq %rbx, %rbx
+ je .L1
+.L1:
+ ret
+ .section ".tdata", "awT", @progbits
+bar:
+ .long 10
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index b13cc7d..ab4822e 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -460,6 +460,7 @@ run_dump_test "pr24721"
run_dump_test "pr24721-x32"
run_dump_test "pr24905"
run_dump_test "pr24905-x32"
+run_dump_test "align-branch-1"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return