summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/config/i386/i386.c10
-rw-r--r--gcc/config/i386/sol2.h8
-rw-r--r--gcc/doc/tm.texi6
-rw-r--r--gcc/doc/tm.texi.in6
-rw-r--r--gcc/varasm.c6
6 files changed, 48 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 21ac47206bb..d86fb69469e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e7adbd539e8..8495e0ad8c3 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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))
diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
index 368c2d2d211..5d3122e6b8f 100644
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -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
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 745910f9a33..057ac9aa517 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -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
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index f31c763991c..643f0eb2521 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -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
diff --git a/gcc/varasm.c b/gcc/varasm.c
index d71defac590..c7ed06e549a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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);