This one has been in my patch stack for a long timeā€¦

Darwin's "size" command has a different header line, reflecting the Mach-O
section naming conventions.  This causes tests using the command to fail
because scanasm.exp expects and checks specific layout of the header line.

Tested on i686, x86_64 and powerpc darwin and x86_64,powerpc-linux-gnu

OK for trunk?

Iain

gcc/testsuite/

        * lib/scanasm.exp (object-size): Handle Darwin's size command.

diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index 35ccbc86fc..231a4d66ba 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -460,15 +460,23 @@ proc object-size { args } {
     set text [lindex $output 1]
     set lines [split $text "\n"]
 
+    set l0match {^\s*text\s+data\s+bss\s+dec\s+hex\s+filename\s*$}
+    set l1match {^\s*\d+\s+\d+\s+\d+\s+\d+\s+[\da-fA-F]+\s+}
+
+    if { [istarget *-*-darwin*] } {
+      set l0match {^\s*__TEXT\s+__DATA\s+__OBJC\s+others\s+dec\s+hex\s*$}
+      set l1match {^\s*\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+[\da-fA-F]+\s+}
+    }
+
     set line0 [lindex $lines 0]
-    if ![regexp {^\s*text\s+data\s+bss\s+dec\s+hex\s+filename\s*$} $line0] {
+    if ![regexp $l0match $line0] {
         verbose -log "$testcase object-size: $size did not produce expected 
first line: $line0"
         unresolved "$testcase object-size $what $cmp $with"
         return
     }
 
     set line1 [lindex $lines 1]
-    if ![regexp {^\s*\d+\s+\d+\s+\d+\s+\d+\s+[\da-fA-F]+\s+} $line1] {
+    if ![regexp $l1match $line1] {
         verbose -log "$testcase object-size: $size did not produce expected 
second line: $line1"
         unresolved "$testcase object-size $what $cmp $with"
         return
-- 
2.17.1


Reply via email to