X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=ld%2Ftestsuite%2Fld-gc%2Fgc.exp;h=97ccf6a7a9be658793c7af9e5d99564992e3e05a;hb=e2c8dab6ae8654a928ab9364d5090781a4a6f62f;hp=ddbbd519f1dd3041eb936a7cfe017d88ae6ac0b3;hpb=b9b2ae8bbf911b7762fe41ecbb5dbc64a8e2b5a7;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp index ddbbd519f1..97ccf6a7a9 100644 --- a/ld/testsuite/ld-gc/gc.exp +++ b/ld/testsuite/ld-gc/gc.exp @@ -1,6 +1,5 @@ # Expect script for ld-gc tests -# Copyright 2008, 2009, 2010, 2012 -# Free Software Foundation, Inc. +# Copyright (C) 2008-2020 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -24,7 +23,7 @@ if ![check_gc_sections_available] { return } -set cflags "-ffunction-sections -fdata-sections" +set cflags "-ffunction-sections -fdata-sections $NOSANTIZE_CFLAGS" set objfile "tmpdir/gc.o" if [istarget powerpc64*-*-*] { @@ -37,7 +36,7 @@ if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] } { set cflags "$cflags -fomit-frame-pointer -mshort" } -if { [is_remote host] || [which $CC] != 0 } { +if { [check_compiler_available] } { ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/gc.c $objfile } @@ -55,18 +54,9 @@ proc test_gc { testname filename linker ldflags} { set outfile "tmpdir/$filename" set options "-L$srcdir/$subdir" - append options " " $ldflags " " [ld_simple_link_defsyms] " " $objfile - - # SH64 targets needs an extra ld option for this test. - if [istarget sh64*-*-*] { - if [istarget sh64*l*-*-*] { - set options "-mshlelf32 $options" - } else { - set options "-mshelf32 $options" - } - } + append options " " $ldflags " " [ld_link_defsyms] " " $objfile - if ![ld_simple_link $linker $outfile $options] { + if ![ld_link $linker $outfile $options] { fail $testname return } @@ -102,37 +92,88 @@ test_gc "Check --gc-section/-r/-u" "gcrel" $ld "-r --gc-sections -u used_func" run_dump_test "noent" run_dump_test "abi-note" run_dump_test "start" +run_dump_test "stop" +run_dump_test "pr19167" +if { [is_elf_format] } then { + run_dump_test "all-debug-sections" + run_dump_test "pr20882" +} if { [is_elf_format] && [check_shared_lib_support] } then { set gasopt "" if { [istarget tic6x-*] } then { set gasopt "-mpic -mpid=near" } + # These targets do not default to linking with shared libraries. + set old_ldflags $LDFLAGS + if { [istarget "mips*vr4100*-*-elf*"] \ + || [istarget "mips*vr4300*-*-elf*"] \ + || [istarget "mips*vr5000*-*-elf*"] } { + append LDFLAGS " -call_shared" + } if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/libpersonality.s tmpdir/libpersonality.o] - || ![ld_simple_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then { + || ![ld_link $ld tmpdir/libpersonality.so "-shared tmpdir/libpersonality.o"] } then { fail libpersonality } else { run_dump_test "personality" } + run_dump_test "pr18223" + if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/pr20022a.s tmpdir/pr20022a.o] + || ![ld_link $ld tmpdir/pr20022.so "-shared --gc-sections tmpdir/pr20022a.o"] } then { + fail pr20022 + } else { + run_dump_test "pr20022" + } + set LDFLAGS $old_ldflags } -if { [is_remote host] || [which $CC] != 0 } { +if { [check_compiler_available] } { if { [istarget "*-*-linux*"] || [istarget "*-*-nacl*"] || [istarget "*-*-gnu*"] } { ld_compile "$CC -fPIC $CFLAGS $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o - ld_simple_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o" + ld_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o" ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o run_dump_test "pr11218" } } -if { [is_remote host] || [which $CC] != 0 } { +if { [check_compiler_available] } { ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr13683.c tmpdir/pr13683.o run_dump_test "pr13683" } -if { [is_remote host] || [which $CC] != 0 } { - ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o +if { [check_compiler_available] } { + ld_compile "$CC $CFLAGS $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o run_dump_test "pr14265" } + +if { [check_compiler_available] } { + ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-1.c tmpdir/pr19161-1.o + ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-2.c tmpdir/pr19161-2.o + set saved_LDFLAGS "$LDFLAGS" + if [istarget hppa*-*-linux*] { + set LDFLAGS "$LDFLAGS --defsym '\$\$dyncall=0'" + } + run_dump_test "pr19161" + set LDFLAGS "$saved_LDFLAGS" +} + +if { [is_elf_format] && [check_shared_lib_support] \ + && [check_compiler_available] } { + run_cc_link_tests [list \ + [list \ + "Build libpr20306.so" \ + "-shared" \ + "-fPIC" \ + {pr20306.c} \ + {} \ + "libpr20306.so" \ + ] \ + ] + run_dump_test "pr20306" +} + +if { [is_elf_format] } then { + run_dump_test "skip-map-discarded" +}