Suppress explicit dwarf2 tests under Clang due to reliance on global inline asm ordering

Message ID CAENS6EtU-0ReLWH8kOU8GWw41i5OKnFzMt6sCHtnuu3ryXJ+_A@mail.gmail.com
State Under Review, archived
Headers

Commit Message

David Blaikie April 8, 2014, 9:22 p.m. UTC
  (contrary to my prior claim, I do seem to have commit after review
access to gdb (I see my name in the commit log) - I'll just have to
figure out how to do that... - so I just need approval, don't need
someone to commit this for me)

These were all the tests that I could find that had "asm.*\.globl" in
a c file. All of them had failures under Clang except for
dw2-unresolved.exp, though the resulting dwarf would still be
incorrect in that test it was just "getting lucky", I suppose. For
sanity I disabled it as well.

"unsupported" seemed like the right result to use according to
http://ftp.gnu.org/old-gnu/Manuals/dejagnu-1.3/html_chapter/dejagnu_3.html
- even though "untested" seems to be often used synonymously (the
dejagnu manual seems to indicate that untested shouldn't be used for
these sort of cases where there is test coverage it just can't be run
in this configuration).

>From the commit message/ChangeLog:

    Flag explicit dwarf2 tests as unsupported under Clang.

    Clang doesn't guarantee ordering of global and namespace scope inline
    asm relative to other entities, even at -O0. This ordering is required
    to define the range labels for the dwarf2 tests containing hardcoded
    assembly files.

    Introduce a detection utility function and use that in the handful of
    test cases that rely on this feature.

    gdb/testsuite
        * lib/gdb.exp (has_unreliable_inline_asm_ordering): Utility function
          for testing support for global or namespace scope inline asm ordering.
        * gdb.dwarf2/dw2-abs-hi-pc.exp: Unsupported under the above condition.
        * gdb.dwarf2/dw2-case-insensitive.exp: Ditto
        * gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Ditto
        * gdb.dwarf2/dw2-entry-value.exp: Ditto
        * gdb.dwarf2/dw2-ifort-parameter.exp: Ditto
        * gdb.dwarf2/dw2-inline-param.exp: Ditto
        * gdb.dwarf2/dw2-noloc.exp: Ditto
        * gdb.dwarf2/dw2-param-error.exp: Ditto
        * gdb.dwarf2/dw2-ref-missing-frame.exp: Ditto
        * gdb.dwarf2/dw2-skip-prologue.exp: Ditto
        * gdb.dwarf2/dw2-unresolved.exp: Ditto
        * gdb.mi/dw2-ref-missing-frame.exp: Ditto
commit eabfb416b9f232d64f356e86c77e22f8403d5aa4
Author: David Blaikie <dblaikie@gmail.com>
Date:   Tue Apr 8 14:03:04 2014 -0700

    Flag explicit dwarf2 tests as unsupported under Clang.
    
    Clang doesn't guarantee ordering of global and namespace scope inline
    asm relative to other entities, even at -O0. This ordering is required
    to define the range labels for the dwarf2 tests containing hardcoded
    assembly files.
    
    Introduce a detection utility function and use that in the handful of
    test cases that rely on this feature.
    
    gdb/testsuite
        * lib/gdb.exp (has_unreliable_inline_asm_ordering): Utility function
          for testing support for global or namespace scope inline asm ordering.
        * gdb.dwarf2/dw2-abs-hi-pc.exp: Unsupported under the above condition.
        * gdb.dwarf2/dw2-case-insensitive.exp: Ditto
        * gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Ditto
        * gdb.dwarf2/dw2-entry-value.exp: Ditto
        * gdb.dwarf2/dw2-ifort-parameter.exp: Ditto
        * gdb.dwarf2/dw2-inline-param.exp: Ditto
        * gdb.dwarf2/dw2-noloc.exp: Ditto
        * gdb.dwarf2/dw2-param-error.exp: Ditto
        * gdb.dwarf2/dw2-ref-missing-frame.exp: Ditto
        * gdb.dwarf2/dw2-skip-prologue.exp: Ditto
        * gdb.dwarf2/dw2-unresolved.exp: Ditto
        * gdb.mi/dw2-ref-missing-frame.exp: Ditto
  

Comments

Pedro Alves May 1, 2014, 8:30 a.m. UTC | #1
On 04/08/2014 10:22 PM, David Blaikie wrote:
> (contrary to my prior claim, I do seem to have commit after review
> access to gdb (I see my name in the commit log) - I'll just have to
> figure out how to do that... - so I just need approval, don't need
> someone to commit this for me)
> 
> These were all the tests that I could find that had "asm.*\.globl" in
> a c file. All of them had failures under Clang except for
> dw2-unresolved.exp, though the resulting dwarf would still be
> incorrect in that test it was just "getting lucky", I suppose. For
> sanity I disabled it as well.
> 
> "unsupported" seemed like the right result to use according to
> http://ftp.gnu.org/old-gnu/Manuals/dejagnu-1.3/html_chapter/dejagnu_3.html
> - even though "untested" seems to be often used synonymously (the
> dejagnu manual seems to indicate that untested shouldn't be used for
> these sort of cases where there is test coverage it just can't be run
> in this configuration).
> 
> From the commit message/ChangeLog:
> 
>     Flag explicit dwarf2 tests as unsupported under Clang.
> 
>     Clang doesn't guarantee ordering of global and namespace scope inline
>     asm relative to other entities, even at -O0. 

You mean that the asms might end up emitted with order swapped, or
that other code might end up in between them?  I suspect the latter.
Can please you show a GCC vs clang example?  If indeed the latter,
this is something that GCC itself might do too with optimization
enabled, right?
  

Patch

diff --git gdb/testsuite/ChangeLog gdb/testsuite/ChangeLog
index 5fca9d2..2989e20 100644
--- gdb/testsuite/ChangeLog
+++ gdb/testsuite/ChangeLog
@@ -1,3 +1,20 @@ 
+2014-04-08  David Blaikie  <dblaikie@gmail.com>
+
+	* lib/gdb.exp (has_unreliable_inline_asm_ordering): Utility function
+	for testing support for global or namespace scope inline asm ordering.
+	* gdb.dwarf2/dw2-abs-hi-pc.exp: Unsupported under the above condition.
+	* gdb.dwarf2/dw2-case-insensitive.exp: Ditto
+	* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Ditto
+	* gdb.dwarf2/dw2-entry-value.exp: Ditto
+	* gdb.dwarf2/dw2-ifort-parameter.exp: Ditto
+	* gdb.dwarf2/dw2-inline-param.exp: Ditto
+	* gdb.dwarf2/dw2-noloc.exp: Ditto
+	* gdb.dwarf2/dw2-param-error.exp: Ditto
+	* gdb.dwarf2/dw2-ref-missing-frame.exp: Ditto
+	* gdb.dwarf2/dw2-skip-prologue.exp: Ditto
+	* gdb.dwarf2/dw2-unresolved.exp: Ditto
+	* gdb.mi/dw2-ref-missing-frame.exp: Ditto
+
 2014-04-08  Pierre Muller  <muller@sourceware.org>
 
 	* gdb.base/printcmds.exp (test_artificial_arrays): Disable
diff --git gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
index 4ca16cf..81a6079 100644
--- gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile
 set executable ${testfile}
 
diff --git gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
index c18533c..a94c841 100644
--- gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-case-insensitive.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .c dw2-case-insensitive-debug.S
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} \
diff --git gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
index 0579fa4..ff74be0 100644
--- gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-cp-infcall-ref-static.exp
@@ -25,6 +25,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .S dw2-cp-infcall-ref-static-main.c
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} \
diff --git gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
index d1f8e2f..69bb22f 100644
--- gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-entry-value.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 if { [prepare_for_testing dw2-entry-value.exp "dw2-entry-value" {dw2-entry-value-main.c dw2-entry-value.S} {nodebug}] } {
     return -1
 }
diff --git gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
index 026e071..f909cb5 100644
--- gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
@@ -22,6 +22,11 @@  if {![dwarf2_support]} {
     return 0
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .c dw2-ifort-parameter-dw.S
 
 # Make some DWARF for the test.
diff --git gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
index 82c3ed1..f0f9903 100644
--- gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-inline-param.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .S dw2-inline-param-main.c
 
 if { [prepare_for_testing ${testfile}.exp "${testfile}" \
diff --git gdb/testsuite/gdb.dwarf2/dw2-noloc.exp gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
index 0b17bd4..80ba90a 100644
--- gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-noloc.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 if { [prepare_for_testing dw2-noloc.exp "dw2-noloc" {dw2-noloc-main.c dw2-noloc.S} {nodebug}] } {
     return -1
 }
diff --git gdb/testsuite/gdb.dwarf2/dw2-param-error.exp gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
index 11e8f03..0155234 100644
--- gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-param-error.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .S dw2-param-error-main.c
 
 if { [prepare_for_testing ${testfile}.exp "${testfile}" \
diff --git gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
index 37b2edf..f07a3f8 100644
--- gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .S
 set srcfuncfile ${testfile}-func.c
 set srcmainfile ${testfile}-main.c
diff --git gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
index 7bea4cf..e350dd0 100644
--- gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp
@@ -36,6 +36,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile
 set executable ${testfile}
 
diff --git gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
index 95d065c..2ffc4f3 100644
--- gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
+++ gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp
@@ -19,6 +19,11 @@  if {![dwarf2_support]} {
     return 0  
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 if { [prepare_for_testing dw2-unresolved.exp "dw2-unresolved" {dw2-unresolved-main.c dw2-unresolved.S} {nodebug}] } {
     return -1
 }
diff --git gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
index 967308f..836d152 100644
--- gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
+++ gdb/testsuite/gdb.mi/dw2-ref-missing-frame.exp
@@ -22,6 +22,11 @@  if {![dwarf2_support]} {
     return 0
 }
 
+if [has_unreliable_inline_asm_ordering] {
+    unsupported "Compiler doesn't guarantee ordering of global inline asm relative to other entities"
+    return 0
+}
+
 standard_testfile .S dw2-ref-missing-frame-func.c dw2-ref-missing-frame-main.c
 set objsfile [standard_output_file ${testfile}.o]
 set objfuncfile [standard_output_file ${testfile}-func.o]
diff --git gdb/testsuite/lib/gdb.exp gdb/testsuite/lib/gdb.exp
index 73e935a..c668c50 100644
--- gdb/testsuite/lib/gdb.exp
+++ gdb/testsuite/lib/gdb.exp
@@ -2592,6 +2592,10 @@  proc test_compiler_info { {compiler ""} } {
     return [string match $compiler $compiler_info]
 }
 
+proc has_unreliable_inline_asm_ordering { } {
+    return ![get_compiler_info] && [test_compiler_info clang*]
+}
+
 proc current_target_name { } {
     global target_info
     if [info exists target_info(target,name)] {