+
+# Test objcopying an object file without global symbol
+
+proc objcopy_test_without_global_symbol { } {
+ global OBJCOPY
+ global OBJCOPYFLAGS
+ global OBJDUMP
+ global OBJDUMPFLAGS
+ global srcdir
+ global subdir
+
+ set test "strip without global symbol "
+
+ if { [target_compile $srcdir/$subdir/pr19547.c tmpdir/pr19547.o object debug] != "" } {
+ untested $test
+ return
+ }
+
+ if [is_remote host] {
+ set objfile [remote_download host tmpdir/pr19547.o]
+ } else {
+ set objfile tmpdir/pr19547.o
+ }
+
+ set exec_output [binutils_run $OBJCOPY "$OBJCOPYFLAGS --strip-unneeded $objfile"]
+ set exec_output [prune_warnings $exec_output]
+ if ![string equal "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run $OBJDUMP "$OBJDUMPFLAGS -t $objfile"]
+ set exec_output [prune_warnings $exec_output]
+ if {![regexp "no symbols" $exec_output]} {
+ fail $test
+ return
+ }
+
+ pass $test
+}
+
+# The AArch64 and ARM targets preserve mapping symbols
+# in object files, so they will fail this test.
+setup_xfail aarch64*-*-* arm*-*-*
+
+objcopy_test_without_global_symbol
+
+# objcopy remove relocation from executable test
+
+proc objcopy_remove_relocations_from_executable { } {
+ global OBJCOPY
+ global srcdir
+ global subdir
+ global READELF
+
+ set test "remove-section relocation sections"
+
+ if { [target_compile $srcdir/$subdir/testprog.c tmpdir/pr23611 executable debug] != "" } {
+ untested $test
+ return
+ }
+
+ if [is_remote host] {
+ set objfile [remote_download host tmpdir/pr23611]
+ } else {
+ set objfile tmpdir/pr23611
+ }
+ set out tmpdir/pr23611.out
+
+ set exec_output1 [binutils_run $OBJCOPY "-R .rela.plt -R .rela.dyn -R .rel.plt -R .rel.dyn $objfile $out"]
+ set exec_output2 [binutils_run $READELF "-S $out"]
+ if { [string match "*.rel.plt*" $exec_output2] || [string match "*.rela.plt*" $exec_output2] || [string match "*.rel.dyn*" $exec_output2] || [string match "*.rela.dyn*" $exec_output2] } {
+ fail $test
+ return
+ }
+ pass $test
+}
+
+objcopy_remove_relocations_from_executable
+
+run_dump_test "pr23633"
+
+run_dump_test "set-section-alignment"