Garbage collecting debug sections
[deliverable/binutils-gdb.git] / ld / testsuite / ld-gc / gc.exp
index acadcba38b7e68f0d43ebc7d230d106bb6a93aeb..58f3a2ae07e0051a3ae48d564eb2b62399bea727 100644 (file)
@@ -1,6 +1,5 @@
 # Expect script for ld-gc tests
-#   Copyright 2008
-#   Free Software Foundation, Inc.
+#   Copyright (C) 2008-2015 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -27,7 +26,17 @@ if ![check_gc_sections_available] {
 set cflags "-ffunction-sections -fdata-sections"
 set objfile "tmpdir/gc.o"
 
-if { [is_remote host] || [which $CC] } {
+if [istarget powerpc64*-*-*] {
+    # otherwise with -mcmodel=medium gcc we get XPASSes.
+    set cflags "$cflags -mminimal-toc"
+}
+
+if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] } {
+    # Otherwise tests FAIL due to _.frame
+    set cflags "$cflags -fomit-frame-pointer -mshort"
+}
+
+if { [is_remote host] || [which $CC] != 0 } {
     ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/gc.c $objfile
 }
 
@@ -44,9 +53,20 @@ 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"
+       }
+    }
 
-    if ![ld_simple_link $linker $outfile "-L$srcdir/$subdir $ldflags $objfile"] {
-           fail $testname
+    if ![ld_simple_link $linker $outfile $options] {
+       fail $testname
        return
     }
     if ![ld_nm $nm "" $outfile] {
@@ -60,6 +80,9 @@ proc test_gc { testname filename linker ldflags} {
        fail $testname
        return
     }
+    #ppc64_elf_gc_mark_hook needs to be taught how to look through
+    #the .toc section to properly mark variable sections for gc.
+    setup_xfail "powerpc64*-*-*"
     if {[info exists nm_output(unused_func)] \
            || [info exists nm_output(unused_var)]} {
        send_log "unused section still here\n"
@@ -76,3 +99,42 @@ test_gc "Check --gc-section/-r/-e" "gcrel" $ld "-r --gc-sections -e main"
 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"
+if { [is_elf_format] } then {
+    run_dump_test "all-debug-sections"
+}
+
+if { [is_elf_format] && [check_shared_lib_support] } then {
+    set gasopt ""
+    if { [istarget tic6x-*] } then {
+       set gasopt "-mpic -mpid=near"
+    }
+    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 {
+       fail libpersonality
+    } else {
+       run_dump_test "personality"
+    }
+}
+
+if { [is_remote host] || [which $CC] != 0 } {
+    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_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 } {
+       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
+    run_dump_test "pr14265"
+}
This page took 0.024479 seconds and 4 git commands to generate.