[build] Disable SHF_MERGE on Solaris 10/x86 (PR bootstrap/84017)

Message ID yddzi4wg5cz.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series
  • [build] Disable SHF_MERGE on Solaris 10/x86 (PR bootstrap/84017)
Related show

Commit Message

Rainer Orth Jan. 29, 2018, 1:30 p.m.
As described in the PR, Solaris 10/x86 ld is broken when dealing with
the SHF_MERGE flag, causing the bootstrap to break in strange ways.
Solaris as doesn't support it, but gas does, so only gas/ld builds were
affected.

This patch forces HAVE_GAS_SHF_MERGE to 0 to work around this.

I've massively simplified the scan-assembler statements in
gcc.dg/debug/dwarf2/prod-options.c.  According to the original
submission, it is immaterial which concrete syntax is used for
DW_AT_producer, only that it's present in some form.

Bootstrapped on i386-pc-solaris2.10.  I've also tested the
prod-options.c part on i386-pc-solaris2.11, sparc-sun-solaris2.11 (as
and gas, which use different alternatives for the DW_AT_producer scan),
and x86_64-pc-linux-gnu.

Will commit to mainline shortly and backport to the gcc-6 and gcc-7
branches after some soak time.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-01-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/testsuite:
	PR bootstrap/84017
	* gcc.dg/debug/dwarf2/prod-options.c: Simplify DW_AT_producer scan.

	gcc:
	PR bootstrap/84017
	* configure.ac (gcc_cv_as_shf_merge): Disable on Solaris 10/x86.
	* configure: Regenerate.

Comments

Jakub Jelinek Jan. 29, 2018, 1:36 p.m. | #1
On Mon, Jan 29, 2018 at 02:30:04PM +0100, Rainer Orth wrote:
> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c

> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c

> @@ -4,8 +4,7 @@

>     as well.  */

>  /* { dg-do compile } */

>  /* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */

> -/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */

> -/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */

> +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C|\"GNU C\[^\\n\\r\]+ DW_AT_producer" } } */

>  /* { dg-final { scan-assembler-not "debug-prefix-map" } } */


In this case, even better would be to add
-fno-merge-debug-strings
to dg-options and scan for just one pattern.

	Jakub
Rainer Orth Jan. 29, 2018, 2 p.m. | #2
Hi Jakub,

> On Mon, Jan 29, 2018 at 02:30:04PM +0100, Rainer Orth wrote:

>> --- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c

>> +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c

>> @@ -4,8 +4,7 @@

>>     as well.  */

>>  /* { dg-do compile } */

>>  /* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */

>> -/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */

>> -/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */

>> +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C|\"GNU C\[^\\n\\r\]+ DW_AT_producer" } } */

>>  /* { dg-final { scan-assembler-not "debug-prefix-map" } } */

>

> In this case, even better would be to add

> -fno-merge-debug-strings

> to dg-options and scan for just one pattern.


that's even simpler, thanks for the hint.

Revised patch tested as before.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-01-28  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/testsuite:
	PR bootstrap/84017
	* gcc.dg/debug/dwarf2/prod-options.c: Add -fno-merge-debug-strings
	to dg-options.
	Simplify DW_AT_producer scan.

	gcc:
	PR bootstrap/84017
	* configure.ac (gcc_cv_as_shf_merge): Disable on Solaris 10/x86.
	* configure: Regenerate.
# HG changeset patch
# Parent  2b36ffcd7331629b3a37b6c434ad862c197fdde9
Disable SHF_MERGE on Solaris 10/x86 (PR bootstrap/84017)

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2954,6 +2954,14 @@ if test $gcc_cv_as_shf_merge = no; then
     [elf,2,12,0], [--fatal-warnings],
     [.section .rodata.str, "aMS", %progbits, 1])
 fi
+case "$target" in
+  i?86-*-solaris2.10* | x86_64-*-solaris2.10*)
+    # SHF_MERGE support in Solaris 10/x86 ld is broken.
+    if test x"$gnu_ld" = xno; then
+      gcc_cv_as_shf_merge=no
+    fi
+    ;;
+esac
 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
   [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
@@ -3,9 +3,8 @@
    the build not reproducible.  Other skipped options could be tested here
    as well.  */
 /* { dg-do compile } */
-/* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */
-/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */
-/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */
+/* { dg-options "-O2 -gdwarf -dA -fno-merge-debug-strings -fdebug-prefix-map=a=b" } */
+/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" } } */
 /* { dg-final { scan-assembler-not "debug-prefix-map" } } */
 
 void func (void)

Patch

# HG changeset patch
# Parent  1d4d7906b123d09089bb93d9833791c855b52578
Disable SHF_MERGE on Solaris 10/x86 (PR bootstrap/84017)

diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2954,6 +2954,14 @@  if test $gcc_cv_as_shf_merge = no; then
     [elf,2,12,0], [--fatal-warnings],
     [.section .rodata.str, "aMS", %progbits, 1])
 fi
+case "$target" in
+  i?86-*-solaris2.10* | x86_64-*-solaris2.10*)
+    # SHF_MERGE support in Solaris 10/x86 ld is broken.
+    if test x"$gnu_ld" = xno; then
+      gcc_cv_as_shf_merge=no
+    fi
+    ;;
+esac
 AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
   [`if test $gcc_cv_as_shf_merge = yes; then echo 1; else echo 0; fi`],
 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c
@@ -4,8 +4,7 @@ 
    as well.  */
 /* { dg-do compile } */
 /* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */
-/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */
-/* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */
+/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C|\"GNU C\[^\\n\\r\]+ DW_AT_producer" } } */
 /* { dg-final { scan-assembler-not "debug-prefix-map" } } */
 
 void func (void)