diff options
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r-- | ld/testsuite/ld-scripts/.Sanitize | 41 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/defined.exp | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/defined.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/defined.t | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/script.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/script.t | 14 |
6 files changed, 97 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/.Sanitize b/ld/testsuite/ld-scripts/.Sanitize new file mode 100644 index 0000000..b68da1b --- /dev/null +++ b/ld/testsuite/ld-scripts/.Sanitize @@ -0,0 +1,41 @@ +# .Sanitize for ld dejagnu testsuites + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order.. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this directory. + +Do-first: + +# All files listed between the "Things-to-keep:" line and the +# "Do-last:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +defined.exp +defined.s +defined.t +script.exp +script.s +script.t + +Things-to-lose: + +# The lines between the "Do-last:" line and the end of the file +# are executed as a /bin/sh shell script after everything else is +# done. + +Do-last: + +#eof diff --git a/ld/testsuite/ld-scripts/defined.exp b/ld/testsuite/ld-scripts/defined.exp new file mode 100644 index 0000000..a1f8698 --- /dev/null +++ b/ld/testsuite/ld-scripts/defined.exp @@ -0,0 +1,29 @@ +# Test DEFINED in a linker script. +# By Ian Lance Taylor, Cygnus Support. + +if ![ld_assemble $as $srcdir$subdir/defined.s tmpdir/def.o] { return } + +set prms_id 5699 + +if ![ld_simple_link $ld tmpdir/def "-T $srcdir$subdir/defined.t tmpdir/def.o"] { + fail DEFINED +} else { + if [ld_nm $nm tmpdir/def] { + if {![info exists nm_output(value1)] \ + || ![info exists nm_output(value2)]} { + fail "DEFINED (bad output from $nm)" + } else { + if {$nm_output(value1) != 1} { + fail "DEFINED (value1 == $nm_output(value1))" + } else { + if {$nm_output(value2) != 2} { + fail "DEFINED (value2 == $nm_output(value2))" + } else { + pass DEFINED + } + } + } + } +} + +set prms_id 0 diff --git a/ld/testsuite/ld-scripts/defined.s b/ld/testsuite/ld-scripts/defined.s new file mode 100644 index 0000000..a364bbb --- /dev/null +++ b/ld/testsuite/ld-scripts/defined.s @@ -0,0 +1,2 @@ + .globl defined + defined = 1 diff --git a/ld/testsuite/ld-scripts/defined.t b/ld/testsuite/ld-scripts/defined.t new file mode 100644 index 0000000..d1e4748 --- /dev/null +++ b/ld/testsuite/ld-scripts/defined.t @@ -0,0 +1,5 @@ +SECTIONS { + .text : { *(.text) } +} +value1 = DEFINED (defined) ? 1 : 2; +value2 = DEFINED (undefined) ? 1 : 2; diff --git a/ld/testsuite/ld-scripts/script.s b/ld/testsuite/ld-scripts/script.s new file mode 100644 index 0000000..a862911 --- /dev/null +++ b/ld/testsuite/ld-scripts/script.s @@ -0,0 +1,6 @@ + .text +text_symbol: + .long 1 + .data +data_symbol: + .long 2 diff --git a/ld/testsuite/ld-scripts/script.t b/ld/testsuite/ld-scripts/script.t new file mode 100644 index 0000000..3da47e1 --- /dev/null +++ b/ld/testsuite/ld-scripts/script.t @@ -0,0 +1,14 @@ +SECTIONS +{ + .text 0x100 : { + text_start = .; + *(.text) + text_end = .; + } + . = 0x1000; + .data : { + data_start = .; + *(.data) + data_end = .; + } +} |