diff mbox

[build] Properly set progbits/nobits for Solaris/SPARC as

Message ID yddlibc88k8.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Jan. 29, 2013, 12:42 p.m. UTC
As originally reported as binutils PR ld/15057, several gfortran tests
are failing on Solaris/SPARC with Sun as and GNU ld like this:

FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib  -O2  -lcaf_single (test for excess errors)
Excess errors:
/vol/gcc/bin/gld-2.23.1: warning: section `.bss' type changed to PROGBITS

As analyzed in the PR, this happens because .bss.* sections are not
marked as SHT_NOBITS when Sun as is in use.  The following patch fixes
this; it should be low-risk since the result of the configure test
(necessary since only Solaris 10/SPARC as added #nobits/#progbits
support) is only used in a Solaris-specific function.

Bootstrapped without regressions on sparc-sun-solaris2.11 (as/gld,
gas/gld in progress), ok for mainline?

	Rainer


2013-01-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (HAVE_AS_SPARC_NOBITS): New test.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/sparc/sparc.c (sparc_solaris_elf_asm_named_section): Emit
	#nobits/#progbits if supported.

Comments

Paolo Bonzini Jan. 29, 2013, 2:38 p.m. UTC | #1
Il 29/01/2013 13:42, Rainer Orth ha scritto:
> As originally reported as binutils PR ld/15057, several gfortran tests
> are failing on Solaris/SPARC with Sun as and GNU ld like this:
> 
> FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=lib  -O2  -lcaf_single (test for excess errors)
> Excess errors:
> /vol/gcc/bin/gld-2.23.1: warning: section `.bss' type changed to PROGBITS
> 
> As analyzed in the PR, this happens because .bss.* sections are not
> marked as SHT_NOBITS when Sun as is in use.  The following patch fixes
> this; it should be low-risk since the result of the configure test
> (necessary since only Solaris 10/SPARC as added #nobits/#progbits
> support) is only used in a Solaris-specific function.
> 
> Bootstrapped without regressions on sparc-sun-solaris2.11 (as/gld,
> gas/gld in progress), ok for mainline?

Ok.

Paolo
diff mbox

Patch

# HG changeset patch
# Parent 85fc0b8b3ae505640c01266617905fe671551692
Properly set progbits/nobits for Solaris/SPARC as

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -9512,7 +9512,14 @@  sparc_solaris_elf_asm_named_section (con
   if (flags & SECTION_CODE)
     fputs (",#execinstr", asm_out_file);
 
-  /* ??? Handle SECTION_BSS.  */
+  /* Sun as only supports #nobits/#progbits since Solaris 10.  */
+  if (HAVE_AS_SPARC_NOBITS)
+    {
+      if (flags & SECTION_BSS)
+	fputs (",#nobits", asm_out_file);
+      else
+	fputs (",#progbits", asm_out_file);
+    }
 
   fputc ('\n', asm_out_file);
 }
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3461,6 +3461,13 @@  case "$target" in
       [AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
 		[Define if your assembler supports .register.])])
 
+    gcc_GAS_CHECK_FEATURE([@%:@nobits], gcc_cv_as_sparc_nobits,,,
+      [.section "nobits",#alloc,#write,#nobits
+       .section "progbits",#alloc,#write,#progbits])
+    AC_DEFINE_UNQUOTED(HAVE_AS_SPARC_NOBITS,
+      [`if test $gcc_cv_as_sparc_nobits = yes; then echo 1; else echo 0; fi`],
+      [Define to 1 if your assembler supports #nobits, 0 otherwise.])
+
     gcc_GAS_CHECK_FEATURE([-relax option], gcc_cv_as_sparc_relax,,
       [-relax], [.text],,
       [AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,