From 901f29c8c9a5775af65f883701ed10a19084d818 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 26 Apr 2016 10:10:33 +0000 Subject: [PATCH] Support .largecomm with Solaris as (PR target/61821) PR target/61821 * config/i386/i386.c (LARGECOMM_SECTION_ASM_OP): Define default. (x86_elf_aligned_common): Rename to ... (x86_elf_aligned_decl_common): ... this. Add decl arg. Switch to .lbss for largecomm object. Use LARGECOMM_SECTION_ASM_OP. * config/i386/i386-protos.h (x86_elf_aligned_common): Reflect renaming. * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_COMMON): Rename to ... (ASM_OUTPUT_ALIGNED_DECL_COMMON): ... this. Pass new decl arg. * config/i386/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Likewise. [!USE_GAS] (LARGECOMM_SECTION_ASM_OP): Define. From-SVN: r235435 --- gcc/ChangeLog | 16 ++++++++++++++++ gcc/config/i386/i386-protos.h | 4 ++-- gcc/config/i386/i386.c | 14 +++++++++++--- gcc/config/i386/sol2.h | 10 +++++++--- gcc/config/i386/x86-64.h | 6 +++--- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d86fb69469e..1907d2b42e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2016-04-26 Rainer Orth + + PR target/61821 + * config/i386/i386.c (LARGECOMM_SECTION_ASM_OP): Define default. + (x86_elf_aligned_common): Rename to ... + (x86_elf_aligned_decl_common): ... this. + Add decl arg. Switch to .lbss for largecomm object. Use + LARGECOMM_SECTION_ASM_OP. + * config/i386/i386-protos.h (x86_elf_aligned_common): Reflect + renaming. + * config/i386/x86-64.h (ASM_OUTPUT_ALIGNED_COMMON): Rename to ... + (ASM_OUTPUT_ALIGNED_DECL_COMMON): ... this. + Pass new decl arg. + * config/i386/sol2.h (ASM_OUTPUT_ALIGNED_COMMON): Likewise. + [!USE_GAS] (LARGECOMM_SECTION_ASM_OP): Define. + 2016-04-26 Rainer Orth PR target/59407 diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 93b5e1ed613..4145ed56658 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -296,8 +296,8 @@ extern int ix86_decompose_address (rtx, struct ix86_address *); extern int memory_address_length (rtx, bool); extern void x86_output_aligned_bss (FILE *, tree, const char *, unsigned HOST_WIDE_INT, int); -extern void x86_elf_aligned_common (FILE *, const char *, - unsigned HOST_WIDE_INT, int); +extern void x86_elf_aligned_decl_common (FILE *, tree, const char *, + unsigned HOST_WIDE_INT, int); #ifdef RTX_CODE extern void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *, diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8495e0ad8c3..d8278fbc600 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6648,19 +6648,27 @@ x86_64_elf_unique_section (tree decl, int reloc) } #ifdef COMMON_ASM_OP + +#ifndef LARGECOMM_SECTION_ASM_OP +#define LARGECOMM_SECTION_ASM_OP "\t.largecomm\t" +#endif + /* This says how to output assembler code to declare an uninitialized external linkage data object. - For medium model x86-64 we need to use .largecomm opcode for + For medium model x86-64 we need to use LARGECOMM_SECTION_ASM_OP opcode for large objects. */ void -x86_elf_aligned_common (FILE *file, +x86_elf_aligned_decl_common (FILE *file, tree decl, const char *name, unsigned HOST_WIDE_INT size, int align) { if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC) && size > (unsigned int)ix86_section_threshold) - fputs ("\t.largecomm\t", file); + { + switch_to_section (get_named_section (decl, ".lbss", 0)); + fputs (LARGECOMM_SECTION_ASM_OP, file); + } else fputs (COMMON_ASM_OP, file); assemble_name (file, name); diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h index 5d3122e6b8f..df23b1298b8 100644 --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -184,15 +184,15 @@ along with GCC; see the file COPYING3. If not see /* As in sparc/sol2.h, override the default from i386/x86-64.h to work around Sun as TLS bug. */ -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ do \ { \ if (TARGET_SUN_TLS \ && in_section \ && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \ switch_to_section (bss_section); \ - x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); \ + x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); \ } \ while (0) @@ -230,6 +230,10 @@ along with GCC; see the file COPYING3. If not see #define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" #endif +#ifndef USE_GAS +#define LARGECOMM_SECTION_ASM_OP "\t.lbcomm\t" +#endif + #define USE_IX86_FRAME_POINTER 1 #define USE_X86_64_FRAME_POINTER 1 diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h index 204f128d5b0..b0bf83589d7 100644 --- a/gcc/config/i386/x86-64.h +++ b/gcc/config/i386/x86-64.h @@ -55,9 +55,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ x86_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ - x86_elf_aligned_common (FILE, NAME, SIZE, ALIGN); +#undef ASM_OUTPUT_ALIGNED_DECL_COMMON +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \ + x86_elf_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN); /* This is used to align code labels according to Intel recommendations. */ -- 2.30.2