Remove the group section if all members are removed.
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / objcopy.exp
index 3ee8bbe94ef6416938a12d90551e87863c7d896f..a22e98c90bdd024c21d9664316bebcf90b72321b 100644 (file)
@@ -87,8 +87,8 @@ proc objcopy_test {testname srcfile} {
        setup_xfail "m68*-*-sysv*" "m68*-apple-aux*"
        setup_xfail "m8*-*"
        setup_xfail "or32-*-rtems*" "or32-*-coff"
-       setup_xfail "sh-*-coff*" "sh-*-rtems*" 
-       setup_xfail "tic4x-*-*" "tic80-*-*" "w65-*"
+       setup_xfail "sh-*-coff*"
+       setup_xfail "tic80-*-*" "w65-*"
 
        clear_xfail "hppa*64*-*-hpux*" "hppa*-*-linux*" "hppa*-*-lites*"
        clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*"
@@ -406,6 +406,7 @@ proc strip_test { } {
     global NMFLAGS
     global srcdir
     global subdir
+    global READELF
 
     set test "strip"
 
@@ -414,6 +415,19 @@ proc strip_test { } {
        return
     }
 
+    set osabi_fail "false"
+    if [is_elf_format] {
+       verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.in"
+       set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.in"]
+       if { [lindex $exec_output 0] != 0 } then {
+           unresolved "$test preserving OS/ABI"        
+           set osabi_fail "true"
+       } else {
+           verbose -log "grep OS/ABI tmpdir/osabi.in"
+           catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
+       }
+    }
+
     if [is_remote host] {
        set archive libstrip.a
        set objfile [remote_download host tmpdir/testprog.o]
@@ -428,21 +442,40 @@ proc strip_test { } {
     set exec_output [binutils_run $AR "rc $archive ${objfile}"]
     if ![string match "" $exec_output] {
        fail $test
+       unresolved "$test preserving OS/ABI"    
        return
     }
 
     set exec_output [binutils_run $STRIP "-g $archive"]
     if ![string match "" $exec_output] {
        fail $test
+       unresolved "$test preserving OS/ABI"    
        return
     }
 
     set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
     if ![string match "" $exec_output] {
        fail $test
+       unresolved "$test preserving OS/ABI"    
        return
     }
 
+    if { $osabi_fail != "true" && [is_elf_format] } {
+       verbose -log "$READELF -a tmpdir/testprog.o > tmpdir/osabi.out"
+       set exec_output [remote_exec host "$READELF -h tmpdir/testprog.o" "" "/dev/null" "tmpdir/osabi.out"]
+       if { [lindex $exec_output 0] != 0 } then {
+           unresolved "$test preserving OS/ABI"        
+       } else {
+           verbose -log "grep OS/ABI tmpdir/osabi.out"
+           catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
+           if { "$osabi_in" == "$osabi_out" } {
+               pass "$test preserving OS/ABI"
+           } else {
+               fail "$test preserving OS/ABI"
+           }
+       }
+    }
+
     if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } {
        untested $test
        return
@@ -531,7 +564,7 @@ proc copy_setup { } {
     set res [build_wrapper testglue.o]
     set flags { debug }
     
-    if { [istarget *-*-uclinux*] } {
+    if { [istarget *-*-uclinux*] && ![istarget tic6x-*-*] } {
        return 1
     }
     
@@ -649,6 +682,7 @@ proc copy_executable { prog flags test1 test2 } {
 proc strip_executable { prog flags test } {
     global NM
     global NMFLAGS
+    global READELF
     global host_triplet
 
     remote_file build delete tmpdir/striprog
@@ -659,6 +693,19 @@ proc strip_executable { prog flags test } {
        set copyfile tmpdir/striprog
     }
 
+    set osabi_fail "false"
+    if [is_elf_format] {
+       verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in"
+       set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"]
+       if { [lindex $exec_output 0] != 0 } then {
+           unresolved "$test preserving OS/ABI"        
+           set osabi_fail "true"
+       } else {
+           verbose -log "grep OS/ABI tmpdir/osabi.in"
+           catch "exec grep OS/ABI tmpdir/osabi.in" osabi_in
+       }
+     }
+
     set exec_output [binutils_run $prog "$flags ${copyfile}"]
     if ![string match "" $exec_output] {
        fail $test
@@ -679,6 +726,22 @@ proc strip_executable { prog flags test } {
         return
     }
 
+    if { $osabi_fail != "true" && [is_elf_format] } {
+       verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out"
+       set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"]
+       if { [lindex $exec_output 0] != 0 } then {
+           unresolved "$test preserving OS/ABI"        
+       } else {
+           verbose -log "grep OS/ABI tmpdir/osabi.out"
+           catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
+           if { "$osabi_in" == "$osabi_out" } {
+               pass "$test preserving OS/ABI"
+           } else {
+               fail "$test preserving OS/ABI"
+           }
+       }
+    }
+
     set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
     if ![string match "*: no symbols*" $exec_output] {
        fail $test
@@ -874,6 +937,7 @@ if [is_elf_format] {
     objcopy_test_readelf "ELF group" group-3.s
     objcopy_test_readelf "ELF group" group-4.s
     run_dump_test "group-5"
+    run_dump_test "group-6"
     run_dump_test "copy-1"
     run_dump_test "note-1"
 }
This page took 0.026429 seconds and 4 git commands to generate.