From: Alan Modra Date: Mon, 27 Jul 2020 09:18:57 +0000 (+0930) Subject: Allow new just-symbols test to run on XCOFF and PE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32377a8037eefae8091f345546f52370ed515399;p=binutils-gdb.git 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index ef8f64869e8..99dfea8c0ec 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2020-07-27 Alan Modra + + * 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 * testsuite/lib/ld-lib.exp (check_ctf_available): Check first that diff --git a/ld/testsuite/ld-misc/just-symbols-1.dd b/ld/testsuite/ld-misc/just-symbols-1.dd index 8908a235ae9..9502566ac9c 100644 --- a/ld/testsuite/ld-misc/just-symbols-1.dd +++ b/ld/testsuite/ld-misc/just-symbols-1.dd @@ -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 diff --git a/ld/testsuite/ld-misc/just-symbols.exp b/ld/testsuite/ld-misc/just-symbols.exp index 1c1f866b737..59c725d0d2c 100644 --- a/ld/testsuite/ld-misc/just-symbols.exp +++ b/ld/testsuite/ld-misc/just-symbols.exp @@ -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" diff --git a/ld/testsuite/ld-misc/just-symbols.ld b/ld/testsuite/ld-misc/just-symbols.ld index 3d6598757a0..51d3b14bfa3 100644 --- a/ld/testsuite/ld-misc/just-symbols.ld +++ b/ld/testsuite/ld-misc/just-symbols.ld @@ -1,7 +1,7 @@ SECTIONS { .text : { *(.text) } - .data : { *(.data) } - .bss : { *(.bss) } + .data : { *(.data .rw) } + .bss : { *(.bss) } /DISCARD/ : { *(*) } }