aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-undefined/require-defined-1.d4
-rw-r--r--ld/testsuite/ld-undefined/require-defined-2.d8
-rw-r--r--ld/testsuite/ld-undefined/require-defined-3.d8
-rw-r--r--ld/testsuite/ld-undefined/require-defined-4.d8
-rw-r--r--ld/testsuite/ld-undefined/require-defined-5.d10
-rw-r--r--ld/testsuite/ld-undefined/require-defined.exp58
-rw-r--r--ld/testsuite/ld-undefined/require-defined.s9
8 files changed, 115 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index c35d4a7..512abc3 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2015-08-04 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ld-undefined/require-defined-1.d: New file.
+ * ld-undefined/require-defined-2.d: New file.
+ * ld-undefined/require-defined-3.d: New file.
+ * ld-undefined/require-defined-4.d: New file.
+ * ld-undefined/require-defined-5.d: New file.
+ * ld-undefined/require-defined.exp: New file.
+ * ld-undefined/require-defined.s: New file.
+
2015-07-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/18735
diff --git a/ld/testsuite/ld-undefined/require-defined-1.d b/ld/testsuite/ld-undefined/require-defined-1.d
new file mode 100644
index 0000000..12b0cf5
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined-1.d
@@ -0,0 +1,4 @@
+#name: Check require-defined with an undefined symbol
+#source: require-defined.s
+#ld: -e _start --gc-sections --require-defined=xxx
+#error: required symbol `xxx' not defined
diff --git a/ld/testsuite/ld-undefined/require-defined-2.d b/ld/testsuite/ld-undefined/require-defined-2.d
new file mode 100644
index 0000000..e770eea
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined-2.d
@@ -0,0 +1,8 @@
+#name: Check require-defined can require a symbol from an object
+#source: require-defined.s
+#ld: -e _start --gc-sections --require-defined=bar
+#nm: -n
+
+#...
+[0-9a-f]+ T bar
+#...
diff --git a/ld/testsuite/ld-undefined/require-defined-3.d b/ld/testsuite/ld-undefined/require-defined-3.d
new file mode 100644
index 0000000..c61ed34
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined-3.d
@@ -0,0 +1,8 @@
+#name: Check require-defined does no error on a defined symbol
+#source: require-defined.s
+#ld: -e _start --require-defined=bar
+#nm: -n
+
+#...
+[0-9a-f]+ T bar
+#...
diff --git a/ld/testsuite/ld-undefined/require-defined-4.d b/ld/testsuite/ld-undefined/require-defined-4.d
new file mode 100644
index 0000000..2922c99
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined-4.d
@@ -0,0 +1,8 @@
+#name: Check require-defined can require a symbol from an archive
+#source: require-defined.s
+#ld: -e _start --require-defined=foo tmpdir/libfoo.a
+#nm: -n
+
+#...
+[0-9a-f]+ T foo
+#...
diff --git a/ld/testsuite/ld-undefined/require-defined-5.d b/ld/testsuite/ld-undefined/require-defined-5.d
new file mode 100644
index 0000000..ea288a9
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined-5.d
@@ -0,0 +1,10 @@
+#name: Check require-defined can require two symbols
+#source: require-defined.s
+#ld: -e _start --gc-sections --require-defined=bar --require-defined=foo tmpdir/libfoo.a
+#nm: -n
+
+#...
+[0-9a-f]+ T foo
+#...
+[0-9a-f]+ T bar
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-undefined/require-defined.exp b/ld/testsuite/ld-undefined/require-defined.exp
new file mode 100644
index 0000000..16013dc
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined.exp
@@ -0,0 +1,58 @@
+# Expect script for ld --undefined and --require-defined testing.
+# Copyright (C) 2015 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.
+#
+
+# Some of these tests use --gc-sections. For now we don't attempt any
+# if --gc-sections is unavailable, as most major targets do support
+# this option.
+if ![check_gc_sections_available] {
+ unsupported "require-defined testing"
+ return
+}
+
+# The following targets all fail these tests for reasons that appear
+# to be unrelated to the test themselves (for example some of these
+# targets require more complex linker scripts). Given the small
+# number of targets, I'm just skipping the tests in these cases.]
+if { [istarget "powerpcle-*-*"] \
+ || [istarget "cris-axis-elf"] \
+ || [istarget "ns32k-*-netbsd"] \
+ || [istarget "*-*-coff"] \
+ || [istarget "*-*-xcoff"] \
+ || [istarget "*-*-*aout*"] \
+ || [istarget "*-*-*aix*"] } {
+ unsupported "require-defined testing"
+ return
+}
+
+set build_tests {
+ {"Build libfoo.a"
+ "" "" ""
+ {entry.s} {} "libfoo.a"}
+}
+
+run_ld_link_tests $build_tests
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/require-defined*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
diff --git a/ld/testsuite/ld-undefined/require-defined.s b/ld/testsuite/ld-undefined/require-defined.s
new file mode 100644
index 0000000..2bda640
--- /dev/null
+++ b/ld/testsuite/ld-undefined/require-defined.s
@@ -0,0 +1,9 @@
+ .text
+ .global _start
+_start:
+ .word 0
+
+ .section .text.1, "ax"
+ .global bar
+bar:
+ .word 0