summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-1.d5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-1.map8
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-1.t10
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-2.d5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-2.map7
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-2.t10
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-3.d5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-3.map7
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-3.t10
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-4.d5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-4.map7
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-4.t10
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-a.s5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file-b.s5
-rw-r--r--ld/testsuite/ld-scripts/exclude-file.exp32
15 files changed, 131 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/exclude-file-1.d b/ld/testsuite/ld-scripts/exclude-file-1.d
new file mode 100644
index 00000000000..068ecac4af1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-1.d
@@ -0,0 +1,5 @@
+#source: exclude-file-a.s
+#source: exclude-file-b.s
+#ld: -T exclude-file-1.t
+#map: exclude-file-1.map
+
diff --git a/ld/testsuite/ld-scripts/exclude-file-1.map b/ld/testsuite/ld-scripts/exclude-file-1.map
new file mode 100644
index 00000000000..0fbf601166a
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-1.map
@@ -0,0 +1,8 @@
+#...
+\.data +0x[0-9a-f]+ +0x[0-9a-f]+
+ \*\(EXCLUDE_FILE\(\*-b\.o\) \.data \.data\.\*\)
+ \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+ \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+ \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o
+
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-scripts/exclude-file-1.t b/ld/testsuite/ld-scripts/exclude-file-1.t
new file mode 100644
index 00000000000..f75e6c386f2
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-1.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .data : {
+ * (EXCLUDE_FILE (*-b.o) .data .data.*)
+ }
+
+ /DISCARD/ : {
+ * (*)
+ }
+}
diff --git a/ld/testsuite/ld-scripts/exclude-file-2.d b/ld/testsuite/ld-scripts/exclude-file-2.d
new file mode 100644
index 00000000000..7c62c2f1e06
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-2.d
@@ -0,0 +1,5 @@
+#source: exclude-file-a.s
+#source: exclude-file-b.s
+#ld: -T exclude-file-2.t
+#map: exclude-file-2.map
+
diff --git a/ld/testsuite/ld-scripts/exclude-file-2.map b/ld/testsuite/ld-scripts/exclude-file-2.map
new file mode 100644
index 00000000000..67acfe75354
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-2.map
@@ -0,0 +1,7 @@
+#...
+\.data +0x[0-9a-f]+ +0x[0-9a-f]+
+ \*\(EXCLUDE_FILE\(\*-b\.o\) \.data EXCLUDE_FILE\(\*-b\.o\) \.data\.\*\)
+ \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+ \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-scripts/exclude-file-2.t b/ld/testsuite/ld-scripts/exclude-file-2.t
new file mode 100644
index 00000000000..efdb5c0cc09
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-2.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .data : {
+ * (EXCLUDE_FILE (*-b.o) .data EXCLUDE_FILE (*-b.o) .data.*)
+ }
+
+ /DISCARD/ : {
+ * (*)
+ }
+}
diff --git a/ld/testsuite/ld-scripts/exclude-file-3.d b/ld/testsuite/ld-scripts/exclude-file-3.d
new file mode 100644
index 00000000000..19bfc4f1e9c
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-3.d
@@ -0,0 +1,5 @@
+#source: exclude-file-a.s
+#source: exclude-file-b.s
+#ld: -T exclude-file-3.t
+#map: exclude-file-3.map
+
diff --git a/ld/testsuite/ld-scripts/exclude-file-3.map b/ld/testsuite/ld-scripts/exclude-file-3.map
new file mode 100644
index 00000000000..389d1708c90
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-3.map
@@ -0,0 +1,7 @@
+#...
+\.data +0x[0-9a-f]+ +0x[0-9a-f]+
+ EXCLUDE_FILE\(\*-b\.o\) \*\(\.data \.data\.\*\)
+ \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+ \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-scripts/exclude-file-3.t b/ld/testsuite/ld-scripts/exclude-file-3.t
new file mode 100644
index 00000000000..4d4be5852bb
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-3.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .data : {
+ EXCLUDE_FILE (*-b.o) * (.data .data.*)
+ }
+
+ /DISCARD/ : {
+ * (*)
+ }
+}
diff --git a/ld/testsuite/ld-scripts/exclude-file-4.d b/ld/testsuite/ld-scripts/exclude-file-4.d
new file mode 100644
index 00000000000..b087feea1ce
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-4.d
@@ -0,0 +1,5 @@
+#source: exclude-file-a.s
+#source: exclude-file-b.s
+#ld: -T exclude-file-4.t
+#map: exclude-file-4.map
+
diff --git a/ld/testsuite/ld-scripts/exclude-file-4.map b/ld/testsuite/ld-scripts/exclude-file-4.map
new file mode 100644
index 00000000000..8549283e0ce
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-4.map
@@ -0,0 +1,7 @@
+#...
+\.data +0x[0-9a-f]+ +0x[0-9a-f]+
+ \*\(EXCLUDE_FILE\(\*-b\.o\) \.data EXCLUDE_FILE\(\*-a\.o\) \.data\.\*\)
+ \.data +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-a\.o
+ \.data\.1 +0x[0-9a-f]+ +0x[0-9a-f]+ tmpdir/exclude-file-b\.o
+
+#... \ No newline at end of file
diff --git a/ld/testsuite/ld-scripts/exclude-file-4.t b/ld/testsuite/ld-scripts/exclude-file-4.t
new file mode 100644
index 00000000000..a9b03c4d733
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-4.t
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .data : {
+ * (EXCLUDE_FILE (*-b.o) .data EXCLUDE_FILE (*-a.o) .data.*)
+ }
+
+ /DISCARD/ : {
+ * (*)
+ }
+}
diff --git a/ld/testsuite/ld-scripts/exclude-file-a.s b/ld/testsuite/ld-scripts/exclude-file-a.s
new file mode 100644
index 00000000000..19f5def47a7
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-a.s
@@ -0,0 +1,5 @@
+ .section ".data", "aw"
+ .word 0x0
+
+ .section ".data.1", "aw"
+ .word 0x0
diff --git a/ld/testsuite/ld-scripts/exclude-file-b.s b/ld/testsuite/ld-scripts/exclude-file-b.s
new file mode 100644
index 00000000000..19f5def47a7
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file-b.s
@@ -0,0 +1,5 @@
+ .section ".data", "aw"
+ .word 0x0
+
+ .section ".data.1", "aw"
+ .word 0x0
diff --git a/ld/testsuite/ld-scripts/exclude-file.exp b/ld/testsuite/ld-scripts/exclude-file.exp
new file mode 100644
index 00000000000..79fba1718a0
--- /dev/null
+++ b/ld/testsuite/ld-scripts/exclude-file.exp
@@ -0,0 +1,32 @@
+# Test EXCLUDE_FILE in a linker script.
+# By Nathan Sidwell, CodeSourcery LLC
+# Copyright (C) 2004-2016 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.
+
+if { ![is_elf_format] } then {
+ unsupported exclude-file.exp
+ return
+}
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/exclude-file-*.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]
+}