aboutsummaryrefslogtreecommitdiff
path: root/ld/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 /ld/testsuite
parentb13704181fe2e5d89f95342d9a173df8b9a1a34c (diff)
downloadfsf-binutils-gdb-c33205431ae179ed500f2840759a7624af1a23d4.zip
fsf-binutils-gdb-c33205431ae179ed500f2840759a7624af1a23d4.tar.gz
fsf-binutils-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 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-x86-64/mpx.exp60
-rw-r--r--ld/testsuite/ld-x86-64/mpx1.out2
-rw-r--r--ld/testsuite/ld-x86-64/mpx1a.c7
-rw-r--r--ld/testsuite/ld-x86-64/mpx1a.rd3
-rw-r--r--ld/testsuite/ld-x86-64/mpx1b.c7
-rw-r--r--ld/testsuite/ld-x86-64/mpx1c.c10
-rw-r--r--ld/testsuite/ld-x86-64/mpx1c.rd3
8 files changed, 102 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 63db4e3..2462cd3 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2013-11-14 Will Newton <will.newton@linaro.org>
* ld-arm/script-type.sym: Remove redundant STT_FILE symbol.
diff --git a/ld/testsuite/ld-x86-64/mpx.exp b/ld/testsuite/ld-x86-64/mpx.exp
new file mode 100644
index 0000000..a2f5996
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx.exp
@@ -0,0 +1,60 @@
+# Expect script for ELF MPX tests.
+# Copyright 2013
+# Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# The following tests require running the executable generated by ld,
+# or enough of a build environment to create a fully linked executable.
+# This is not commonly available when testing a cross-built linker.
+if ![isnative] {
+ return
+}
+
+# Only on Linux for now.
+if ![istarget "x86_64-*-linux*"] {
+ return
+}
+
+# Check to see if the C compiler works
+if { [which $CC] == 0 } {
+ return
+}
+
+set build_tests {
+ {"Build libmpx1a.a"
+ "" "-Wa,-madd-bnd-prefix -fPIC"
+ {mpx1a.c} {{readelf {-r --wide} mpx1a.rd}} "libmpx1a.a"}
+ {"Build libmpx1b.a"
+ "" ""
+ {mpx1b.c} {} "libmpx1b.a"}
+ {"Build libmpx1c.a"
+ "" "-Wa,-madd-bnd-prefix"
+ {mpx1c.c} {{readelf {-r --wide} mpx1c.rd}} "libmpx1c.a"}
+}
+
+run_cc_link_tests $build_tests
+
+set run_tests {
+ {"Run mpx1"
+ "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" ""
+ {dummy.s} "mpx1" "mpx1.out"}
+}
+
+run_ld_link_exec_tests [] $run_tests
diff --git a/ld/testsuite/ld-x86-64/mpx1.out b/ld/testsuite/ld-x86-64/mpx1.out
new file mode 100644
index 0000000..4630211
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1.out
@@ -0,0 +1,2 @@
+foo1
+foo2
diff --git a/ld/testsuite/ld-x86-64/mpx1a.c b/ld/testsuite/ld-x86-64/mpx1a.c
new file mode 100644
index 0000000..e1185b5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1a.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+foo1 (void)
+{
+ printf ("foo1\n");
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1a.rd b/ld/testsuite/ld-x86-64/mpx1a.rd
new file mode 100644
index 0000000..9bebc82
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1a.rd
@@ -0,0 +1,3 @@
+#...
+[0-9a-f ]+R_X86_64_PLT32_BND +0+ +.*
+#...
diff --git a/ld/testsuite/ld-x86-64/mpx1b.c b/ld/testsuite/ld-x86-64/mpx1b.c
new file mode 100644
index 0000000..389ac10
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1b.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+foo2 (void)
+{
+ printf ("foo2\n");
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1c.c b/ld/testsuite/ld-x86-64/mpx1c.c
new file mode 100644
index 0000000..12c7806
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1c.c
@@ -0,0 +1,10 @@
+extern void foo1 (void);
+extern void foo2 (void);
+
+int
+main (void)
+{
+ foo1 ();
+ foo2 ();
+ return 0;
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1c.rd b/ld/testsuite/ld-x86-64/mpx1c.rd
new file mode 100644
index 0000000..2b050bd
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1c.rd
@@ -0,0 +1,3 @@
+#...
+[0-9a-f ]+R_X86_64_PC32_BND +0+ +.*
+#...