aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-10-17 19:26:10 +0000
committerDaniel Jacobowitz <drow@false.org>2007-10-17 19:26:10 +0000
commit20e5635130c217d9980e98d3e81b8d106759577d (patch)
tree1433a0f90504a5529e816fd272f6091cc14dd353 /ld/testsuite
parent499ac353610f24006acf82c32503d8d15d0f278c (diff)
downloadgdb-20e5635130c217d9980e98d3e81b8d106759577d.zip
gdb-20e5635130c217d9980e98d3e81b8d106759577d.tar.gz
gdb-20e5635130c217d9980e98d3e81b8d106759577d.tar.bz2
2007-10-17 Zack Weinberg <zack@codesourcery.com>
* ldlang.c (lang_check_section_addresses): Also report size of overflow for any overflowed memory regions. (os_region_check): Diagnose an overflowed region only once per region. Do not reset region->current on overflow. 2007-10-17 Zack Weinberg <zack@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com> Mark Shinwell <shinwell@codesourcery.com> Joseph Myers <joseph@codesourcery.com> * ld-scripts/rgn-over.exp: New driver. * ld-scripts/rgn-over.s: New file. * ld-scripts/rgn-over1.d, ld-scripts/rgn-over1.t, ld-scripts/rgn-over2.d, ld-scripts/rgn-over2.t, ld-scripts/rgn-over3.d, ld-scripts/rgn-over3.t, ld-scripts/rgn-over4.d, ld-scripts/rgn-over4.t, ld-scripts/rgn-over5.d, ld-scripts/rgn-over5.t, ld-scripts/rgn-over6.d, ld-scripts/rgn-over6.t, ld-scripts/rgn-over7.d, ld-scripts/rgn-over7.t: New test cases.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog16
-rw-r--r--ld/testsuite/ld-scripts/rgn-over.exp46
-rw-r--r--ld/testsuite/ld-scripts/rgn-over.s9
-rw-r--r--ld/testsuite/ld-scripts/rgn-over1.d34
-rw-r--r--ld/testsuite/ld-scripts/rgn-over1.t13
-rw-r--r--ld/testsuite/ld-scripts/rgn-over2.d34
-rw-r--r--ld/testsuite/ld-scripts/rgn-over2.t14
-rw-r--r--ld/testsuite/ld-scripts/rgn-over3.d35
-rw-r--r--ld/testsuite/ld-scripts/rgn-over3.t15
-rw-r--r--ld/testsuite/ld-scripts/rgn-over4.d35
-rw-r--r--ld/testsuite/ld-scripts/rgn-over4.t14
-rw-r--r--ld/testsuite/ld-scripts/rgn-over5.d35
-rw-r--r--ld/testsuite/ld-scripts/rgn-over5.t14
-rw-r--r--ld/testsuite/ld-scripts/rgn-over6.d35
-rw-r--r--ld/testsuite/ld-scripts/rgn-over6.t14
-rw-r--r--ld/testsuite/ld-scripts/rgn-over7.d35
-rw-r--r--ld/testsuite/ld-scripts/rgn-over7.t14
17 files changed, 412 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 07b1e92..ffc2296 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,19 @@
+2007-10-17 Zack Weinberg <zack@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+ Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * ld-scripts/rgn-over.exp: New driver.
+ * ld-scripts/rgn-over.s: New file.
+ * ld-scripts/rgn-over1.d, ld-scripts/rgn-over1.t,
+ ld-scripts/rgn-over2.d, ld-scripts/rgn-over2.t,
+ ld-scripts/rgn-over3.d, ld-scripts/rgn-over3.t,
+ ld-scripts/rgn-over4.d, ld-scripts/rgn-over4.t,
+ ld-scripts/rgn-over5.d, ld-scripts/rgn-over5.t,
+ ld-scripts/rgn-over6.d, ld-scripts/rgn-over6.t,
+ ld-scripts/rgn-over7.d, ld-scripts/rgn-over7.t:
+ New test cases.
+
2007-10-16 Nick Clifton <nickc@redhat.com>
* lf-elfcomm/elfcomm.exp: Add tests of STT_COMMON symbol
diff --git a/ld/testsuite/ld-scripts/rgn-over.exp b/ld/testsuite/ld-scripts/rgn-over.exp
new file mode 100644
index 0000000..76e8206
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over.exp
@@ -0,0 +1,46 @@
+# Test for proper diagnosis of overflowed memory regions.
+# Copyright 2007 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] {
+ return
+}
+
+load_lib ld-lib.exp
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/rgn-over*.d]]
+foreach test_file $test_list {
+ set test_name [file rootname $test_file]
+ set map_file "tmpdir/[file tail $test_name].map"
+ verbose $test_name
+ run_dump_test $test_name
+
+ set testname "[file tail $test_name] (map check)"
+ if [file exists $map_file] {
+ # compare the map file to the expectations in the .d file
+ # (run_dump_test can't do that).
+ if [regexp_diff $map_file $test_file] {
+ fail $testname
+ } else {
+ pass $testname
+ }
+ } else {
+ untested $testname
+ }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over.s b/ld/testsuite/ld-scripts/rgn-over.s
new file mode 100644
index 0000000..f651cce
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over.s
@@ -0,0 +1,9 @@
+ .section .txt, "ax", "progbits"
+ .4byte 0x11223344
+ .4byte 0x55667788
+ .4byte 0x99aabbcc
+
+ .section .dat, "aw", "progbits"
+ .4byte 0x01020304
+ .4byte 0x05060708
+ .4byte 0x090a0b0c
diff --git a/ld/testsuite/ld-scripts/rgn-over1.d b/ld/testsuite/ld-scripts/rgn-over1.d
new file mode 100644
index 0000000..0e9d663
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over1.d
@@ -0,0 +1,34 @@
+# name: rgn-over1
+# source: rgn-over.s
+# ld: -T rgn-over1.t -Map tmpdir/rgn-over1.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region r1\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 16 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0008\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+100c\s+0xc
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+100c\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over1.t b/ld/testsuite/ld-scripts/rgn-over1.t
new file mode 100644
index 0000000..9c14f70
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over1.t
@@ -0,0 +1,13 @@
+/* Memory region overflow tests: one region, first output sect doesn't fit. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1
+ .data : { *(.dat) } > r1
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over2.d b/ld/testsuite/ld-scripts/rgn-over2.d
new file mode 100644
index 0000000..1801948
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over2.d
@@ -0,0 +1,34 @@
+# name: rgn-over2
+# source: rgn-over.s
+# ld: -T rgn-over2.t -Map tmpdir/rgn-over2.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.data will not fit in region r1\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 4 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0014\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+100c\s+0xc
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+100c\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over2.t b/ld/testsuite/ld-scripts/rgn-over2.t
new file mode 100644
index 0000000..b38a9c1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over2.t
@@ -0,0 +1,14 @@
+/* Memory region overflow tests: one region, first output sect fits,
+ second doesn't. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 20
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1
+ .data : { *(.dat) } > r1
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over3.d b/ld/testsuite/ld-scripts/rgn-over3.d
new file mode 100644
index 0000000..1ab0681
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over3.d
@@ -0,0 +1,35 @@
+# name: rgn-over3
+# source: rgn-over.s
+# ld: -T rgn-over3.t -Map tmpdir/rgn-over3.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region r1\n[^ \n]*?ld[^:\n]*?: [^\n]*?section \.data will not fit in region r2\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 4 bytes\n[^ \n]*?ld[^:\n]*?: region r2 overflowed by 4 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0008\s+xrw
+r2\s+0x0+2000\s+0x0+0008\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+2000\s+0xc
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+2000\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over3.t b/ld/testsuite/ld-scripts/rgn-over3.t
new file mode 100644
index 0000000..5341fb5
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over3.t
@@ -0,0 +1,15 @@
+/* Memory region overflow tests: two regions, each too small for the single
+ section placed there. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8
+ r2 (rwx) : ORIGIN = 0x2000, LENGTH = 8
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1
+ .data : { *(.dat) } > r2
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over4.d b/ld/testsuite/ld-scripts/rgn-over4.d
new file mode 100644
index 0000000..f6ae602
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over4.d
@@ -0,0 +1,35 @@
+# name: rgn-over4
+# source: rgn-over.s
+# ld: -T rgn-over4.t -Map tmpdir/rgn-over4.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^:\n]*?section \.text will not fit in region r1\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 16 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0008\s+xrw
+v1\s+0x0+2000\s+0x0+0018\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+100c\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over4.t b/ld/testsuite/ld-scripts/rgn-over4.t
new file mode 100644
index 0000000..d2463e9
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over4.t
@@ -0,0 +1,14 @@
+/* Memory region overflow tests: overflow VMA but not LMA. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8
+ v1 (rwx) : ORIGIN = 0x2000, LENGTH = 24
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1 AT> v1
+ .data : { *(.dat) } > r1 AT> v1
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over5.d b/ld/testsuite/ld-scripts/rgn-over5.d
new file mode 100644
index 0000000..61ae3a1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over5.d
@@ -0,0 +1,35 @@
+# name: rgn-over5
+# source: rgn-over.s
+# ld: -T rgn-over5.t -Map tmpdir/rgn-over5.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region v1\n[^ \n]*?ld[^:\n]*?: region v1 overflowed by 16 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0018\s+xrw
+v1\s+0x0+2000\s+0x0+0008\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+100c\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over5.t b/ld/testsuite/ld-scripts/rgn-over5.t
new file mode 100644
index 0000000..2b0ae68
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over5.t
@@ -0,0 +1,14 @@
+/* Memory region overflow tests: overflow LMA but not VMA. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 24
+ v1 (rwx) : ORIGIN = 0x2000, LENGTH = 8
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1 AT> v1
+ .data : { *(.dat) } > r1 AT> v1
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over6.d b/ld/testsuite/ld-scripts/rgn-over6.d
new file mode 100644
index 0000000..0847c0d
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over6.d
@@ -0,0 +1,35 @@
+# name: rgn-over6
+# source: rgn-over.s
+# ld: -T rgn-over6.t -Map tmpdir/rgn-over6.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region r1\n[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region v1\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 16 bytes\n[^ \n]*?ld[^:\n]*?: region v1 overflowed by 16 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0008\s+xrw
+v1\s+0x0+2000\s+0x0+0008\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc\s+load\s+address\s+0x0+2000
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+100c\s+0xc\s+load\s+address\s+0x0+200c
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+100c\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over6.t b/ld/testsuite/ld-scripts/rgn-over6.t
new file mode 100644
index 0000000..b78d184
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over6.t
@@ -0,0 +1,14 @@
+/* Memory region overflow tests: overflow LMA and VMA. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8
+ v1 (rwx) : ORIGIN = 0x2000, LENGTH = 8
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1 AT> v1
+ .data : { *(.dat) } > r1 AT> v1
+ /DISCARD/ : { *(*) }
+}
diff --git a/ld/testsuite/ld-scripts/rgn-over7.d b/ld/testsuite/ld-scripts/rgn-over7.d
new file mode 100644
index 0000000..f905f79
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over7.d
@@ -0,0 +1,35 @@
+# name: rgn-over7
+# source: rgn-over.s
+# ld: -T rgn-over7.t -Map tmpdir/rgn-over7.map
+# error: \A[^ \n]*?ld[^:\n]*?: [^\n]*?section \.text will not fit in region r1\n[^ \n]*?ld[^:\n]*?: section \.data \[0+1008 -> 0+1013\] overlaps section \.text \[0+1000 -> 0+100b\]\n[^ \n]*?ld[^:\n]*?: region r1 overflowed by 4 bytes\Z
+
+Discarded input sections
+#...
+Memory\s+Configuration
+
+Name\s+Origin\s+Length\s+Attributes
+bss\s+0x0+0000\s+0x0+0000\s+xrw
+r1\s+0x0+1000\s+0x0+0008\s+xrw
+r2\s+0x0+1008\s+0x0+000c\s+xrw
+\*default\*\s+0x0+0000\s+0xf+ffff
+
+Linker\s+script\s+and\s+memory\s+map
+
+\s*0x0+1000\s+_start\s+=\s+0x1000
+
+\s*\.bss\s+0x0+0000\s+0x0
+\s*\*\(\.bss\)
+\s*\.bss\s+0x0+0000\s+0x0\s+.*?
+
+\s*\.text\s+0x0+1000\s+0xc
+\s*\*\(\.txt\)
+\s*\.txt\s+0x0+1000\s+0xc\s+.*?
+
+\s*\.data\s+0x0+1008\s+0xc
+\s*\*\(\.dat\)
+\s*\.dat\s+0x0+1008\s+0xc\s+.*?
+
+/DISCARD/
+ \*\(\*\)
+LOAD\s+.*?
+OUTPUT\(.*?\)
diff --git a/ld/testsuite/ld-scripts/rgn-over7.t b/ld/testsuite/ld-scripts/rgn-over7.t
new file mode 100644
index 0000000..4288e84
--- /dev/null
+++ b/ld/testsuite/ld-scripts/rgn-over7.t
@@ -0,0 +1,14 @@
+/* Memory region overflow tests: overflow r1 plus text/data collision. */
+
+MEMORY {
+ bss (rwx) : ORIGIN = 0, LENGTH = 0
+ r1 (rwx) : ORIGIN = 0x1000, LENGTH = 8
+ r2 (rwx) : ORIGIN = 0x1008, LENGTH = 12
+}
+_start = 0x1000;
+SECTIONS {
+ .bss : { *(.bss) } > bss
+ .text : { *(.txt) } > r1
+ .data : { *(.dat) } > r2
+ /DISCARD/ : { *(*) }
+}