summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2010-12-28 18:04:10 +0000
committerH.J. Lu <hjl.tools@gmail.com>2010-12-28 18:04:10 +0000
commitcd1915cc656c7d80b808e916a75abf250c514364 (patch)
tree61d2d3ee6a60d3d8b1715db030466690c6a0f221 /ld/testsuite/ld-scripts
parent239adaebf132d9990596aee1756da9b689c10d9c (diff)
downloadbinutils-redhat-cd1915cc656c7d80b808e916a75abf250c514364.tar.gz
Add testcases for PR ld/12327.
2010-12-28 H.J. Lu <hongjiu.lu@intel.com> PR ld/12327 * ld-scripts/defined4.d: New. * ld-scripts/defined4.s: Likewise. * ld-scripts/defined4.t: Likewise. * ld-scripts/expr2.d: Likewise. * ld-scripts/expr2.s: Likewise. * ld-scripts/expr2.t: Likewise. * ld-scripts/defined.exp: Run defined4. * ld-scripts/expr.exp: Run expr2.
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/defined.exp3
-rw-r--r--ld/testsuite/ld-scripts/defined4.d10
-rw-r--r--ld/testsuite/ld-scripts/defined4.s4
-rw-r--r--ld/testsuite/ld-scripts/defined4.t6
-rw-r--r--ld/testsuite/ld-scripts/expr.exp5
-rw-r--r--ld/testsuite/ld-scripts/expr2.d6
-rw-r--r--ld/testsuite/ld-scripts/expr2.s4
-rw-r--r--ld/testsuite/ld-scripts/expr2.t11
8 files changed, 46 insertions, 3 deletions
diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp
index 15cc07942c..6d0c9d50ed 100644
--- a/ld/testsuite/ld-scripts/defined.exp
+++ b/ld/testsuite/ld-scripts/defined.exp
@@ -1,6 +1,6 @@
# Test DEFINED in a linker script.
# By Ian Lance Taylor, Cygnus Support.
-# Copyright 2001, 2003. 2005, 2006, 2007
+# Copyright 2001, 2003, 2005, 2006, 2007, 2010
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -66,4 +66,5 @@ if ![ld_simple_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir
set prms_id 0
run_dump_test "defined2"
run_dump_test "defined3"
+run_dump_test "defined4"
set LDFLAGS "$saved_LDFLAGS"
diff --git a/ld/testsuite/ld-scripts/defined4.d b/ld/testsuite/ld-scripts/defined4.d
new file mode 100644
index 0000000000..2c3a6ea504
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined4.d
@@ -0,0 +1,10 @@
+#ld: -Tdefined4.t
+#nm: -B
+#source: defined4.s
+
+# Check that arithmetic on DEFINED works.
+#...
+0+0 D defined
+#...
+0+0 D defined1
+#pass
diff --git a/ld/testsuite/ld-scripts/defined4.s b/ld/testsuite/ld-scripts/defined4.s
new file mode 100644
index 0000000000..5969a44f4e
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined4.s
@@ -0,0 +1,4 @@
+ .globl defined
+ .data
+defined:
+ .word 0
diff --git a/ld/testsuite/ld-scripts/defined4.t b/ld/testsuite/ld-scripts/defined4.t
new file mode 100644
index 0000000000..1221df2bf1
--- /dev/null
+++ b/ld/testsuite/ld-scripts/defined4.t
@@ -0,0 +1,6 @@
+SECTIONS {
+ .text : { *(.text) }
+ .data : { *(.data) }
+ .bss : { *(.bss) *(COMMON) }
+}
+defined1 = defined;
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
index 34829e5601..467abcb9ac 100644
--- a/ld/testsuite/ld-scripts/expr.exp
+++ b/ld/testsuite/ld-scripts/expr.exp
@@ -1,6 +1,6 @@
-# Test ALIGN in a linker script.
+# Test expressions in a linker script.
# By Nathan Sidwell, CodeSourcery LLC
-# Copyright 2006, 2007
+# Copyright 2006, 2007, 2010
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -21,3 +21,4 @@
# MA 02110-1301, USA.
run_dump_test expr1
+run_dump_test expr2
diff --git a/ld/testsuite/ld-scripts/expr2.d b/ld/testsuite/ld-scripts/expr2.d
new file mode 100644
index 0000000000..6f7e253ee5
--- /dev/null
+++ b/ld/testsuite/ld-scripts/expr2.d
@@ -0,0 +1,6 @@
+# ld: -T expr2.t
+#nm: -B
+
+#...
+.* D defined
+#pass
diff --git a/ld/testsuite/ld-scripts/expr2.s b/ld/testsuite/ld-scripts/expr2.s
new file mode 100644
index 0000000000..5969a44f4e
--- /dev/null
+++ b/ld/testsuite/ld-scripts/expr2.s
@@ -0,0 +1,4 @@
+ .globl defined
+ .data
+defined:
+ .word 0
diff --git a/ld/testsuite/ld-scripts/expr2.t b/ld/testsuite/ld-scripts/expr2.t
new file mode 100644
index 0000000000..634eab26a9
--- /dev/null
+++ b/ld/testsuite/ld-scripts/expr2.t
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ . = 0xc000;
+ .text :
+ {
+ _text = .;
+ *(.text)
+ }
+ _end = .;
+}
+ASSERT (_end - _text <= 0x100, "fail");