Allow new just-symbols test to run on XCOFF and PE

* testsuite/ld-misc/just-symbols.exp: Run for x86_64 PE too.
	Set LDFLAGS for PE and XCOFF.
	* testsuite/ld-misc/just-symbols.ld: Accept XCOFF mapped .data.
This commit is contained in:
Alan Modra 2020-07-27 18:48:57 +09:30
parent 93fd13c704
commit 32377a8037
4 changed files with 45 additions and 36 deletions

View File

@ -1,3 +1,9 @@
2020-07-27 Alan Modra <amodra@gmail.com>
* testsuite/ld-misc/just-symbols.exp: Run for x86_64 PE too.
Set LDFLAGS for PE and XCOFF.
* testsuite/ld-misc/just-symbols.ld: Accept XCOFF mapped .data.
2020-07-27 Alan Modra <amodra@gmail.com>
* testsuite/lib/ld-lib.exp (check_ctf_available): Check first that

View File

@ -1,5 +1,3 @@
.*: +file format .*
Contents of section \.data:
#...
[0-9a-f]+ (?:(:?12000000|00120000|00000012) 0{8}|0{8} 00000012) 0{8} 0{8} .*
#pass

View File

@ -20,38 +20,43 @@
#
# SH/PE targets complain about zero VMA.
# x86_64/PE targets hardcode VMA to 0x100000000.
if { [istarget sh-*-pe] \
|| [istarget x86_64-*-cygwin] \
|| [istarget x86_64-*-mingw*] \
|| [istarget x86_64-*-pe] \
|| [istarget x86_64-*-pep] } {
if { [istarget sh-*-pe] } {
return
}
run_ld_link_tests {
{"Object for --just-symbols test"
"-r -T just-symbols.ld" ""
""
{just-symbols-0.s}
{}
"just-symbols-0.o"}
{"Executable for --just-symbols test"
"-e 0 -T just-symbols.ld" ""
""
{just-symbols-0.s}
{}
"just-symbols-0"}
{"Object with --just-symbols test"
"-e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" ""
""
{just-symbols-1.s}
{{objdump {-s -j .data} just-symbols-1.dd}}
"just-symbols-1obj"}
{"Executable with --just-symbols test"
"-e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" ""
""
{just-symbols-1.s}
{{objdump {-s -j .data} just-symbols-1.dd}}
"just-symbols-1exe"}
set saved_LDFLAGS "$LDFLAGS"
if { [is_pecoff_format] } then {
# Avoid auto image-basing.
set LDFLAGS "$LDFLAGS --image-base 0"
} elseif { [is_xcoff_format] } then {
set LDFLAGS "$LDFLAGS -bnogc"
}
run_ld_link_tests [list \
[list "Object for --just-symbols test" \
"$LDFLAGS -r -T just-symbols.ld" "" \
"" \
{just-symbols-0.s} \
{} \
"just-symbols-0.o"] \
[list "Executable for --just-symbols test" \
"$LDFLAGS -e 0 -T just-symbols.ld" "" \
"" \
{just-symbols-0.s} \
{} \
"just-symbols-0"] \
[list "Object with --just-symbols test" \
"$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" "" \
"" \
{just-symbols-1.s} \
{{objdump -s just-symbols-1.dd}} \
"just-symbols-1obj"] \
[list "Executable with --just-symbols test" \
"$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" "" \
"" \
{just-symbols-1.s} \
{{objdump -s just-symbols-1.dd}} \
"just-symbols-1exe"] \
]
set LDFLAGS "$saved_LDFLAGS"

View File

@ -1,7 +1,7 @@
SECTIONS
{
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
.data : { *(.data .rw) }
.bss : { *(.bss) }
/DISCARD/ : { *(*) }
}