aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-11-12 15:46:55 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-11-17 08:57:56 -0800
commitc33205431ae179ed500f2840759a7624af1a23d4 (patch)
tree3a0a8253cc51e3a32c1cde36e5cabf70daa00930 /gas/testsuite
parentb13704181fe2e5d89f95342d9a173df8b9a1a34c (diff)
downloadgdb-c33205431ae179ed500f2840759a7624af1a23d4.zip
gdb-c33205431ae179ed500f2840759a7624af1a23d4.tar.gz
gdb-c33205431ae179ed500f2840759a7624af1a23d4.tar.bz2
Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
bfd/ * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND. (R_X86_64_standard): Replace R_X86_64_RELATIVE64 with R_X86_64_PLT32_BND. (IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND. (x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. (elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND. (elf_x86_64_gc_sweep_hook): Likewise. (elf_x86_64_relocate_section): Likewise. * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. * bfd-in2.h: Regenerated. * libbfd.h: Likewise. gas/ * config/tc-i386.c (reloc): Add an argument, bnd_prefix, to indicate if instruction has the BND prefix. Return BFD_RELOC_X86_64_PC32_BND instead of BFD_RELOC_32_PCREL if bnd_prefix isn't zero. (output_branch): Pass BFD_RELOC_X86_64_PC32_BND to frag_var if needed. (output_jump): Update reloc call. (output_interseg_jump): Likewise. (output_disp): Likewise. (output_imm): Likewise. (x86_cons_fix_new): Likewise. (lex_got): Add an argument, bnd_prefix, to indicate if instruction has the BND prefix. Use BFD_RELOC_X86_64_PLT32_BND if needed. (x86_cons): Update lex_got call. (i386_immediate): Likewise. (i386_displacement): Likewise. (md_apply_fix): Handle BFD_RELOC_X86_64_PC32_BND and BFD_RELOC_X86_64_PLT32_BND. (tc_gen_reloc): Likewise. * config/tc-i386-intel.c (i386_operator): Update lex_got call. gas/testsuite/ * gas/i386/i386.exp: Run x86-64-mpx-branch-1 and x86-64-mpx-branch-2 on 64-bit ELF targets. * gas/i386/x86-64-mpx-branch-1.d: New file. * gas/i386/x86-64-mpx-branch-1.s: Likewise. * gas/i386/x86-64-mpx-branch-2.d: Likewise. * gas/i386/x86-64-mpx-branch-2.s: Likewise. include/elf/ * x86-64.h: Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND. ld/testsuite/ * ld-x86-64/mpx.exp: New file. * ld-x86-64/mpx1.out: Likewise. * ld-x86-64/mpx1a.c: Likewise. * ld-x86-64/mpx1a.rd: Likewise. * ld-x86-64/mpx1b.c: Likewise. * ld-x86-64/mpx1c.c: Likewise. * ld-x86-64/mpx1c.rd: Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog9
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx-branch-1.d28
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx-branch-1.s18
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx-branch-2.d28
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx-branch-2.s18
6 files changed, 103 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 6850f17..33afa04 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gas/i386/i386.exp: Run x86-64-mpx-branch-1 and
+ x86-64-mpx-branch-2 on 64-bit ELF targets.
+ * gas/i386/x86-64-mpx-branch-1.d: New file.
+ * gas/i386/x86-64-mpx-branch-1.s: Likewise.
+ * gas/i386/x86-64-mpx-branch-2.d: Likewise.
+ * gas/i386/x86-64-mpx-branch-2.s: Likewise.
+
2013-11-15 Yufeng Zhang <yufeng.zhang@arm.com>
* gas/aarch64/diagnostic.s: Add tests.
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index ce77fef..1fb2795 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -589,6 +589,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t
run_dump_test "k1om"
run_dump_test "x86-64-localpic"
run_dump_test "debug1"
+ run_dump_test "x86-64-mpx-branch-1"
+ run_dump_test "x86-64-mpx-branch-2"
run_dump_test "x86-64-dw2-compress-2"
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
new file mode 100644
index 0000000..5edb1c7
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
@@ -0,0 +1,28 @@
+#as: -J
+#objdump: -dwr
+#name: x86-64 MPX branch
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 6 <foo1-0x6> 2: R_X86_64_PC32_BND \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq c <foo1> 8: R_X86_64_PC32_BND \*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ ]*[a-f0-9]+: f2 eb fd bnd jmp c <foo1>
+[ ]*[a-f0-9]+: f2 72 fa bnd jb c <foo1>
+[ ]*[a-f0-9]+: f2 e8 f4 ff ff ff bnd callq c <foo1>
+[ ]*[a-f0-9]+: f2 eb 09 bnd jmp 24 <foo2>
+[ ]*[a-f0-9]+: f2 72 06 bnd jb 24 <foo2>
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 2a <foo2\+0x6> 26: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 31 <foo2\+0xd> 2d: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 37 <foo2\+0x13> 33: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 3d <foo2\+0x19> 39: R_X86_64_PLT32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 44 <foo2\+0x20> 40: R_X86_64_PLT32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 4a <foo2\+0x26> 46: R_X86_64_PLT32_BND foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-1.s b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.s
new file mode 100644
index 0000000..3cdb109
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-1.s
@@ -0,0 +1,18 @@
+ .text
+ bnd call 0x100040
+ bnd jmp 0x100040
+
+foo1:
+ bnd jmp foo1
+ bnd jb foo1
+ bnd call foo1
+ bnd jmp foo2
+ bnd jb foo2
+ bnd call foo2
+foo2:
+ bnd jmp foo
+ bnd jb foo
+ bnd call foo
+ bnd jmp foo@PLT
+ bnd jb foo@PLT
+ bnd call foo@plt
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
new file mode 100644
index 0000000..86fb360
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
@@ -0,0 +1,28 @@
+#as: -J -madd-bnd-prefix
+#objdump: -dwr
+#name: x86-64 branch with BND prefix
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 6 <foo1-0x6> 2: R_X86_64_PC32_BND \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq c <foo1> 8: R_X86_64_PC32_BND \*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ ]*[a-f0-9]+: f2 eb fd bnd jmp c <foo1>
+[ ]*[a-f0-9]+: f2 72 fa bnd jb c <foo1>
+[ ]*[a-f0-9]+: f2 e8 f4 ff ff ff bnd callq c <foo1>
+[ ]*[a-f0-9]+: f2 eb 09 bnd jmp 24 <foo2>
+[ ]*[a-f0-9]+: f2 72 06 bnd jb 24 <foo2>
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 2a <foo2\+0x6> 26: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 31 <foo2\+0xd> 2d: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 37 <foo2\+0x13> 33: R_X86_64_PC32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 3d <foo2\+0x19> 39: R_X86_64_PLT32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 44 <foo2\+0x20> 40: R_X86_64_PLT32_BND foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 4a <foo2\+0x26> 46: R_X86_64_PLT32_BND foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-2.s b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.s
new file mode 100644
index 0000000..5fe9088
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-2.s
@@ -0,0 +1,18 @@
+ .text
+ call 0x100040
+ jmp 0x100040
+
+foo1:
+ jmp foo1
+ jb foo1
+ call foo1
+ jmp foo2
+ jb foo2
+ call foo2
+foo2:
+ jmp foo
+ jb foo
+ call foo
+ jmp foo@PLT
+ jb foo@PLT
+ call foo@plt