]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Support .lbss etc. sections with Solaris as (PR target/59407)
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 26 Apr 2016 10:06:16 +0000 (10:06 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 26 Apr 2016 10:06:16 +0000 (10:06 +0000)
PR target/59407
* config/i386/i386.c (SECTION_LARGE): Define.
(x86_64_elf_select_section): Set it for large data/bss sections.
Only clear SECTION_WRITE for .lrodata.
(x86_64_elf_section_type_flags): Set SECTION_LARGE for large
data/bss sections.
* config/i386/sol2.h (MACH_DEP_SECTION_ASM_FLAG): Define.
* varasm.c (default_elf_asm_named_section): Grow flagchars.
[MACH_DEP_SECTION_ASM_FLAG] Emit MACH_DEP_SECTION_ASM_FLAG for
SECTION_MACH_DEP.
* doc/tm.texi.in (Sections, MACH_DEP_SECTION_ASM_FLAG): Describe.
* doc/tm.texi: Regenerate.

From-SVN: r235434

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/sol2.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/varasm.c

index 21ac47206bbcefd8e0c02f376a53789a34c78eaf..d86fb69469e9184208a195a261a9afb5f9ea4c15 100644 (file)
@@ -1,3 +1,18 @@
+2016-04-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR target/59407
+       * config/i386/i386.c (SECTION_LARGE): Define.
+       (x86_64_elf_select_section): Set it for large data/bss sections.
+       Only clear SECTION_WRITE for .lrodata.
+       (x86_64_elf_section_type_flags): Set SECTION_LARGE for large
+       data/bss sections.
+       * config/i386/sol2.h (MACH_DEP_SECTION_ASM_FLAG): Define.
+       * varasm.c (default_elf_asm_named_section): Grow flagchars.
+       [MACH_DEP_SECTION_ASM_FLAG] Emit MACH_DEP_SECTION_ASM_FLAG for
+       SECTION_MACH_DEP.
+       * doc/tm.texi.in (Sections, MACH_DEP_SECTION_ASM_FLAG): Describe.
+       * doc/tm.texi: Regenerate.
+
 2016-04-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/70704
index e7adbd539e8c6ad6350fa53c77bb7b8e7b65f57e..8495e0ad8c3ea7bd7f34877654ee0771473c3604 100644 (file)
@@ -6490,6 +6490,9 @@ ix86_in_large_data_p (tree exp)
   return false;
 }
 
+/* i386-specific section flag to mark large sections.  */
+#define SECTION_LARGE SECTION_MACH_DEP
+
 /* Switch to the appropriate section for output of DECL.
    DECL is either a `VAR_DECL' node or a constant of some sort.
    RELOC indicates whether forming the initial value of DECL requires
@@ -6502,7 +6505,7 @@ x86_64_elf_select_section (tree decl, int reloc,
   if (ix86_in_large_data_p (decl))
     {
       const char *sname = NULL;
-      unsigned int flags = SECTION_WRITE;
+      unsigned int flags = SECTION_WRITE | SECTION_LARGE;
       switch (categorize_decl_for_section (decl, reloc))
        {
        case SECCAT_DATA:
@@ -6529,7 +6532,7 @@ x86_64_elf_select_section (tree decl, int reloc,
        case SECCAT_RODATA_MERGE_STR_INIT:
        case SECCAT_RODATA_MERGE_CONST:
          sname = ".lrodata";
-         flags = 0;
+         flags &= ~SECTION_WRITE;
          break;
        case SECCAT_SRODATA:
        case SECCAT_SDATA:
@@ -6564,6 +6567,9 @@ x86_64_elf_section_type_flags (tree decl, const char *name, int reloc)
 {
   unsigned int flags = default_section_type_flags (decl, name, reloc);
 
+  if (ix86_in_large_data_p (decl))
+    flags |= SECTION_LARGE;
+
   if (decl == NULL_TREE
       && (strcmp (name, ".ldata.rel.ro") == 0
          || strcmp (name, ".ldata.rel.ro.local") == 0))
index 368c2d2d211aaaeb876a48847c70722be01a06ce..5d3122e6b8f8f5a26b6d7f682dc06a29e2634b05 100644 (file)
@@ -209,6 +209,14 @@ along with GCC; see the file COPYING3.  If not see
 #undef TARGET_ASM_NAMED_SECTION
 #define TARGET_ASM_NAMED_SECTION i386_solaris_elf_named_section
 
+/* Sun as requires "h" flag for large sections, GNU as can do without, but
+   accepts "l".  */
+#ifdef USE_GAS
+#define MACH_DEP_SECTION_ASM_FLAG 'l'
+#else
+#define MACH_DEP_SECTION_ASM_FLAG 'h'
+#endif
+
 #ifndef USE_GAS
 /* Emit COMDAT group signature symbols for Sun as.  */
 #undef TARGET_ASM_FILE_END
index 745910f9a33134eaac75afd676c73e2a0f9dcfe0..057ac9aa517d6966a2f23bfa1e12c98885fc32ea 100644 (file)
@@ -7097,6 +7097,12 @@ defined, GCC will assume such a section does not exist.  Do not define
 both this macro and @code{FINI_SECTION_ASM_OP}.
 @end defmac
 
+@defmac MACH_DEP_SECTION_ASM_FLAG
+If defined, a C expression whose value is a character constant
+containing the flag used to mark a machine-dependent section.  This
+corresponds to the @code{SECTION_MACH_DEP} section flag.
+@end defmac
+
 @defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
 If defined, an ASM statement that switches to a different section
 via @var{section_op}, calls @var{function}, and switches back to
index f31c763991c595db02b2b1ef2939a05becb58a70..643f0eb2521b028a2f714a003dc020e004cca026 100644 (file)
@@ -4982,6 +4982,12 @@ defined, GCC will assume such a section does not exist.  Do not define
 both this macro and @code{FINI_SECTION_ASM_OP}.
 @end defmac
 
+@defmac MACH_DEP_SECTION_ASM_FLAG
+If defined, a C expression whose value is a character constant
+containing the flag used to mark a machine-dependent section.  This
+corresponds to the @code{SECTION_MACH_DEP} section flag.
+@end defmac
+
 @defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
 If defined, an ASM statement that switches to a different section
 via @var{section_op}, calls @var{function}, and switches back to
index d71defac590f04adb21b21abed8e5c41e1fa1bba..c7ed06e549af6624ea2e8bb0472b6b986124dbf9 100644 (file)
@@ -6238,7 +6238,7 @@ void
 default_elf_asm_named_section (const char *name, unsigned int flags,
                               tree decl)
 {
-  char flagchars[10], *f = flagchars;
+  char flagchars[11], *f = flagchars;
 
   /* If we have already declared this section, we can use an
      abbreviated form to switch back to it -- unless this section is
@@ -6271,6 +6271,10 @@ default_elf_asm_named_section (const char *name, unsigned int flags,
     *f++ = TLS_SECTION_ASM_FLAG;
   if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE))
     *f++ = 'G';
+#ifdef MACH_DEP_SECTION_ASM_FLAG
+  if (flags & SECTION_MACH_DEP)
+    *f++ = MACH_DEP_SECTION_ASM_FLAG;
+#endif
   *f = '\0';
 
   fprintf (asm_out_file, "\t.section\t%s,\"%s\"", name, flagchars);