* ld-scripts/defined3.d, ld-scripts/defined3.t: New test.

* ld-scripts/defined.exp: Run defined3.
This commit is contained in:
Hans-Peter Nilsson 2003-10-11 09:18:58 +00:00
parent 420e579cc4
commit 8e91916467
4 changed files with 46 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2003-10-11 Hans-Peter Nilsson <hp@bitrange.com>
* ld-scripts/defined3.d, ld-scripts/defined3.t: New test.
* ld-scripts/defined.exp: Run defined3.
2003-10-08 Hans-Peter Nilsson <hp@bitrange.com>
* ld-scripts/defined2.d, ld-scripts/defined2.t: New test.

View File

@ -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"

View File

@ -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

View File

@ -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;