From 8e91916467a8bd0bd9f7a470f081f2a9b9fb2cbf Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Sat, 11 Oct 2003 09:18:58 +0000 Subject: [PATCH] * ld-scripts/defined3.d, ld-scripts/defined3.t: New test. * ld-scripts/defined.exp: Run defined3. --- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-scripts/defined.exp | 1 + ld/testsuite/ld-scripts/defined3.d | 25 +++++++++++++++++++++++++ ld/testsuite/ld-scripts/defined3.t | 15 +++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 ld/testsuite/ld-scripts/defined3.d create mode 100644 ld/testsuite/ld-scripts/defined3.t diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f00cf6af1eb..20dedda1ef1 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-10-11 Hans-Peter Nilsson + + * ld-scripts/defined3.d, ld-scripts/defined3.t: New test. + * ld-scripts/defined.exp: Run defined3. + 2003-10-08 Hans-Peter Nilsson * ld-scripts/defined2.d, ld-scripts/defined2.t: New test. diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp index 277ba37628c..138e663fcec 100644 --- a/ld/testsuite/ld-scripts/defined.exp +++ b/ld/testsuite/ld-scripts/defined.exp @@ -56,3 +56,4 @@ if ![ld_simple_link $ld tmpdir/def "-T $srcdir/$subdir/defined.t tmpdir/def.o"] set prms_id 0 run_dump_test "defined2" +run_dump_test "defined3" diff --git a/ld/testsuite/ld-scripts/defined3.d b/ld/testsuite/ld-scripts/defined3.d new file mode 100644 index 00000000000..1a7946db99a --- /dev/null +++ b/ld/testsuite/ld-scripts/defined3.d @@ -0,0 +1,25 @@ +#ld: -Tdefined3.t +#nm: -B +#source: phdrs.s +#source: defined.s + +# Check that DEFINED matches only symbols defined before its location. +# The ellipsis account for target-specific symbols. Matching both A and T +# accounts for formats that can't tell a .text symbol from an absolute +# symbol (mmo), but matches whatever section that contains an address +# matching the value. + +#... +0+1 [AT] defined +0+200 A defined1 +0+201 A defined2 +0+100 A defined3 +0+ [AT] defined4 +0+2a A defined5 +0+ [AT] defined6 +0+1 [AT] defined7 +0+1 [AT] defined8 +#... +0+2a A sym1 +[0-9a-f]+ T sym2 +#pass diff --git a/ld/testsuite/ld-scripts/defined3.t b/ld/testsuite/ld-scripts/defined3.t new file mode 100644 index 00000000000..1fe6eef54e4 --- /dev/null +++ b/ld/testsuite/ld-scripts/defined3.t @@ -0,0 +1,15 @@ +defined6 = DEFINED (sym2) ? 1 : 0; +SECTIONS { + .text : { *(.text) sym2 = .; } + .data : { *(.data) } + .bss : { *(.bss) *(COMMON) } +} +defined4 = DEFINED (sym1) ? 1 : 0; +sym1 = 42; +defined3 = DEFINED (defined1) ? defined1 + 1 : 256; +defined1 = DEFINED (defined1) ? defined1 + 1 : 512; +defined2 = DEFINED (defined1) ? defined1 + 1 : 1024; +defined5 = DEFINED (sym1) ? sym1 : 0; +defined7 = DEFINED (sym2); +defined8 = !DEFINED (defined8); +defined = DEFINED (defined) ? defined : 42; -- 2.30.2