diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2005-10-04 19:54:08 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2005-10-04 19:54:08 +0000 |
commit | b239e90902caf9a002527981187e64063baeb8ef (patch) | |
tree | 0d18152911c2ed7fc6809aa795444823a64b4632 /ld/testsuite | |
parent | cbf1f5df2bdcfec5876190038b045324029ff2ad (diff) | |
download | gdb-b239e90902caf9a002527981187e64063baeb8ef.zip gdb-b239e90902caf9a002527981187e64063baeb8ef.tar.gz gdb-b239e90902caf9a002527981187e64063baeb8ef.tar.bz2 |
2005-10-04 H.J. Lu <hongjiu.lu@intel.com>
PR ld/1396
* ld-scripts/cross3.t: New file.
* ld-scripts/cross4.c: Likewise.
* ld-scripts/crossref.exp: Add a new test for "ld -r".
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/cross3.t | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/cross4.c | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/crossref.exp | 29 |
4 files changed, 54 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 3fdfa9e..684b7d3 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2005-10-04 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/1396 + * ld-scripts/cross3.t: New file. + * ld-scripts/cross4.c: Likewise. + + * ld-scripts/crossref.exp: Add a new test for "ld -r". + 2005-09-30 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/sec64k.exp: Enabled for all ELF targets. diff --git a/ld/testsuite/ld-scripts/cross3.t b/ld/testsuite/ld-scripts/cross3.t new file mode 100644 index 0000000..5411b9b6 --- /dev/null +++ b/ld/testsuite/ld-scripts/cross3.t @@ -0,0 +1,10 @@ +NOCROSSREFS(.nocrossrefs .text) + +SECTIONS +{ + .text : { *(.text) } + .nocrossrefs : { *(.nocrossrefs) } + .data : { *(.data) } + .bss : { *(.bss) *(COMMON) } + /DISCARD/ : { *(*) } +} diff --git a/ld/testsuite/ld-scripts/cross4.c b/ld/testsuite/ld-scripts/cross4.c new file mode 100644 index 0000000..aef8dfd --- /dev/null +++ b/ld/testsuite/ld-scripts/cross4.c @@ -0,0 +1,7 @@ +__attribute__ ((section (".nocrossrefs"))) +static void +foo () +{ +} + +void (*dummy) () = foo; diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp index 7c5fcbe..686b327 100644 --- a/ld/testsuite/ld-scripts/crossref.exp +++ b/ld/testsuite/ld-scripts/crossref.exp @@ -19,10 +19,12 @@ set test1 "NOCROSSREFS 1" set test2 "NOCROSSREFS 2" +set test3 "NOCROSSREFS 3" if { [which $CC] == 0 } { untested $test1 untested $test2 + untested $test3 return } @@ -94,3 +96,30 @@ if [string match "" $exec_output] then { fail $test2 } } + +# Check cross references for ld -r + +if { ![ld_compile $CC "$srcdir/$subdir/cross4.c" tmpdir/cross4.o] } { + unresolved $test3 + return +} + +if ![ld_relocate $ld tmpdir/cross3-partial.o "tmpdir/cross1.o tmpdir/cross4.o"] { + unresolved $test3 + return +} + +verbose -log "$ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o" + +catch "exec $ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o" exec_output + +set exec_output [prune_warnings $exec_output] + +regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output + +if [string match "" $exec_output] then { + pass $test3 +} else { + verbose -log "$exec_output" + fail $test3 +} |