Add objcopy stage between assembly and linking for run_dump_test
authormfortune <matthew.fortune@imgtec.com>
Tue, 27 May 2014 11:37:50 +0000 (12:37 +0100)
committermfortune <matthew.fortune@imgtec.com>
Wed, 28 May 2014 15:21:19 +0000 (16:21 +0100)
ld/testsuite/

* lib/ld-lib.exp: Add objcopy_objects command to run_dump_test.
This allows each input object to be optionally run through
objcopy before linking.

ld/testsuite/ChangeLog
ld/testsuite/lib/ld-lib.exp

index 158d9a699a52ac4f1fce42a1f9fdefaee6d410a0..bd604b6381332867976c289cebd60b53198b7f4b 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-28  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       * lib/ld-lib.exp: Add objcopy_objects command to run_dump_test.
+       This allows each input object to be optionally run through
+       objcopy before linking.
+
 2014-05-20  Will Newton  <will.newton@linaro.org>
 
        * ld-shared/shared.exp: Mark non-PIC shared object tests
index 369dc1f7a1bc16617040ff1eda3073db99a88a41..27bfc08e945d1f43886d744187fb1f67a1643565 100644 (file)
@@ -497,6 +497,11 @@ proc ld_simple_link_defsyms {} {
 #   ld_after_inputfiles: FLAGS
 #       Similar to "ld", but put after all input files.
 #
+#   objcopy_objects: FLAGS
+#      Run objcopy with the specified flags after assembling any source
+#      that has the special marker RUN_OBJCOPY in the source specific
+#      flags.
+#
 #   objcopy_linked_file: FLAGS
 #      Run objcopy on the linked file with the specified flags.
 #      This lets you transform the linked file using objcopy, before the
@@ -605,6 +610,7 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(error) {}
     set opts(warning) {}
     set opts(objcopy_linked_file) {}
+    set opts(objcopy_objects) {}
 
     foreach i $opt_array {
        set opt_name [lindex $i 0]
@@ -784,6 +790,12 @@ proc run_dump_test { name {extra_options {}} } {
     for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
        set sourcefile [lindex $sourcefiles $i]
        set sourceasflags [lindex $asflags $i]
+       set run_objcopy_objects 0
+
+       if { [string match "*RUN_OBJCOPY*" $sourceasflags] } {
+           set run_objcopy_objects 1
+       }
+       regsub "RUN_OBJCOPY" $sourceasflags "" sourceasflags
 
        set objfile "tmpdir/dump$i.o"
        catch "exec rm -f $objfile" exec_output
@@ -807,6 +819,30 @@ proc run_dump_test { name {extra_options {}} } {
            fail $testname
            return
        }
+
+       if { $run_objcopy_objects } {
+           set cmd "$OBJCOPY $opts(objcopy_objects) $objfile"
+
+           send_log "$cmd\n"
+           set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] \
+                       "" "/dev/null" "objcopy.tmp"]
+           remote_upload host "objcopy.tmp"
+           set comp_output [prune_warnings [file_contents "objcopy.tmp"]]
+           remote_file host delete "objcopy.tmp"
+           remote_file build delete "objcopy.tmp"
+
+           if { [lindex $cmdret 0] != 0 \
+                 || ![string match "" $comp_output] } {
+               send_log "$comp_output\n"
+               verbose "$comp_output" 3
+
+               set exitstat "succeeded"
+               if { $cmdret != 0 } { set exitstat "failed" }
+               verbose -log "$exitstat with: <$comp_output>"
+               fail $testname
+               return
+           }
+       }
     }
 
     set expmsg $opts(error)
This page took 0.029242 seconds and 4 git commands to generate.