diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-11 16:50:05 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-11 16:50:05 +0000 |
commit | bb2821c04b6546dd5f014b99ab45d6ef5c55f874 (patch) | |
tree | 1e64917dd6eadf802b7c67e6f7384cc9fc03f1ae /gcc/config/alpha/elf.h | |
parent | 1be91cc480957c46afcce1ceca0f0678af0a28ce (diff) | |
download | ppe42-gcc-bb2821c04b6546dd5f014b99ab45d6ef5c55f874.tar.gz ppe42-gcc-bb2821c04b6546dd5f014b99ab45d6ef5c55f874.zip |
* configure.in: Check whether assembler supports section merging.
* config.in: Rebuilt.
* configure: Rebuilt.
* varasm.c (variable_section, output_constant_pool): Pass alignment
to SELECT_SECTION and SELECT_RTX_SECTION.
(mergeable_string_section): New.
(mergeable_constant_section): New.
(default_elf_asm_named_section): Output SECTION_MERGE and
SECTION_STRINGS flags plus SECTION_ENTSIZE entity size.
* output.h (mergeable_string_section): New.
(mergeable_constant_section): New.
(SECTION_MERGE, SECTION_STRINGS, SECTION_ENTSIZE): Define.
* toplev.c (flag_merge_constants): New.
(f_options): Add -fmerge-constants and -fmerge-all-constants
options.
(toplev_main): Default to -fno-merge-constants if not optimizing.
* flags.h (flag_merge_constants): Add extern.
* invoke.texi (-fmerge-constants, -fmerge-all-constants): Document.
* tm.texi (SELECT_SECTION, SELECT_RTX_SECTION): Document added third
argument.
* config/elfos.h (ASM_SECTION_START_OP, ASM_OUTPUT_SECTION_START):
Define if assembler has working .subsection -1 support.
(SELECT_RTX_SECTION, SELECT_SECTION): Add third macro argument.
Put constant into special SHF_MERGE sections if the linker should
attempt to merge duplicates.
* config/ia64/sysv4.h (SELECT_RTX_SECTION, SELECT_SECTION): Add third
macro argument.
Put constant into special SHF_MERGE sections if the linker should
attempt to merge duplicates.
* config/alpha/elf.h: Likewise.
(ASM_SECTION_START_OP, ASM_OUTPUT_SECTION_START): Define if assembler
has working .subsection -1 support.
* config/nextstep.h: Add third argument to SELECT_RTX_SECTION and
SELECT_SECTION.
* config/svr3.h: Likewise.
* config/darwin.h: Likewise.
* config/arm/aof.h: Likewise.
* config/arm/linux-elf.h: Likewise.
* config/avr/avr.h: Likewise.
* config/c4x/c4x.h: Likewise.
* config/d30v/d30v.h: Likewise.
* config/i386/dgux.h: Likewise.
* config/i386/osfrose.h: Likewise.
* config/i386/sco5.h: Likewise.
* config/i386/svr3gas.h: Likewise.
* config/ia64/aix.h: Likewise.
* config/m32r/m32r.h: Likewise.
* config/m68k/m68k.h: Likewise.
* config/m88k/dgux.h: Likewise.
* config/m88k/m88k.h: Likewise.
* config/mcore/mcore-pe.h: Likewise.
* config/mips/mips.h: Likewise.
* config/pa/pa.h: Likewise.
* config/pa/pa-linux.h: Likewise.
* config/romp/romp.h: Likewise.
* config/rs6000/sysv4.h: Likewise.
* config/rs6000/xcoff.h: Likewise.
* config/s390/linux.h: Likewise.
* config/sparc/sparc.h: Likewise.
* config/sparc/sysv4.h: Likewise.
* config/stormy16/stormy16.h: Likewise.
* config/v850/v850.h: Likewise.
* config/vax/vms.h: Likewise.
* config/arm/arm.c (arm_elf_asm_named_section): Output SECTION_MERGE
and SECTION_STRINGS flags plus SECTION_ENTSIZE entity size.
* config/sparc/sparc.c (sparc_elf_asm_named_section): Use
default_elf_asm_named_section for SHF_MERGE sections.
* com.c (ffe_init_options): Default to -fmerge-all-constants
if optimizing.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/alpha/elf.h')
-rw-r--r-- | gcc/config/alpha/elf.h | 92 |
1 files changed, 65 insertions, 27 deletions
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index 3bb51cca6b2..7c2ad236b44 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -1,5 +1,6 @@ /* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Contributed by Richard Henderson (rth@tamu.edu). This file is part of GNU CC. @@ -222,6 +223,16 @@ do { \ #undef FINI_SECTION_ASM_OP #define FINI_SECTION_ASM_OP "\t.section\t.fini" +#ifdef HAVE_GAS_SUBSECTION_ORDERING + +#define ASM_SECTION_START_OP "\t.subsection\t-1" + +/* Output assembly directive to move to the beginning of current section. */ +#define ASM_OUTPUT_SECTION_START(FILE) \ + fprintf ((FILE), "%s\n", ASM_SECTION_START_OP) + +#endif + /* A default list of other sections which we might be "in" at any given time. For targets that use additional sections (e.g. .tdesc) you should override this definition in the target-specific file which @@ -240,8 +251,6 @@ do { \ SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) -extern void ctors_section PARAMS ((void)); -extern void dtors_section PARAMS ((void)); extern void sbss_section PARAMS ((void)); extern void sdata_section PARAMS ((void)); @@ -300,6 +309,8 @@ void FN () \ { \ if (flag_writable_strings) \ SECNUM = 2; \ + else \ + SECNUM = 0x101; \ } \ else if (TREE_CODE (DECL) == VAR_DECL) \ { \ @@ -311,6 +322,17 @@ void FN () \ || TREE_SIDE_EFFECTS (DECL) \ || ! TREE_CONSTANT (DECL_INITIAL (DECL))) \ SECNUM = 2; \ + else if (flag_merge_constants >= 2) \ + { \ + /* C and C++ don't allow different variables to \ + share the same location. -fmerge-all-constants\ + allows even that (at the expense of not \ + conforming). */ \ + if (TREE_CODE (DECL_INITIAL (DECL)) == STRING_CST)\ + SECNUM = 0x201; \ + else \ + SECNUM = 0x301; \ + } \ } \ else if (TREE_CODE (DECL) == CONSTRUCTOR) \ { \ @@ -322,7 +344,7 @@ void FN () \ } \ \ /* Select small data sections based on size. */ \ - if (SECNUM >= 2) \ + if ((SECNUM & 0xff) >= 2) \ { \ int size = int_size_in_bytes (TREE_TYPE (DECL)); \ if (size >= 0 && size <= g_switch_value) \ @@ -332,26 +354,42 @@ void FN () \ while (0) #undef SELECT_SECTION -#define SELECT_SECTION(DECL, RELOC) \ - do \ - { \ - typedef void (*sec_fn) PARAMS ((void)); \ - static sec_fn const sec_functions[6] = \ - { \ - text_section, \ - const_section, \ - data_section, \ - sdata_section, \ - bss_section, \ - sbss_section \ - }; \ - \ - int sec; \ - \ - DO_SELECT_SECTION (sec, DECL, RELOC); \ - \ - (*sec_functions[sec]) (); \ - } \ +#define SELECT_SECTION(DECL, RELOC, ALIGN) \ + do \ + { \ + typedef void (*sec_fn) PARAMS ((void)); \ + static sec_fn const sec_functions[6] = \ + { \ + text_section, \ + const_section, \ + data_section, \ + sdata_section, \ + bss_section, \ + sbss_section \ + }; \ + \ + int sec; \ + \ + DO_SELECT_SECTION (sec, DECL, RELOC); \ + \ + switch (sec) \ + { \ + case 0x101: \ + mergeable_string_section (DECL, ALIGN, 0); \ + break; \ + case 0x201: \ + mergeable_string_section (DECL_INITIAL (DECL),\ + ALIGN, 0); \ + break; \ + case 0x301: \ + mergeable_constant_section (DECL_MODE (DECL), \ + ALIGN, 0); \ + break; \ + default: \ + (*sec_functions[sec]) (); \ + break; \ + } \ + } \ while (0) #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) @@ -380,7 +418,7 @@ void FN () \ STRIP_NAME_ENCODING (name, name); \ nlen = strlen (name); \ \ - prefix = prefixes[sec][DECL_ONE_ONLY(DECL)]; \ + prefix = prefixes[sec & 0xff][DECL_ONE_ONLY(DECL)]; \ plen = strlen (prefix); \ \ string = alloca (nlen + plen + 1); \ @@ -399,8 +437,8 @@ void FN () \ go into the const section. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE, RTX) \ - const_section() +#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \ + mergeable_constant_section((MODE), (ALIGN), 0) /* Define the strings used for the special svr4 .type and .size directives. These strings generally do not vary from one system running svr4 to |