diff mbox series

[testsuite] Fix comdat_group check with Solaris as

Message ID yddinbhoemh.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series [testsuite] Fix comdat_group check with Solaris as | expand

Commit Message

Rainer Orth Jan. 31, 2018, 10:19 p.m. UTC
While refining the COMDAT group on Solaris 10 patch

	https://gcc.gnu.org/ml/gcc-patches/2018-01/msg02257.html

I noticed that the comdat_group effective-target keyword didn't work
when using Solaris as.  No wonder, actually, given the different
syntaxes used:

* with sparc as

	.group  _Z3foov,".text._Z3foov%_Z3foov",#comdat

* with x86 as:

        .group  _Z3foov,.text._Z3foov%_Z3foov,#comdat

* with gas (sparc and x86):

	.section        .text._Z3foov,"axG",@progbits,_Z3foov,comdat      

The following patch fixes this.

Bootstrapped without regressions on i386-pc-solaris2.11 and
sparc-sun-solaris2.11 (as and gas each).  The only existing uses change
as expected:

* With as:

  g++.dg/tm/pr47573.C	UNSUPPORTED -> PASS
  g++.dg/ipa/pr64612.C	scans now PASS

* With gas: no change

At the same time, I've adjusted g++.dg/debug/dwarf2/nested-4.C as
follows: before, the scan-assembler-times "debug_types" 2 test was
xfailed on *-*-solaris2.1[1-9]* && !gas.

The reason is as follows:

* With Solaris as, COMDAT group syntax is differs, so we have

        .section        .debug_types%wt.4e05dcd4da926741,"",@progbits
        .group  wt.4e05dcd4da926741,.debug_types%wt.4e05dcd4da926741,#comdat
        .section        .debug_types%wt.b606c86c38313abe,"",@progbits
        .group  wt.b606c86c38313abe,.debug_types%wt.b606c86c38313abe,#comdat
        .section        .debug_types%wt.b606c86c38313abe,"",@progbits
        .section        .debug_types%wt.4e05dcd4da926741,"",@progbits

* With gas or as, but no comdat, we have

        .section        .debug_types,"",@progbits
        .section        .debug_types,"",@progbits

* With gas and comdat, we have

        .section        .debug_types,"G",@progbits,wt.4e05dcd4da926741,comdat
        .section        .debug_types,"G",@progbits,wt.b606c86c38313abe,comdat

So we need to xfail in the as/comdat case, as this patch does.

Installed on mainline.

	Rainer
diff mbox series

Patch

# HG changeset patch
# Parent  1125e724541b493d75e4a215f8426cb530d7f623
Fix comdat_group check with Solaris as

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8985,7 +8985,7 @@  proc check_effective_target_tls_get_addr
 # Return 1 if the target uses comdat groups.
 
 proc check_effective_target_comdat_group {} {
-    return [check_no_messages_and_pattern comdat_group "\.section\[^\n\r]*,comdat" assembly {
+    return [check_no_messages_and_pattern comdat_group "\.section\[^\n\r]*,comdat|\.group\[^\n\r]*,#comdat" assembly {
 	// C++
 	inline int foo () { return 1; }
 	int (*fn) () = foo;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C b/gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C
--- a/gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/nested-4.C
@@ -1,6 +1,6 @@ 
 // PR debug/53235
 // { dg-options "-gdwarf-4 -fdebug-types-section" }
-// { dg-final { scan-assembler-times "debug_types" 2 { xfail { powerpc-ibm-aix* || { *-*-darwin* || { *-*-solaris2.1[1-9]* && { ! gas } } } } } } }
+// { dg-final { scan-assembler-times "debug_types" 2 { xfail { powerpc-ibm-aix* || { *-*-darwin* || { *-*-solaris2.* && { comdat_group && { ! gas } } } } } } } }
 
 namespace E {
   class O {};