From 6cde52a223b2e66a6fc4fe46c098cbde8b340c25 Mon Sep 17 00:00:00 2001 From: rth Date: Sat, 18 May 2002 19:27:52 +0000 Subject: [PATCH] * final.c (HAVE_READONLY_DATA_SECTION): New. (shorten_branches): Use it instead of ifdefs. * varasm.c (enum in_section): Add in_readonly_data. (text_section, data_section): Tidy. (readonly_data_section): Use READONLY_DATA_SECTION_ASM_OP if present. * config/darwin.h, config/nextstep.h, config/h8300/elf.h, config/i860/paragon.h, config/m68k/dpx2.h, config/m68k/hp320.h (READONLY_DATA_SECTION): Don't undef. * config/alpha/unicosmk.h, config/h8300/elf.h, config/i386/aix386ng.h, config/i860/paragon.h, config/m68k/dpx2.h, config/m68k/hp320.h, config/rs6000/lynx.h (READONLY_DATA_SECTION_ASM_OP): Undef. * config/elfos.h, config/svr3.h, config/alpha/alpha-interix.h, config/alpha/elf.h, config/c4x/c4x.h, config/i386/i386-interix.h, config/i386/sco5.h, config/i386/svr3gas.h, config/i860/sysv3.h, config/m88k/m88k.h, config/pa/pa64-hpux.h (USE_CONST_SECTION): Remove. * config/elfos.h, config/netware.h, config/alpha/alpha-interix.h, config/alpha/elf.h, config/alpha/vms.h, config/arc/arc.h, config/arm/coff.h, config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, config/i386/dgux.h, config/i386/i386-interix.h, config/i386/sco5.h, config/ia64/hpux.h, config/m32r/m32r.h, config/m68k/tower-as.h, config/m88k/m88k.h, config/mcore/mcore-pe.h, config/mips/iris6.h, config/mips/mips.h, config/mmix/mmix.h, config/pa/pa64-hpux.h, config/sparc/sysv4.h (READONLY_DATA_SECTION_ASM_OP): Rename from CONST_SECTION_ASM_OP/READONLY_SECTION_ASM_OP/RDATA_SECTION_ASM_OP. * config/elfos.h, config/netware.h, config/1750a/1750a.h, config/a29k/a29k.h, config/alpha/alpha-interix.h, config/alpha/alpha.h, config/arm/coff.h, config/h8300/h8300.h, config/i386/aix386ng.h, config/i386/i386-interix.h, config/i386/osfrose.h, config/mmix/mmix.h, config/pa/pa64-hpux.h, config/sparc/litecoff.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Remove. * config/elfos.h, config/netware.h, config/svr3.h, config/alpha/alpha-interix.h, config/alpha/alpha.h, config/alpha/elf.h, config/arm/coff.h, config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, config/h8300/h8300.h, config/i386/i386-interix.h, config/i386/osfrose.h, config/i386/svr3gas.h, config/mmix/mmix.h, config/pa/pa64-hpux.h (READONLY_DATA_SECTION): Remove. * config/elfos.h, config/netware.h, config/svr3.h, config/alpha/alpha-interix.h, config/alpha/alpha.h, config/alpha/elf.h, config/c4x/c4x.h, config/i386/aix386ng.h, config/i386/i386-interix.h, config/i386/sco5.h, config/i386/svr3gas.h, config/mmix/mmix.h, config/pa/pa64-hpux.h (CONST_SECTION_FUNCTION): Remove. * config/lynx.h, config/svr3.h, config/alpha/elf.h, config/alpha/vms.h, config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, config/i386/sco5.h, config/i386/svr3gas.h, config/i860/sysv3.h, config/i860/sysv4.h, config/ia64/sysv4.h, config/m32r/m32r.h, config/m88k/m88k.h, config/mcore/mcore-elf.h, config/mcore/mcore-pe.h, config/mips/elf.h, config/mips/elf64.h, config/mips/iris6.h, config/mips/linux.h, config/mips/mips.h, config/mips/rtems64.h, config/mips/vxworks.h, config/rs6000/sysv4.h, config/v850/v850.h (EXTRA_SECTIONS): Remove in_const/in_rdata. (EXTRA_SECTION_FUNCTIONS): Remove accompanying function. * config/svr3.h, config/c4x/c4x.h, config/i386/dgux.h, config/i386/sco5.h, config/i386/svr3gas.h, config/ia64/aix.h, config/m88k/dgux.h, config/mcore/mcore-pe.h, config/mmix/mmix.h, config/sparc/sysv4.h (SELECT_RTX_SECTION): Use readonly_data_section. * config/alpha/alpha.c (alpha_start_function): Likewise. (alpha_write_linkage): Likewise. * config/m32r/m32r.c (m32r_select_section): Likewise. * config/m88k/m88k.c (m88k_select_section): Likewise. * config/mips/mips.c (mips_select_rtx_section): Likewise. * config/rs6000/rs6000.c (rs6000_select_rtx_section): Likewise. (rs6000_elf_select_section): Likewise. * config/v850/v850.c (v850_select_section): Likewise. * config/1750a/1750a.h, config/i860/sysv3.h (READONLY_DATA_SECTION_ASM_OP): New. READONLY_DATA_SECTION_ASM_OP. * config/i386/interix.c, config/i386/winnt.c (i386_pe_unique_section): Always use .rdata prefix. * config/pa/som.h (readonly_data): Always switch to read-only section. (READONLY_DATA_SECTION): Predicate on flag_pic. * config/we32k/we32k.h (READONLY_DATA_SECTION): Remove parenthesis. * doc/tm.texi (READONLY_DATA_SECTION_ASM_OP): New. (READONLY_DATA_SECTION): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53593 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 86 ++++++++++++++++++++++++++++++++++++++++ gcc/config/1750a/1750a.h | 13 +----- gcc/config/a29k/a29k.h | 18 --------- gcc/config/alpha/alpha-interix.h | 36 +---------------- gcc/config/alpha/alpha.c | 9 ++--- gcc/config/alpha/alpha.h | 30 -------------- gcc/config/alpha/elf.h | 30 ++------------ gcc/config/alpha/unicosmk.h | 4 +- gcc/config/alpha/vms.h | 17 +------- gcc/config/arc/arc.h | 8 ++-- gcc/config/arm/arm.c | 2 +- gcc/config/arm/coff.h | 36 ++--------------- gcc/config/c4x/c4x.h | 24 ++--------- gcc/config/d30v/d30v.h | 10 ----- gcc/config/darwin.h | 1 - gcc/config/dsp16xx/dsp16xx.h | 19 +-------- gcc/config/elfos.h | 46 +++------------------ gcc/config/h8300/elf.h | 2 +- gcc/config/h8300/h8300.h | 23 ----------- gcc/config/i386/aix386ng.h | 13 +----- gcc/config/i386/dgux.h | 22 +++++----- gcc/config/i386/i386-interix.h | 36 +---------------- gcc/config/i386/interix.c | 9 +---- gcc/config/i386/osfrose.h | 36 ----------------- gcc/config/i386/sco5.h | 53 ++++++++----------------- gcc/config/i386/svr3gas.h | 27 +------------ gcc/config/i386/winnt.c | 7 ---- gcc/config/i860/paragon.h | 3 +- gcc/config/i860/sysv3.h | 10 ++--- gcc/config/i860/sysv4.h | 5 +-- gcc/config/ia64/aix.h | 18 ++++----- gcc/config/ia64/hpux.h | 7 ++-- gcc/config/ia64/sysv4.h | 3 +- gcc/config/lynx.h | 6 +-- gcc/config/m32r/m32r.c | 6 +-- gcc/config/m32r/m32r.h | 7 ++-- gcc/config/m68k/dpx2.h | 3 +- gcc/config/m68k/hp320.h | 4 +- gcc/config/m68k/tower-as.h | 7 ++-- gcc/config/m88k/dgux.h | 14 +++---- gcc/config/m88k/m88k.c | 6 +-- gcc/config/m88k/m88k.h | 22 +++------- gcc/config/mcore/mcore-elf.h | 10 ++--- gcc/config/mcore/mcore-pe.h | 27 +++---------- gcc/config/mips/elf.h | 5 +-- gcc/config/mips/elf64.h | 5 +-- gcc/config/mips/iris6.h | 35 ++++++---------- gcc/config/mips/linux.h | 5 +-- gcc/config/mips/mips.c | 8 ++-- gcc/config/mips/mips.h | 21 ++-------- gcc/config/mips/rtems64.h | 5 +-- gcc/config/mips/vxworks.h | 5 +-- gcc/config/mmix/mmix.h | 23 +---------- gcc/config/netware.h | 31 +-------------- gcc/config/nextstep.h | 1 - gcc/config/pa/pa64-hpux.h | 44 +------------------- gcc/config/pa/som.h | 61 +++++++++++++--------------- gcc/config/rs6000/lynx.h | 1 + gcc/config/rs6000/rs6000.c | 4 +- gcc/config/rs6000/sysv4.h | 3 +- gcc/config/sparc/litecoff.h | 14 +------ gcc/config/sparc/sysv4.h | 18 ++++----- gcc/config/stormy16/stormy16.h | 10 ----- gcc/config/svr3.h | 25 +----------- gcc/config/v850/v850.c | 6 +-- gcc/config/v850/v850.h | 4 +- gcc/config/we32k/we32k.h | 9 ++--- gcc/doc/tm.texi | 27 ++++++++----- gcc/final.c | 24 +++++------ gcc/varasm.c | 17 ++++++-- 70 files changed, 336 insertions(+), 850 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9951dc1a979..7deb0653a69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,89 @@ +2002-05-18 Richard Henderson + + * final.c (HAVE_READONLY_DATA_SECTION): New. + (shorten_branches): Use it instead of ifdefs. + * varasm.c (enum in_section): Add in_readonly_data. + (text_section, data_section): Tidy. + (readonly_data_section): Use READONLY_DATA_SECTION_ASM_OP if present. + + * config/darwin.h, config/nextstep.h, config/h8300/elf.h, + config/i860/paragon.h, config/m68k/dpx2.h, config/m68k/hp320.h + (READONLY_DATA_SECTION): Don't undef. + + * config/alpha/unicosmk.h, config/h8300/elf.h, config/i386/aix386ng.h, + config/i860/paragon.h, config/m68k/dpx2.h, config/m68k/hp320.h, + config/rs6000/lynx.h (READONLY_DATA_SECTION_ASM_OP): Undef. + + * config/elfos.h, config/svr3.h, config/alpha/alpha-interix.h, + config/alpha/elf.h, config/c4x/c4x.h, config/i386/i386-interix.h, + config/i386/sco5.h, config/i386/svr3gas.h, config/i860/sysv3.h, + config/m88k/m88k.h, config/pa/pa64-hpux.h (USE_CONST_SECTION): Remove. + + * config/elfos.h, config/netware.h, config/alpha/alpha-interix.h, + config/alpha/elf.h, config/alpha/vms.h, config/arc/arc.h, + config/arm/coff.h, config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, + config/i386/dgux.h, config/i386/i386-interix.h, config/i386/sco5.h, + config/ia64/hpux.h, config/m32r/m32r.h, config/m68k/tower-as.h, + config/m88k/m88k.h, config/mcore/mcore-pe.h, config/mips/iris6.h, + config/mips/mips.h, config/mmix/mmix.h, config/pa/pa64-hpux.h, + config/sparc/sysv4.h (READONLY_DATA_SECTION_ASM_OP): Rename from + CONST_SECTION_ASM_OP/READONLY_SECTION_ASM_OP/RDATA_SECTION_ASM_OP. + + * config/elfos.h, config/netware.h, config/1750a/1750a.h, + config/a29k/a29k.h, config/alpha/alpha-interix.h, config/alpha/alpha.h, + config/arm/coff.h, config/h8300/h8300.h, config/i386/aix386ng.h, + config/i386/i386-interix.h, config/i386/osfrose.h, config/mmix/mmix.h, + config/pa/pa64-hpux.h, config/sparc/litecoff.h + (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Remove. + + * config/elfos.h, config/netware.h, config/svr3.h, + config/alpha/alpha-interix.h, config/alpha/alpha.h, config/alpha/elf.h, + config/arm/coff.h, config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, + config/h8300/h8300.h, config/i386/i386-interix.h, + config/i386/osfrose.h, config/i386/svr3gas.h, config/mmix/mmix.h, + config/pa/pa64-hpux.h (READONLY_DATA_SECTION): Remove. + + * config/elfos.h, config/netware.h, config/svr3.h, + config/alpha/alpha-interix.h, config/alpha/alpha.h, config/alpha/elf.h, + config/c4x/c4x.h, config/i386/aix386ng.h, config/i386/i386-interix.h, + config/i386/sco5.h, config/i386/svr3gas.h, config/mmix/mmix.h, + config/pa/pa64-hpux.h (CONST_SECTION_FUNCTION): Remove. + + * config/lynx.h, config/svr3.h, config/alpha/elf.h, config/alpha/vms.h, + config/c4x/c4x.h, config/dsp16xx/dsp16xx.h, config/i386/sco5.h, + config/i386/svr3gas.h, config/i860/sysv3.h, config/i860/sysv4.h, + config/ia64/sysv4.h, config/m32r/m32r.h, config/m88k/m88k.h, + config/mcore/mcore-elf.h, config/mcore/mcore-pe.h, config/mips/elf.h, + config/mips/elf64.h, config/mips/iris6.h, config/mips/linux.h, + config/mips/mips.h, config/mips/rtems64.h, config/mips/vxworks.h, + config/rs6000/sysv4.h, config/v850/v850.h + (EXTRA_SECTIONS): Remove in_const/in_rdata. + (EXTRA_SECTION_FUNCTIONS): Remove accompanying function. + + * config/svr3.h, config/c4x/c4x.h, config/i386/dgux.h, + config/i386/sco5.h, config/i386/svr3gas.h, config/ia64/aix.h, + config/m88k/dgux.h, config/mcore/mcore-pe.h, config/mmix/mmix.h, + config/sparc/sysv4.h (SELECT_RTX_SECTION): Use readonly_data_section. + * config/alpha/alpha.c (alpha_start_function): Likewise. + (alpha_write_linkage): Likewise. + * config/m32r/m32r.c (m32r_select_section): Likewise. + * config/m88k/m88k.c (m88k_select_section): Likewise. + * config/mips/mips.c (mips_select_rtx_section): Likewise. + * config/rs6000/rs6000.c (rs6000_select_rtx_section): Likewise. + (rs6000_elf_select_section): Likewise. + * config/v850/v850.c (v850_select_section): Likewise. + + * config/1750a/1750a.h, config/i860/sysv3.h + (READONLY_DATA_SECTION_ASM_OP): New. + READONLY_DATA_SECTION_ASM_OP. + * config/i386/interix.c, config/i386/winnt.c + (i386_pe_unique_section): Always use .rdata prefix. + * config/pa/som.h (readonly_data): Always switch to read-only section. + (READONLY_DATA_SECTION): Predicate on flag_pic. + * config/we32k/we32k.h (READONLY_DATA_SECTION): Remove parenthesis. + * doc/tm.texi (READONLY_DATA_SECTION_ASM_OP): New. + (READONLY_DATA_SECTION): Update. + 2002-05-18 Jason Thorpe * c-common.c (c_common_post_options): Warn if -Wformat-zero-length diff --git a/gcc/config/1750a/1750a.h b/gcc/config/1750a/1750a.h index ce61f65670f..162120ca76e 100644 --- a/gcc/config/1750a/1750a.h +++ b/gcc/config/1750a/1750a.h @@ -889,16 +889,7 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA #define ASM_APP_OFF "; ASM_APP_OFF\n" - -#define EXTRA_SECTIONS in_readonly_data - #define EXTRA_SECTION_FUNCTIONS \ - extern void const_section PARAMS ((void)); \ - void const_section() \ - { \ - fprintf(asm_out_file,"\tkonst\n"); \ - current_section = Konst; \ - } \ void check_section(sect) \ enum section sect; \ { \ @@ -920,9 +911,7 @@ enum reg_class { NO_REGS, R2, R0_1, INDEX_REGS, BASE_REGS, ALL_REGS, LIM_REG_CLA } \ } - -/* Function that switches to the read-only data section (optional) */ -#define READONLY_DATA_SECTION const_section +#define READONLY_DATA_SECTION_ASM_OP "\tkonst" /* Output before program init section */ #define INIT_SECTION_ASM_OP "\n\tinit ; init_section\n" diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h index 3b8712ee5be..1dcd51c969c 100644 --- a/gcc/config/a29k/a29k.h +++ b/gcc/config/a29k/a29k.h @@ -1333,24 +1333,6 @@ extern const char *a29k_function_name; #define DATA_SECTION_ASM_OP "\t.data" -/* Define an extra section for read-only data, a routine to enter it, and - indicate that it is for read-only data. */ - -#define EXTRA_SECTIONS readonly_data - -#define EXTRA_SECTION_FUNCTIONS \ -void \ -literal_section () \ -{ \ - if (in_section != readonly_data) \ - { \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \ - in_section = readonly_data; \ - } \ -} \ - -#define READONLY_DATA_SECTION literal_section - /* If we are referencing a function that is static or is known to be in this file, make the SYMBOL_REF special. We can use this to indicate that we can branch to this function without emitting a no-op after the diff --git a/gcc/config/alpha/alpha-interix.h b/gcc/config/alpha/alpha-interix.h index a1c8cfc3ed0..bb602a56afe 100644 --- a/gcc/config/alpha/alpha-interix.h +++ b/gcc/config/alpha/alpha-interix.h @@ -69,9 +69,7 @@ Boston, MA 02111-1307, USA. */ /* Support const sections and the ctors and dtors sections for g++. */ -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP "\t.rdata" +#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" /* Define the pseudo-ops used to switch to the .ctors and .dtors sections. @@ -91,38 +89,6 @@ Boston, MA 02111-1307, USA. */ #define CTORS_SECTION_ASM_OP "\t.ctors" #define DTORS_SECTION_ASM_OP "\t.dtors" -/* 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 - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - /* The linker will take care of this, and having them causes problems with ld -r (specifically -rU). */ #define CTOR_LISTS_DEFINED_EXTERNALLY 1 diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 2fb51a21887..33a6419a887 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -6617,15 +6617,14 @@ alpha_start_function (file, fnname, decl) } #if TARGET_ABI_OPEN_VMS - /* Ifdef'ed cause readonly_section and link_section are only - available then. */ - readonly_section (); + /* Ifdef'ed cause link_section are only available then. */ + readonly_data_section (); fprintf (file, "\t.align 3\n"); assemble_name (file, fnname); fputs ("..na:\n", file); fputs ("\t.ascii \"", file); assemble_name (file, fnname); fputs ("\\0\"\n", file); - + link_section (); fprintf (file, "\t.align 3\n"); fputs ("\t.name ", file); @@ -8256,7 +8255,7 @@ alpha_write_linkage (stream) { if (alpha_links) { - readonly_section (); + readonly_data_section (); fprintf (stream, "\t.align 3\n"); splay_tree_foreach (alpha_links, alpha_write_one_linkage, stream); } diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 6f82d82f13b..b890bd63ce6 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1724,36 +1724,6 @@ do { \ #define DATA_SECTION_ASM_OP "\t.data" -/* Define an extra section for read-only data, a routine to enter it, and - indicate that it is for read-only data. - - The first time we enter the readonly data section for a file, we write - eight bytes of zero. This works around a bug in DEC's assembler in - some versions of OSF/1 V3.x. */ - -#define EXTRA_SECTIONS readonly_data - -#define EXTRA_SECTION_FUNCTIONS \ -void \ -literal_section () \ -{ \ - if (in_section != readonly_data) \ - { \ - static int firsttime = 1; \ - \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \ - if (firsttime) \ - { \ - firsttime = 0; \ - assemble_aligned_integer (8, const0_rtx); \ - } \ - \ - in_section = readonly_data; \ - } \ -} \ - -#define READONLY_DATA_SECTION literal_section - /* Define this macro if references to a symbol must be treated differently depending on something about the variable or function named by the symbol (such as what section it is in). */ diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index 55199983aab..3e8d1e06f9b 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -191,14 +191,8 @@ do { \ #undef ASCII_DATA_ASM_OP #define ASCII_DATA_ASM_OP "\t.ascii\t" -/* Support const sections and the ctors and dtors sections for g++. */ - -#undef USE_CONST_SECTION -#define USE_CONST_SECTION 1 - -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP "\t.section\t.rodata" - +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" #undef BSS_SECTION_ASM_OP #define BSS_SECTION_ASM_OP "\t.section\t.bss" #undef SBSS_SECTION_ASM_OP @@ -233,7 +227,7 @@ do { \ includes this file. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_sbss, in_sdata +#define EXTRA_SECTIONS in_sbss, in_sdata /* A default list of extra section function definitions. For targets that use additional sections (e.g. .tdesc) you should override this @@ -241,30 +235,12 @@ do { \ #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) extern void sbss_section PARAMS ((void)); extern void sdata_section PARAMS ((void)); -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -#undef CONST_SECTION_FUNCTION -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - #undef SECTION_FUNCTION_TEMPLATE #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ void FN () \ diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h index 6cf19acf446..a8c8915d406 100644 --- a/gcc/config/alpha/unicosmk.h +++ b/gcc/config/alpha/unicosmk.h @@ -347,9 +347,9 @@ do { fprintf (FILE, "\tbr $1,0\n"); \ #undef DATA_SECTION_ASM_OP #define DATA_SECTION_ASM_OP unicosmk_data_section () -/* There are ni read-only sections on Unicos/Mk. */ +/* There are no read-only sections on Unicos/Mk. */ -#undef READONLY_DATA_SECTION +#undef READONLY_DATA_SECTION_ASM_OP #define READONLY_DATA_SECTION data_section /* Define extra sections for common data and SSIBs (static subroutine diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h index 53f2fbd707a..06d9c958576 100644 --- a/gcc/config/alpha/vms.h +++ b/gcc/config/alpha/vms.h @@ -263,26 +263,17 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info; } #define LINK_SECTION_ASM_OP "\t.link" -#define READONLY_SECTION_ASM_OP "\t.rdata" +#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" #define LITERALS_SECTION_ASM_OP "\t.literals" #define CTORS_SECTION_ASM_OP "\t.ctors" #define DTORS_SECTION_ASM_OP "\t.dtors" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_link, in_rdata, in_literals +#define EXTRA_SECTIONS in_link, in_literals #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ void \ -readonly_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \ - in_section = in_rdata; \ - } \ -} \ -void \ link_section () \ { \ if (in_section != in_link) \ @@ -301,7 +292,6 @@ literals_section () \ } \ } -extern void readonly_section PARAMS ((void)); extern void link_section PARAMS ((void)); extern void literals_section PARAMS ((void)); @@ -312,9 +302,6 @@ extern void literals_section PARAMS ((void)); #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \ fprintf (FILE, "\t.quad $L%d\n", (VALUE)) -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION readonly_section - #define ASM_FILE_END(FILE) alpha_write_linkage (FILE); #undef CASE_VECTOR_MODE diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index bb04f2cf0fa..d431bd4636f 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1106,12 +1106,12 @@ extern const char *arc_text_section, *arc_data_section, *arc_rodata_section; #if defined (CRT_INIT) || defined (CRT_FINI) #define TEXT_SECTION_ASM_OP "\t.section .text" #else -#define TEXT_SECTION_ASM_OP arc_text_section /*"\t.section .text"*/ +#define TEXT_SECTION_ASM_OP arc_text_section #endif -#define DATA_SECTION_ASM_OP arc_data_section /*"\t.section .data"*/ +#define DATA_SECTION_ASM_OP arc_data_section -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP arc_rodata_section /*"\t.section .rodata"*/ +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP arc_rodata_section #define BSS_SECTION_ASM_OP "\t.section .bss" diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 05355a129bd..d784050c4b0 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -5342,7 +5342,7 @@ get_jump_table_size (insn) /* ADDR_VECs only take room if read-only data does into the text section. */ if (JUMP_TABLES_IN_TEXT_SECTION -#if !defined(READONLY_DATA_SECTION) +#if !defined(READONLY_DATA_SECTION) && !defined(READONLY_DATA_SECTION_ASM_OP) || 1 #endif ) diff --git a/gcc/config/arm/coff.h b/gcc/config/arm/coff.h index c9f0d9277ab..263e115311f 100644 --- a/gcc/config/arm/coff.h +++ b/gcc/config/arm/coff.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler. For ARM with COFF object format. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. Contributed by Doug Evans (devans@cygnus.com). @@ -76,42 +76,12 @@ Boston, MA 02111-1307, USA. */ more efficient, but for Thumb it's better to put them out of band. */ #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM) -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION rdata_section -#undef RDATA_SECTION_ASM_OP -#define RDATA_SECTION_ASM_OP "\t.section .rdata" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata" #undef CTORS_SECTION_ASM_OP #define CTORS_SECTION_ASM_OP "\t.section .ctors,\"x\"" #undef DTORS_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP "\t.section .dtors,\"x\"" - -/* A list of other sections which the compiler might be "in" at any - given time. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS SUBTARGET_EXTRA_SECTIONS in_rdata - -#define SUBTARGET_EXTRA_SECTIONS - -/* A list of extra section function definitions. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - RDATA_SECTION_FUNCTION \ - SUBTARGET_EXTRA_SECTION_FUNCTIONS - -#define SUBTARGET_EXTRA_SECTION_FUNCTIONS - -#define RDATA_SECTION_FUNCTION \ -void \ -rdata_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ - in_section = in_rdata; \ - } \ -} /* Support the ctors/dtors sections for g++. */ diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 04dbe52c682..ed2b4cb13c2 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1673,9 +1673,7 @@ if (REG_P (OP1) && ! REG_P (OP0)) \ #define DATA_SECTION_ASM_OP "\t.data" -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP "\t.sect\t\".const\"" +#define READONLY_DATA_SECTION_ASM_OP "\t.sect\t\".const\"" /* Do not use .init section so __main will be called on startup. This will call __do_global_ctors and prepare for __do_global_dtors on exit. */ @@ -1687,11 +1685,10 @@ if (REG_P (OP1) && ! REG_P (OP0)) \ #define FINI_SECTION_ASM_OP "\t.sect\t\".fini\"" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini +#define EXTRA_SECTIONS in_init, in_fini #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ INIT_SECTION_FUNCTION \ FINI_SECTION_FUNCTION @@ -1718,21 +1715,6 @@ fini_section () \ } \ } -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (! USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - #define ASM_STABS_OP "\t.stabs\t" /* Switch into a generic section. */ @@ -1759,7 +1741,7 @@ const_section () \ in the case of a `const_int' rtx. Currently, these always go into the const section. */ -#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) const_section() +#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) readonly_data_section() /* Overall Framework of an Assembler File. */ diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index f13d90c4e01..a0b17e24162 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -2747,16 +2747,6 @@ extern const char *d30v_branch_cost_string; Defined in svr4.h. */ /* #define EXTRA_SECTION_FUNCTIONS */ -/* On most machines, read-only variables, constants, and jump tables are placed - in the text section. If this is not the case on your machine, this macro - should be defined to be the name of a function (either `data_section' or a - function defined in `EXTRA_SECTIONS') that switches to the section to be - used for read-only items. - - If these items should be placed in the text section, this macro should not - be defined. */ -/* #define READONLY_DATA_SECTION */ - /* A C statement or statements to switch to the appropriate section for output of RTX in mode MODE. You can assume that RTX is some kind of constant in RTL. The argument MODE is redundant except in the case of a `const_int' diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 19c7a096a08..9d7c59039f2 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -483,7 +483,6 @@ objc_section_init () \ } \ } -#undef READONLY_DATA_SECTION #define READONLY_DATA_SECTION const_section #undef TARGET_ASM_SELECT_SECTION diff --git a/gcc/config/dsp16xx/dsp16xx.h b/gcc/config/dsp16xx/dsp16xx.h index ec8f2b799ae..0848bbd13c7 100644 --- a/gcc/config/dsp16xx/dsp16xx.h +++ b/gcc/config/dsp16xx/dsp16xx.h @@ -1548,8 +1548,7 @@ extern struct dsp16xx_frame_info current_frame_info; /* Output before constants and strings */ #define DEFAULT_CONST_SEG_NAME ".const" -#define READONLY_SECTION_ASM_OP rsect_const -#define READONLY_DATA_SECTION const_section +#define READONLY_DATA_SECTION_ASM_OP rsect_const /* Output before writable data. */ #define DEFAULT_DATA_SEG_NAME ".data" @@ -1561,22 +1560,6 @@ extern struct dsp16xx_frame_info current_frame_info; /* We will default to using 1610 if the user doesn't specify it. */ #define DEFAULT_CHIP_NAME "1610" - -/* A list of names for sections other than the standard ones, which are - 'in_text' and 'in_data' (and .bss if BSS_SECTION_ASM_OP is defined). */ -#define EXTRA_SECTIONS in_const - -#define EXTRA_SECTION_FUNCTIONS \ -extern void const_section PARAMS ((void)); \ -void \ -const_section () \ -{ \ - if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", READONLY_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} /* THE OVERALL FRAMEWORK OF AN ASSEMBLER FILE */ diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h index ea11b653f5f..3cec99595ea 100644 --- a/gcc/config/elfos.h +++ b/gcc/config/elfos.h @@ -216,10 +216,8 @@ Boston, MA 02111-1307, USA. */ #undef ASCII_DATA_ASM_OP #define ASCII_DATA_ASM_OP "\t.ascii\t" -/* Support const sections and the ctors and dtors sections for g++. */ - -#define USE_CONST_SECTION 1 -#define CONST_SECTION_ASM_OP "\t.section\t.rodata" +/* Support a read-only data section. */ +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" /* On svr4, we *do* have support for the .init and .fini sections, and we can put stuff in there to be executed before and after `main'. We let @@ -230,47 +228,13 @@ Boston, MA 02111-1307, USA. */ #define INIT_SECTION_ASM_OP "\t.section\t.init" #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) \ +#ifdef HAVE_GAS_SUBSECTION_ORDERING +# define ASM_SECTION_START_OP "\t.subsection\t-1" +# 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 - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section (); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) /* Switch into a generic section. */ diff --git a/gcc/config/h8300/elf.h b/gcc/config/h8300/elf.h index 3b6db3b2d38..7aad2a64c8c 100644 --- a/gcc/config/h8300/elf.h +++ b/gcc/config/h8300/elf.h @@ -9,7 +9,7 @@ #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP #undef INIT_SECTION_ASM_OP -#undef READONLY_DATA_SECTION +#undef READONLY_DATA_SECTION_ASM_OP #undef TARGET_ASM_NAMED_SECTION #undef TARGET_MEM_FUNCTIONS #undef PREFERRED_DEBUGGING_TYPE diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index ccf8c461cbc..97955a3c32f 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1062,35 +1062,12 @@ struct cum_arg /* The assembler op to get a word, 2 bytes for the H8/300, 4 for H8/300H. */ #define ASM_WORD_OP (TARGET_H8300 ? "\t.word\t" : "\t.long\t") -/* We define a readonly data section solely to remove readonly data - from the instruction stream. This can improve relaxing in two significant - ways. First it's more likely that references to readonly data - can be done with a 16bit absolute address since they'll be in low - memory. Second, it's more likely that jsr instructions can be - turned into bsr instructions since read-only data is not in the - instruction stream. */ -#define READONLY_DATA_SECTION readonly_data - #define TEXT_SECTION_ASM_OP "\t.section .text" #define DATA_SECTION_ASM_OP "\t.section .data" #define BSS_SECTION_ASM_OP "\t.section .bss" #define INIT_SECTION_ASM_OP "\t.section .init" #define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata" -#define EXTRA_SECTIONS in_readonly_data - -#define EXTRA_SECTION_FUNCTIONS \ -extern void readonly_data PARAMS ((void)); \ -void \ -readonly_data () \ -{ \ - if (in_section != in_readonly_data) \ - { \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_SECTION_ASM_OP); \ - in_section = in_readonly_data; \ - } \ -} - #undef DO_GLOBAL_CTORS_BODY #define DO_GLOBAL_CTORS_BODY \ { \ diff --git a/gcc/config/i386/aix386ng.h b/gcc/config/i386/aix386ng.h index d1b936cee0d..5905867ac7a 100644 --- a/gcc/config/i386/aix386ng.h +++ b/gcc/config/i386/aix386ng.h @@ -92,6 +92,7 @@ Boston, MA 02111-1307, USA. */ * cannot handle those. */ #ifndef USE_GAS +# undef READONLY_DATA_SECTION_ASM_OP # undef INIT_SECTION_ASM_OP # undef FINI_SECTION_ASM_OP # undef CTORS_SECTION_ASM_OP @@ -109,18 +110,6 @@ Boston, MA 02111-1307, USA. */ # undef DTOR_LIST_END # define DTOR_LIST_END -# undef CONST_SECTION_FUNCTION -# define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - text_section(); \ -} - -# undef EXTRA_SECTION_FUNCTIONS -# define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - /* for collect2 */ # define OBJECT_FORMAT_COFF # define MY_ISCOFF(magic) \ diff --git a/gcc/config/i386/dgux.h b/gcc/config/i386/dgux.h index cd344f4b2c2..998c8c307e4 100644 --- a/gcc/config/i386/dgux.h +++ b/gcc/config/i386/dgux.h @@ -1,5 +1,5 @@ /* Target definitions for GNU compiler for Intel 80x86 running DG/ux - Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2001 + Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. Currently maintained by gcc@dg-rtp.dg.com. @@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */ */ #ifndef VERSION_INFO2 -#define VERSION_INFO2 "$Revision: 1.16 $" +#define VERSION_INFO2 "$Revision: 1.17 $" #endif #ifndef VERSION_STRING @@ -232,13 +232,13 @@ Boston, MA 02111-1307, USA. */ /* Must use data section for relocatable constants when pic. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ -{ \ - if (flag_pic && symbolic_operand (RTX, VOIDmode)) \ - data_section (); \ - else \ - const_section (); \ -} +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ +do { \ + if (flag_pic && symbolic_operand (RTX, VOIDmode)) \ + data_section (); \ + else \ + readonly_data_section (); \ +} while (0) /* This supplements FUNCTION_ARG's definition in i386.h to check TARGET_WARN_PASS_STRUCT */ @@ -250,5 +250,5 @@ Boston, MA 02111-1307, USA. */ (function_arg (&CUM, MODE, TYPE, NAMED))) /* Add .align 1 to avoid .backalign bug in assembler */ -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP "\t.section\t.rodata\n\t.align 1" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata\n\t.align 1" diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 680e0269196..ea37a1cc543 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -234,41 +234,7 @@ Boston, MA 02111-1307, USA. */ #define EH_FRAME_IN_DATA_SECTION -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP "\t.section\t.rdata,\"r\"" - -/* 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 - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"r\"" /* The MS compilers take alignment as a number of bytes, so we do as well */ #undef ASM_OUTPUT_ALIGN diff --git a/gcc/config/i386/interix.c b/gcc/config/i386/interix.c index 8ea2c6e171f..e8caa60e605 100644 --- a/gcc/config/i386/interix.c +++ b/gcc/config/i386/interix.c @@ -1,5 +1,5 @@ /* Subroutines for insn-output.c for Windows NT. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc. This file is part of GNU CC. @@ -93,15 +93,8 @@ i386_pe_unique_section (decl, reloc) without a .rdata section. */ if (TREE_CODE (decl) == FUNCTION_DECL) prefix = ".text$"; -/* else if (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node) - prefix = ".bss"; */ else if (DECL_READONLY_SECTION (decl, reloc)) -#ifdef READONLY_DATA_SECTION prefix = ".rdata$"; -#else - prefix = ".text$"; -#endif else prefix = ".data$"; len = strlen (name) + strlen (prefix); diff --git a/gcc/config/i386/osfrose.h b/gcc/config/i386/osfrose.h index 0264575c171..03aa95a1450 100644 --- a/gcc/config/i386/osfrose.h +++ b/gcc/config/i386/osfrose.h @@ -464,42 +464,6 @@ do \ } \ while (0) - -/* On most machines, read-only variables, constants, and jump tables - are placed in the text section. If this is not the case on your - machine, this macro should be defined to be the name of a function - (either `data_section' or a function defined in `EXTRA_SECTIONS') - that switches to the section to be used for read-only items. - - If these items should be placed in the text section, this macro - should not be defined. */ - -#if 0 -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() \ -do \ - { \ - if (TARGET_ELF) \ - { \ - if (in_section != in_rodata) \ - { \ - fprintf (asm_out_file, "\t.section \"rodata\"\n"); \ - in_section = in_rodata; \ - } \ - } \ - else \ - text_section (); \ - } \ -while (0) -#endif - -/* A list of names for sections other than the standard two, which are - `in_text' and `in_data'. You need not define this macro on a - system with no other sections (that GCC needs to use). */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_rodata, in_data1 - /* Given a decl node or constant node, choose the section to output it in and select that section. */ diff --git a/gcc/config/i386/sco5.h b/gcc/config/i386/sco5.h index 0fc142763de..90aba9b9c53 100644 --- a/gcc/config/i386/sco5.h +++ b/gcc/config/i386/sco5.h @@ -77,17 +77,13 @@ Boston, MA 02111-1307, USA. */ #define DWARF2_UNWIND_INFO \ ((TARGET_ELF) ? 1 : 0 ) -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" -#define CONST_SECTION_ASM_OP_ELF "\t.section\t.rodata" -#define CONST_SECTION_ASM_OP \ - ((TARGET_ELF) ? CONST_SECTION_ASM_OP_ELF : CONST_SECTION_ASM_OP_COFF) - -#undef USE_CONST_SECTION -#define USE_CONST_SECTION_ELF 1 -#define USE_CONST_SECTION_COFF 0 -#define USE_CONST_SECTION \ - ((TARGET_ELF) ? USE_CONST_SECTION_ELF : USE_CONST_SECTION_COFF) +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" +#define READONLY_DATA_SECTION_ASM_OP_ELF "\t.section\t.rodata" +#define READONLY_DATA_SECTION_ASM_OP \ + ((TARGET_ELF) \ + ? READONLY_DATA_SECTION_ASM_OP_ELF \ + : READONLY_DATA_SECTION_ASM_OP_COFF) #undef INIT_SECTION_ASM_OP #define INIT_SECTION_ASM_OP_ELF "\t.section\t.init" @@ -354,15 +350,15 @@ do { \ /* Must use data section for relocatable constants when pic. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ -{ \ - if (TARGET_ELF) { \ - if (flag_pic && symbolic_operand (RTX, VOIDmode)) \ - data_section (); \ - else \ - const_section (); \ - } else \ - readonly_data_section(); \ +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ +{ \ + if (TARGET_ELF) { \ + if (flag_pic && symbolic_operand (RTX, VOIDmode)) \ + data_section (); \ + else \ + readonly_data_section (); \ + } else \ + readonly_data_section(); \ } #undef ASM_OUTPUT_CASE_LABEL @@ -458,28 +454,13 @@ do { \ ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG) #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini +#define EXTRA_SECTIONS in_init, in_fini #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ INIT_SECTION_FUNCTION \ FINI_SECTION_FUNCTION -#undef CONST_SECTION_FUNCTION -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - #undef FINI_SECTION_FUNCTION #define FINI_SECTION_FUNCTION \ void \ diff --git a/gcc/config/i386/svr3gas.h b/gcc/config/i386/svr3gas.h index 489a0dc6852..f47a90627ec 100644 --- a/gcc/config/i386/svr3gas.h +++ b/gcc/config/i386/svr3gas.h @@ -83,13 +83,8 @@ Boston, MA 02111-1307, USA. */ this file should be rewritten to include config/svr3.h and override what isn't right. */ -/* Support const sections and the ctors and dtors sections for g++. */ - -#define USE_CONST_SECTION 0 - #define INIT_SECTION_ASM_OP "\t.section\t.init" #define FINI_SECTION_ASM_OP "\t.section .fini,\"x\"" -#define CONST_SECTION_ASM_OP "\t.section\t.rodata, \"x\"" #define CTORS_SECTION_ASM_OP INIT_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP @@ -113,14 +108,11 @@ do { \ (*--p) (); \ } while (0) -/* Add extra sections .rodata, .init and .fini. */ - #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini +#define EXTRA_SECTIONS in_init, in_fini #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ INIT_SECTION_FUNCTION \ FINI_SECTION_FUNCTION @@ -146,21 +138,6 @@ fini_section () \ } \ } -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - #define TARGET_ASM_CONSTRUCTOR ix86_svr3_asm_out_constructor /* A C statement or statements to switch to the appropriate @@ -169,4 +146,4 @@ const_section () \ in the case of a `const_int' rtx. Currently, these always go into the const section. */ -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) const_section() +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) readonly_data_section() diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 08f144f626b..87f3c70849c 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -445,15 +445,8 @@ i386_pe_unique_section (decl, reloc) without a .rdata section. */ if (TREE_CODE (decl) == FUNCTION_DECL) prefix = ".text$"; -/* else if (DECL_INITIAL (decl) == 0 - || DECL_INITIAL (decl) == error_mark_node) - prefix = ".bss"; */ else if (DECL_READONLY_SECTION (decl, reloc)) -#ifdef READONLY_DATA_SECTION prefix = ".rdata$"; -#else - prefix = ".text$"; -#endif else prefix = ".data$"; len = strlen (name) + strlen (prefix); diff --git a/gcc/config/i860/paragon.h b/gcc/config/i860/paragon.h index f55b8859fe0..cb2ae642e73 100644 --- a/gcc/config/i860/paragon.h +++ b/gcc/config/i860/paragon.h @@ -176,14 +176,13 @@ Boston, MA 02111-1307, USA. */ */ #undef INIT_SECTION_ASM_OP #undef FINI_SECTION_ASM_OP -#undef CONST_SECTION_ASM_OP +#undef READONLY_DATA_SECTION_ASM_OP #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP #undef DO_GLOBAL_CTORS_BODY #undef ASM_OUTPUT_DESTRUCTOR #undef TARGET_ASM_SELECT_SECTION #undef SELECT_RTX_SECTION -#undef READONLY_DATA_SECTION #define BSS_SECTION_ASM_OP "\t.bss" /* XXX */ #undef EXTRA_SECTIONS diff --git a/gcc/config/i860/sysv3.h b/gcc/config/i860/sysv3.h index cc26176c963..f361a0108b5 100644 --- a/gcc/config/i860/sysv3.h +++ b/gcc/config/i860/sysv3.h @@ -1,5 +1,5 @@ /* Target definitions for GNU compiler for Intel 80860 running System V.3 - Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1991, 1996, 2000, 2002 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). This file is part of GNU CC. @@ -134,6 +134,7 @@ extern const char *current_function_original_name; while (0) +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata, \"x\"" #undef CTORS_SECTION_ASM_OP #define CTORS_SECTION_ASM_OP "\t.section\t.ctors,\"x\"" #undef DTORS_SECTION_ASM_OP @@ -145,11 +146,10 @@ extern const char *current_function_original_name; #define TDESC_SECTION_ASM_OP "\t.section\t.tdesc" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_tdesc +#define EXTRA_SECTIONS in_tdesc #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ TDESC_SECTION_FUNCTION #define TDESC_SECTION_FUNCTION \ @@ -162,7 +162,3 @@ tdesc_section () \ in_section = in_tdesc; \ } \ } - -/* Enable the `const' section that svr3.h defines how to use. */ -#undef USE_CONST_SECTION -#define USE_CONST_SECTION 1 diff --git a/gcc/config/i860/sysv4.h b/gcc/config/i860/sysv4.h index 9d5e52f374d..753807fe123 100644 --- a/gcc/config/i860/sysv4.h +++ b/gcc/config/i860/sysv4.h @@ -1,5 +1,5 @@ /* Target definitions for GNU compiler for Intel 80860 running System V.4 - Copyright (C) 1991, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1991, 1996, 2000, 2002 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). This file is part of GNU CC. @@ -124,11 +124,10 @@ extern const char *current_function_original_name; #define TDESC_SECTION_ASM_OP "\t.section\t.tdesc" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_tdesc +#define EXTRA_SECTIONS in_tdesc #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ TDESC_SECTION_FUNCTION #define TDESC_SECTION_FUNCTION \ diff --git a/gcc/config/ia64/aix.h b/gcc/config/ia64/aix.h index 0e66a5dcb08..700950fc3ca 100644 --- a/gcc/config/ia64/aix.h +++ b/gcc/config/ia64/aix.h @@ -139,15 +139,15 @@ do { \ extern unsigned int ia64_section_threshold; #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \ -{ \ - if (GET_MODE_SIZE (MODE) > 0 \ - && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \ - sdata_section (); \ - else if (symbolic_operand ((RTX), (MODE))) \ - data_section (); \ - else \ - const_section (); \ +#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) \ +{ \ + if (GET_MODE_SIZE (MODE) > 0 \ + && GET_MODE_SIZE (MODE) <= ia64_section_threshold) \ + sdata_section (); \ + else if (symbolic_operand ((RTX), (MODE))) \ + data_section (); \ + else \ + readonly_data_section (); \ } /* Override ia64/sysv4.h setting with that used by AIX5. */ diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h index d46acf2b6ef..afc79990317 100644 --- a/gcc/config/ia64/hpux.h +++ b/gcc/config/ia64/hpux.h @@ -1,5 +1,5 @@ /* Definitions of target machine GNU compiler. IA-64 version. - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Steve Ellcey and Reva Cuthbertson @@ -85,8 +85,9 @@ Boston, MA 02111-1307, USA. */ #define JMP_BUF_SIZE (8 * 76) -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP "\t.section\t.rodata,\t\"a\",\t\"progbits\"" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP \ + "\t.section\t.rodata,\t\"a\",\t\"progbits\"" #undef BITS_BIG_ENDIAN #define BITS_BIG_ENDIAN 1 diff --git a/gcc/config/ia64/sysv4.h b/gcc/config/ia64/sysv4.h index 1f07b8c0f91..881b23da453 100644 --- a/gcc/config/ia64/sysv4.h +++ b/gcc/config/ia64/sysv4.h @@ -156,11 +156,10 @@ extern unsigned int ia64_section_threshold; } #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_sdata, in_sbss +#define EXTRA_SECTIONS in_sdata, in_sbss #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ SDATA_SECTION_FUNCTION \ SBSS_SECTION_FUNCTION diff --git a/gcc/config/lynx.h b/gcc/config/lynx.h index 012a701bc64..193935ee228 100644 --- a/gcc/config/lynx.h +++ b/gcc/config/lynx.h @@ -1,5 +1,6 @@ /* Target independent definitions for LynxOS. - Copyright (C) 1993, 1994, 1995, 1996, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1996, 1999, 2000, 2002 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -128,11 +129,10 @@ do { \ #undef INIT_SECTION_ASM_OP #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_fini +#define EXTRA_SECTIONS in_fini #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ FINI_SECTION_FUNCTION #undef CTORS_SECTION_ASM_OP diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 4851127138f..a1f3c9115e0 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -331,7 +331,7 @@ m32r_select_section (decl, reloc, align) if (TREE_CODE (decl) == STRING_CST) { if (! flag_writable_strings) - const_section (); + readonly_data_section (); else data_section (); } @@ -347,10 +347,10 @@ m32r_select_section (decl, reloc, align) && !TREE_CONSTANT (DECL_INITIAL (decl)))) data_section (); else - const_section (); + readonly_data_section (); } else - const_section (); + readonly_data_section (); } /* Encode section information of DECL, which is either a VAR_DECL, diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index f0b783a7ea8..c3b00326e29 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1526,14 +1526,14 @@ do { \ #define SDATA_SECTION_ASM_OP "\t.section .sdata" #define SBSS_SECTION_ASM_OP "\t.section .sbss" /* This one is for svr4.h. */ -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP "\t.section .rodata" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\t.section .rodata" /* A list of names for sections other than the standard two, which are `in_text' and `in_data'. You need not define this macro on a system with no other sections (that GCC needs to use). */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_sbss, in_const +#define EXTRA_SECTIONS in_sdata, in_sbss /* One or more functions to be defined in "varasm.c". These functions should do jobs analogous to those of `text_section' and @@ -1541,7 +1541,6 @@ do { \ macro if you do not define `EXTRA_SECTIONS'. */ #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ SDATA_SECTION_FUNCTION \ SBSS_SECTION_FUNCTION diff --git a/gcc/config/m68k/dpx2.h b/gcc/config/m68k/dpx2.h index fa6557b4360..3595eebcdec 100644 --- a/gcc/config/m68k/dpx2.h +++ b/gcc/config/m68k/dpx2.h @@ -47,8 +47,7 @@ Boston, MA 02111-1307, USA. */ #undef SELECT_RTX_SECTION #undef EXTRA_SECTIONS #undef EXTRA_SECTION_FUNCTIONS -#undef CONST_SECTION_ASM_OP -#undef READONLY_DATA_SECTION +#undef READONLY_DATA_SECTION_ASM_OP #define DPX2 diff --git a/gcc/config/m68k/hp320.h b/gcc/config/m68k/hp320.h index 292d25db5b9..7a18c52256a 100644 --- a/gcc/config/m68k/hp320.h +++ b/gcc/config/m68k/hp320.h @@ -1,5 +1,5 @@ /* Definitions of target machine for GNU compiler. HP-UX 68000/68020 version. - Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1999, 2000 + Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GNU CC. @@ -164,7 +164,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_APP_OFF #undef TEXT_SECTION_ASM_OP #undef DATA_SECTION_ASM_OP -#undef READONLY_DATA_SECTION +#undef READONLY_DATA_SECTION_ASM_OP #undef ASM_OUTPUT_ADDR_VEC_ELT #undef ASM_OUTPUT_ADDR_DIFF_ELT #undef ASM_OUTPUT_ALIGN diff --git a/gcc/config/m68k/tower-as.h b/gcc/config/m68k/tower-as.h index 6007099bd3e..cd457cd1d25 100644 --- a/gcc/config/m68k/tower-as.h +++ b/gcc/config/m68k/tower-as.h @@ -1,6 +1,7 @@ /* Definitions of target machine for GNU compiler. For NCR Tower 32/4x0 and 32/6x0 running System V Release 3. - Copyright (C) 1990, 1993, 1994, 1996, 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1990, 1993, 1994, 1996, 1997, 2000, 2002 + Free Software Foundation, Inc. Contributed by Robert Andersson (ra@intsys.no), International Systems, Oslo, Norway. @@ -543,8 +544,8 @@ do { fprintf (asm_out_file, "\ttag\t"); \ #define INIT_SECTION_ASM_OP "\tsection\t~init" #undef FINI_SECTION_ASM_OP #define FINI_SECTION_ASM_OP "\tsection\t~fini" -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP "\tsection\t~rodata" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\tsection\t~rodata" #define CTOR_LIST_BEGIN \ asm (INIT_SECTION_ASM_OP); \ diff --git a/gcc/config/m88k/dgux.h b/gcc/config/m88k/dgux.h index b7d134d4e6a..7c12b7c7a47 100644 --- a/gcc/config/m88k/dgux.h +++ b/gcc/config/m88k/dgux.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler. Motorola m88100 running DG/UX. - Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001 + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@mcc.com) Currently maintained by (gcc@dg-rtp.dg.com) @@ -293,10 +293,10 @@ func_ptr __DTOR_END__[1] = { (func_ptr) (-1) } /* Must use data section for relocatable constants when pic. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ -{ \ - if (flag_pic && symbolic_operand ((RTX), (MODE))) \ - data_section (); \ - else \ - const_section (); \ +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ +{ \ + if (flag_pic && symbolic_operand ((RTX), (MODE))) \ + data_section (); \ + else \ + readonly_data_section (); \ } diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 6fdcf4b1095..8e2c5c0832e 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -3329,7 +3329,7 @@ m88k_select_section (decl, reloc, align) if (TREE_CODE (decl) == STRING_CST) { if (! flag_writable_strings) - const_section (); + readonly_data_section (); else if (TREE_STRING_LENGTH (decl) <= m88k_gp_threshold) sdata_section (); else @@ -3346,10 +3346,10 @@ m88k_select_section (decl, reloc, align) && !TREE_CONSTANT (DECL_INITIAL (decl)))) data_section (); else - const_section (); + readonly_data_section (); } else - const_section (); + readonly_data_section (); } /* Adjust the cost of INSN based on the relationship between INSN that diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 17b6b7bbb86..0edec9faf4f 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1619,7 +1619,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, /* Allow pseudo-ops to be overridden. Override these in svr[34].h. */ #undef ASCII_DATA_ASM_OP -#undef CONST_SECTION_ASM_OP +#undef READONLY_DATA_SECTION_ASM_OP #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP #undef TARGET_ASM_NAMED_SECTION @@ -1638,7 +1638,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, #define DATA_SECTION_ASM_OP "\tdata" /* Other sections. */ -#define CONST_SECTION_ASM_OP (TARGET_SVR4 \ +#define READONLY_DATA_SECTION_ASM_OP (TARGET_SVR4 \ ? "\tsection\t .rodata,\"a\"" \ : "\tsection\t .rodata,\"x\"") #define TDESC_SECTION_ASM_OP (TARGET_SVR4 \ @@ -2295,32 +2295,24 @@ do { \ and so follows DECLARE_ASM_NAME. Note that strings go in text rather than const. Override svr[34].h. */ -#undef USE_CONST_SECTION #undef EXTRA_SECTIONS -#define USE_CONST_SECTION DECLARE_ASM_NAME - #if defined(USING_SVR4_H) -#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata +#define EXTRA_SECTIONS in_tdesc, in_sdata #define INIT_SECTION_FUNCTION #define FINI_SECTION_FUNCTION #else #if defined(USING_SVR3_H) -#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata, in_init, in_fini +#define EXTRA_SECTIONS in_tdesc, in_sdata, in_init, in_fini #else /* luna or other not based on svr[34].h. */ +#undef READONLY_DATA_SECTION_ASM_OP #undef INIT_SECTION_ASM_OP -#define EXTRA_SECTIONS in_const, in_tdesc, in_sdata -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - text_section(); \ -} +#define EXTRA_SECTIONS in_tdesc, in_sdata #define INIT_SECTION_FUNCTION #define FINI_SECTION_FUNCTION @@ -2329,8 +2321,6 @@ const_section () \ #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - \ void \ tdesc_section () \ { \ diff --git a/gcc/config/mcore/mcore-elf.h b/gcc/config/mcore/mcore-elf.h index 8cb8d1b337a..2cdbae01063 100644 --- a/gcc/config/mcore/mcore-elf.h +++ b/gcc/config/mcore/mcore-elf.h @@ -42,13 +42,10 @@ Boston, MA 02111-1307, USA. */ #define EXPORTS_SECTION_ASM_OP "\t.section .exports" -#define SUBTARGET_EXTRA_SECTIONS in_const, in_exports +#define SUBTARGET_EXTRA_SECTIONS in_exports #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ - EXPORT_SECTION_FUNCTION \ - -/* CONST_SECTION_FUNCTION is defined svr4.h. */ + EXPORT_SECTION_FUNCTION #define EXPORT_SECTION_FUNCTION \ void \ @@ -62,8 +59,7 @@ exports_section () \ } #define SUBTARGET_SWITCH_SECTIONS \ - case in_exports: exports_section (); break; \ - case in_const: const_section (); break; + case in_exports: exports_section (); break; #define MCORE_EXPORT_NAME(STREAM, NAME) \ diff --git a/gcc/config/mcore/mcore-pe.h b/gcc/config/mcore/mcore-pe.h index 5fd3b8d7dda..c5e8e45300e 100644 --- a/gcc/config/mcore/mcore-pe.h +++ b/gcc/config/mcore/mcore-pe.h @@ -43,17 +43,15 @@ Boston, MA 02111-1307, USA. */ and readonly data. This gets them out of default places. */ #define SUBTARGET_SWITCH_SECTIONS \ - case in_drectve: drectve_section (); break; \ - case in_rdata: rdata_section (); break; + case in_drectve: drectve_section (); break; #define DRECTVE_SECTION_ASM_OP "\t.section .drectve" -#define RDATA_SECTION_ASM_OP "\t.section .rdata" +#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata" -#define SUBTARGET_EXTRA_SECTIONS in_drectve, in_rdata +#define SUBTARGET_EXTRA_SECTIONS in_drectve #define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ - DRECTVE_SECTION_FUNCTION \ - RDATA_SECTION_FUNCTION + DRECTVE_SECTION_FUNCTION #define DRECTVE_SECTION_FUNCTION \ void \ @@ -65,28 +63,13 @@ drectve_section () \ in_section = in_drectve; \ } \ } - -#define RDATA_SECTION_FUNCTION \ -void \ -rdata_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ - in_section = in_rdata; \ - } \ -} - -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION() rdata_section () - /* A C statement or statements to switch to the appropriate section for output of RTX in mode MODE. RTX is some kind of constant in RTL. The argument MODE is redundant except in the case of a `const_int' rtx. Currently, these always go into the const section. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) rdata_section () +#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) readonly_data_section () #define MCORE_EXPORT_NAME(STREAM, NAME) \ do \ diff --git a/gcc/config/mips/elf.h b/gcc/config/mips/elf.h index d3267379bf1..de870c09a89 100644 --- a/gcc/config/mips/elf.h +++ b/gcc/config/mips/elf.h @@ -225,13 +225,12 @@ do { \ /* A list of other sections which the compiler might be "in" at any given time. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata +#define EXTRA_SECTIONS in_sdata, in_sbss #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) + SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ void FN () \ diff --git a/gcc/config/mips/elf64.h b/gcc/config/mips/elf64.h index a162fc41a9f..8d6bf4a6752 100644 --- a/gcc/config/mips/elf64.h +++ b/gcc/config/mips/elf64.h @@ -215,12 +215,11 @@ do { \ /* A list of other sections which the compiler might be "in" at any given time. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata +#define EXTRA_SECTIONS in_sdata #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) + SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ void FN () \ diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index 71a18e83a16..ff03d35aeaa 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -1,5 +1,6 @@ /* Definitions of target machine for GNU compiler. Iris version 6. - Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 + Free Software Foundation, Inc. This file is part of GNU CC. @@ -249,8 +250,13 @@ Boston, MA 02111-1307, USA. */ do_global_* functions instead of running collect2. */ #define BSS_SECTION_ASM_OP "\t.section\t.bss" -#define CONST_SECTION_ASM_OP_32 "\t.rdata" -#define CONST_SECTION_ASM_OP_64 "\t.section\t.rodata" + +#define READONLY_DATA_SECTION_ASM_OP_32 "\t.rdata" +#define READONLY_DATA_SECTION_ASM_OP_64 "\t.section\t.rodata" +#define READONLY_DATA_SECTION_ASM_OP \ + (mips_abi != ABI_32 && mips_abi != ABI_O64 \ + ? READONLY_DATA_SECTION_ASM_OP_64 \ + : READONLY_DATA_SECTION_ASM_OP_32) /* 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 @@ -258,14 +264,12 @@ Boston, MA 02111-1307, USA. */ includes this file. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata, in_const +#define EXTRA_SECTIONS in_sdata /* A default list of extra section function definitions. For targets that use additional sections (e.g. .tdesc) you should override this definition in the target-specific file which includes this file. */ -/* ??? rdata_section is now same as svr4 const_section. */ - #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ void \ @@ -278,19 +282,6 @@ sdata_section () \ } \ } \ \ -void \ -rdata_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - if (mips_abi != ABI_32 && mips_abi != ABI_O64) \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_64); \ - else \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP_32); \ - in_section = in_rdata; \ - } \ -} \ - \ const char * \ current_section_name () \ { \ @@ -301,8 +292,7 @@ current_section_name () \ case in_data: return ".data"; \ case in_sdata: return ".sdata"; \ case in_bss: return ".bss"; \ - case in_rdata: \ - case in_const: \ + case in_readonly_data: \ if (mips_abi != ABI_32 && mips_abi != ABI_O64) \ return ".rodata"; \ else \ @@ -323,8 +313,7 @@ current_section_flags () \ case in_data: return SECTION_WRITE; \ case in_sdata: return SECTION_WRITE | SECTION_SMALL; \ case in_bss: return SECTION_WRITE | SECTION_BSS; \ - case in_rdata: \ - case in_const: return 0; \ + case in_readonly_data: return 0; \ case in_named: return get_named_section_flags (in_named_name); \ } \ abort (); \ diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h index 755a8c00228..701e896aa12 100644 --- a/gcc/config/mips/linux.h +++ b/gcc/config/mips/linux.h @@ -93,13 +93,12 @@ do { \ /* A list of other sections which the compiler might be "in" at any given time. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_sbss, in_rdata +#define EXTRA_SECTIONS in_sdata, in_sbss #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) + SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) #define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \ void FN () \ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index b93e53180d8..f551d627889 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -7913,7 +7913,7 @@ mips_select_rtx_section (mode, x) { /* For embedded applications, always put constants in read-only data, in order to reduce RAM usage. */ - READONLY_DATA_SECTION (); + readonly_data_section (); } else { @@ -7932,7 +7932,7 @@ mips_select_rtx_section (mode, x) read-only). */ data_section (); else - READONLY_DATA_SECTION (); + readonly_data_section (); } } @@ -7979,7 +7979,7 @@ mips_select_section (decl, reloc, align) && (TREE_CODE (decl) != STRING_CST || !flag_writable_strings))) && ! (flag_pic && reloc)) - READONLY_DATA_SECTION (); + readonly_data_section (); else if (size > 0 && size <= mips_section_threshold) SMALL_DATA_SECTION (); else @@ -8002,7 +8002,7 @@ mips_select_section (decl, reloc, align) && (TREE_CODE (decl) != STRING_CST || !flag_writable_strings))) && ! (flag_pic && reloc)) - READONLY_DATA_SECTION (); + readonly_data_section (); else data_section (); } diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index dba54e65816..3dea475d676 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -169,7 +169,6 @@ extern struct rtx_def *mips_load_reg4; /* 4th reg to check for load delay */ extern int mips_string_length; /* length of strings for mips16 */ /* Functions to change what output section we are using. */ -extern void rdata_section PARAMS ((void)); extern void sdata_section PARAMS ((void)); extern void sbss_section PARAMS ((void)); @@ -4534,7 +4533,7 @@ while (0) if (TREE_PUBLIC (DECL) && DECL_NAME (DECL)) \ ASM_GLOBALIZE_LABEL (STREAM, NAME); \ \ - READONLY_DATA_SECTION (); \ + readonly_data_section (); \ ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \ mips_declare_object (STREAM, NAME, "", ":\n\t.space\t%u\n", \ (SIZE)); \ @@ -4676,7 +4675,7 @@ do { \ { \ const char *p = STRING; \ int size = strlen (p) + 1; \ - rdata_section (); \ + readonly_data_section (); \ assemble_string (p, size); \ } @@ -4689,15 +4688,13 @@ do { \ #define TEXT_SECTION_ASM_OP "\t.text" /* instructions */ #define DATA_SECTION_ASM_OP "\t.data" /* large data */ #define SDATA_SECTION_ASM_OP "\t.sdata" /* small data */ -#define RDATA_SECTION_ASM_OP "\t.rdata" /* read-only data */ -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION rdata_section +#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" /* read-only data */ #define SMALL_DATA_SECTION sdata_section /* What other sections we support other than the normal .data/.text. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata +#define EXTRA_SECTIONS in_sdata /* Define the additional functions to select our additional sections. */ @@ -4719,16 +4716,6 @@ sdata_section () \ fprintf (asm_out_file, "%s\n", SDATA_SECTION_ASM_OP); \ in_section = in_sdata; \ } \ -} \ - \ -void \ -rdata_section () \ -{ \ - if (in_section != in_rdata) \ - { \ - fprintf (asm_out_file, "%s\n", RDATA_SECTION_ASM_OP); \ - in_section = in_rdata; \ - } \ } /* Given a decl node or constant node, choose the section to output it in diff --git a/gcc/config/mips/rtems64.h b/gcc/config/mips/rtems64.h index e3c74ca04ea..c4e4f4bc13f 100644 --- a/gcc/config/mips/rtems64.h +++ b/gcc/config/mips/rtems64.h @@ -26,12 +26,11 @@ Boston, MA 02111-1307, USA. */ -D__rtems__ -Asystem=rtems" #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata +#define EXTRA_SECTIONS in_sdata #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) + SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) #undef STARTFILE_SPEC #undef ENDFILE_SPEC diff --git a/gcc/config/mips/vxworks.h b/gcc/config/mips/vxworks.h index 9eca3b71c6a..67838e201fd 100644 --- a/gcc/config/mips/vxworks.h +++ b/gcc/config/mips/vxworks.h @@ -18,13 +18,12 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata, in_sbss +#define EXTRA_SECTIONS in_sdata, in_sbss #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) + SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) #undef STARTFILE_SPEC #undef ENDFILE_SPEC diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index c603ebb5c1a..fdb60ccbe3d 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -905,29 +905,10 @@ typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS; #define DATA_SECTION_ASM_OP \ mmix_data_section_asm_op () -/* Stuff copied from elfos.h. */ -#define EXTRA_SECTIONS in_const - -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_ASM_OP "\t.section\t.rodata" - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) const_section () +#define SELECT_RTX_SECTION(MODE, RTX, ALIGN) readonly_data_section () #define ENCODE_SECTION_INFO(DECL, FIRST) \ mmix_encode_section_info (DECL, FIRST) diff --git a/gcc/config/netware.h b/gcc/config/netware.h index dbb247740b1..90e85aac1d5 100644 --- a/gcc/config/netware.h +++ b/gcc/config/netware.h @@ -61,36 +61,9 @@ Boston, MA 02111-1307, USA. */ #undef HAS_INIT_SECTION #undef INIT_SECTION_ASM_OP -#undef READONLY_DATA_SECTION -#define READONLY_DATA_SECTION const_section - -#undef CONST_SECTION_ASM_OP -#define CONST_SECTION_ASM_OP ".section\t.rodata" +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP ".section\t.rodata" #undef CTORS_SECTION_ASM_OP #define CTORS_SECTION_ASM_OP ".section\t.ctors,\"x\"" #undef DTORS_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP ".section\t.dtors,\"x\"" - -/* A list of other sections which the compiler might be "in" at any - given time. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A list of extra section function definitions. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - -#undef CONST_SECTION_FUNCTION -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h index b96e365ac28..1f3c4372326 100644 --- a/gcc/config/nextstep.h +++ b/gcc/config/nextstep.h @@ -439,7 +439,6 @@ objc_section_init () \ } \ } -#undef READONLY_DATA_SECTION #define READONLY_DATA_SECTION const_section #undef TARGET_ASM_SELECT_SECTION diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h index 4469e378dbc..047ca6f8d33 100644 --- a/gcc/config/pa/pa64-hpux.h +++ b/gcc/config/pa/pa64-hpux.h @@ -95,17 +95,7 @@ do { \ would like to simply include svr4.h instead of copying all these definitions. */ -/* Support const sections and the ctors and dtors sections for g++. - Note that there appears to be two different ways to support const - sections at the moment. You can either #define the symbol - READONLY_DATA_SECTION (giving it some code which switches to the - readonly data section) or else you can #define the symbols - EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and - SELECT_RTX_SECTION. We do both here just to be on the safe side. */ - -#define USE_CONST_SECTION 1 - -#define CONST_SECTION_ASM_OP "\t.section\t.rodata" +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" /* On svr4, we *do* have support for the .init and .fini sections, and we can put stuff in there to be executed before and after `main'. We let @@ -135,38 +125,6 @@ do { \ %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}" #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 - includes this file. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A default list of extra section function definitions. For targets - that use additional sections (e.g. .tdesc) you should override this - definition in the target-specific file which includes this file. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - - -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - /* Switch into a generic section. */ #define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index f20a5a8d04e..062fff756f7 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -250,7 +250,34 @@ do { \ /* Supposedly the assembler rejects the command if there is no tab! */ #define READONLY_DATA_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n" -#define READONLY_DATA_SECTION readonly_data +#define EXTRA_SECTIONS in_readonly_data + +#define EXTRA_SECTION_FUNCTIONS \ +extern void readonly_data PARAMS ((void)); \ +void \ +readonly_data () \ +{ \ + if (in_section != in_readonly_data) \ + { \ + in_section = in_readonly_data; \ + fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \ + } \ +} + +/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups + which reference data within the $TEXT$ space (for example constant + strings in the $LIT$ subspace). + + The assemblers (GAS and HP as) both have problems with handling + the difference of two symbols which is the other correct way to + reference constant data during PIC code generation. + + So, there's no way to reference constant data which is in the + $TEXT$ space during PIC generation. Instead place all constant + data into the $PRIVATE$ subspace (this reduces sharing, but it + works correctly). */ + +#define READONLY_DATA_SECTION (flag_pic ? data_section : readonly_data) /* Output before writable data. */ @@ -268,38 +295,6 @@ do { \ So, we force exception information into the data section. */ #define TARGET_ASM_EXCEPTION_SECTION data_section -/* Define the .bss section for ASM_OUTPUT_LOCAL to use. */ - -#define EXTRA_SECTIONS in_readonly_data - -/* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups - which reference data within the $TEXT$ space (for example constant - strings in the $LIT$ subspace). - - The assemblers (GAS and HP as) both have problems with handling - the difference of two symbols which is the other correct way to - reference constant data during PIC code generation. - - So, there's no way to reference constant data which is in the - $TEXT$ space during PIC generation. Instead place all constant - data into the $PRIVATE$ subspace (this reduces sharing, but it - works correctly). */ - -#define EXTRA_SECTION_FUNCTIONS \ -extern void readonly_data PARAMS ((void)); \ -void \ -readonly_data () \ -{ \ - if (in_section != in_readonly_data) \ - { \ - if (flag_pic) \ - fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); \ - else \ - fprintf (asm_out_file, "%s\n", READONLY_DATA_ASM_OP); \ - in_section = in_readonly_data; \ - } \ -} - /* This is how to output a command to make the user-level label named NAME defined for reference from other files. diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h index 5416abba3ed..87058b232eb 100644 --- a/gcc/config/rs6000/lynx.h +++ b/gcc/config/rs6000/lynx.h @@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_FILE_START #undef EXTRA_SECTIONS #undef READONLY_DATA_SECTION +#undef READONLY_DATA_SECTION_ASM_OP #undef EXTRA_SECTION_FUNCTIONS #undef SELECT_RTX_SECTION #undef TARGET_ASM_SELECT_SECTION diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e803e2eebb7..5bca89be604 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -10952,7 +10952,7 @@ rs6000_select_rtx_section (mode, x) || GET_CODE (x) == CONST)) data_section (); else - const_section (); + readonly_data_section (); } /* A C statement or statements to switch to the appropriate @@ -10970,7 +10970,7 @@ rs6000_elf_select_section (decl, reloc, align) int needs_sdata; int readonly; static void (* const sec_funcs[4]) PARAMS ((void)) = { - &const_section, + &readonly_data_section, &sdata2_section, &data_section, &sdata_section diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 2eff24c9762..06a5bf68f3e 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -431,12 +431,11 @@ do { \ /* Besides the usual ELF sections, we need a toc section. */ /* Override elfos.h definition. */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini +#define EXTRA_SECTIONS in_toc, in_sdata, in_sdata2, in_sbss, in_init, in_fini /* Override elfos.h definition. */ #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ TOC_SECTION_FUNCTION \ SDATA_SECTION_FUNCTION \ SDATA2_SECTION_FUNCTION \ diff --git a/gcc/config/sparc/litecoff.h b/gcc/config/sparc/litecoff.h index ad0e1225db4..91808f5eda7 100644 --- a/gcc/config/sparc/litecoff.h +++ b/gcc/config/sparc/litecoff.h @@ -1,5 +1,5 @@ /* Definitions of target machine for GNU compiler, for SPARClite w/o FPU, COFF. - Copyright (C) 1994, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1994, 1996, 2000, 2002 Free Software Foundation, Inc. Written by Ken Raeburn (raeburn@cygnus.com). This file is part of GNU CC. @@ -32,18 +32,6 @@ Boston, MA 02111-1307, USA. */ #undef INIT_SECTION_ASM_OP -/* A list of other sections which the compiler might be "in" at any - given time. */ - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const - -/* A list of extra section function definitions. */ - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION - #undef DO_GLOBAL_CTORS_BODY #undef DO_GLOBAL_DTORS_BODY diff --git a/gcc/config/sparc/sysv4.h b/gcc/config/sparc/sysv4.h index a4c7f915c2e..a5242bd8dd1 100644 --- a/gcc/config/sparc/sysv4.h +++ b/gcc/config/sparc/sysv4.h @@ -1,5 +1,5 @@ /* Target definitions for GNU compiler for Sparc running System V.4 - Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000 + Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). @@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA. */ #undef INIT_SECTION_ASM_OP #undef FINI_SECTION_ASM_OP -#undef CONST_SECTION_ASM_OP +#undef READONLY_DATA_SECTION_ASM_OP #undef TYPE_OPERAND_FMT #undef PUSHSECTION_FORMAT #undef STRING_ASM_OP @@ -70,12 +70,12 @@ Boston, MA 02111-1307, USA. */ /* Must use data section for relocatable constants when pic. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ -{ \ - if (flag_pic && symbolic_operand ((RTX), (MODE))) \ - data_section (); \ - else \ - const_section (); \ +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) \ +{ \ + if (flag_pic && symbolic_operand ((RTX), (MODE))) \ + data_section (); \ + else \ + readonly_data_section (); \ } /* Define the names of various pseudo-op used by the Sparc/svr4 assembler. @@ -143,7 +143,7 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3); \ #define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" #define DATA_SECTION_ASM_OP "\t.section\t\".data\"" #define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" -#define CONST_SECTION_ASM_OP "\t.section\t\".rodata\"" +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t\".rodata\"" #define INIT_SECTION_ASM_OP "\t.section\t\".init\"" #define FINI_SECTION_ASM_OP "\t.section\t\".fini\"" diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 4c49ad8ec6e..9518f5fd002 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -2535,16 +2535,6 @@ do { \ Defined in svr4.h. */ /* #define EXTRA_SECTION_FUNCTIONS */ -/* On most machines, read-only variables, constants, and jump tables are placed - in the text section. If this is not the case on your machine, this macro - should be defined to be the name of a function (either `data_section' or a - function defined in `EXTRA_SECTIONS') that switches to the section to be - used for read-only items. - - If these items should be placed in the text section, this macro should not - be defined. */ -/* #define READONLY_DATA_SECTION */ - /* A C statement or statements to switch to the appropriate section for output of RTX in mode MODE. You can assume that RTX is some kind of constant in RTL. The argument MODE is redundant except in the case of a `const_int' diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h index 5e3ddc94852..9a90c6f25a4 100644 --- a/gcc/config/svr3.h +++ b/gcc/config/svr3.h @@ -199,11 +199,8 @@ Boston, MA 02111-1307, USA. Define TARGET_ASM_CONSTRUCTOR to push the address of the constructor. */ -#define USE_CONST_SECTION 0 - #define INIT_SECTION_ASM_OP "\t.section\t.init" #define FINI_SECTION_ASM_OP "\t.section .fini,\"x\"" -#define CONST_SECTION_ASM_OP "\t.section\t.rodata, \"x\"" #define DTORS_SECTION_ASM_OP FINI_SECTION_ASM_OP /* CTOR_LIST_BEGIN and CTOR_LIST_END are machine-dependent @@ -234,14 +231,11 @@ do { \ #endif /* STACK_GROWS_DOWNWARD */ -/* Add extra sections .rodata, .init and .fini. */ - #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_const, in_init, in_fini +#define EXTRA_SECTIONS in_init, in_fini #undef EXTRA_SECTION_FUNCTIONS #define EXTRA_SECTION_FUNCTIONS \ - CONST_SECTION_FUNCTION \ INIT_SECTION_FUNCTION \ FINI_SECTION_FUNCTION @@ -267,21 +261,6 @@ fini_section () \ } \ } -#define READONLY_DATA_SECTION() const_section () - -#define CONST_SECTION_FUNCTION \ -void \ -const_section () \ -{ \ - if (!USE_CONST_SECTION) \ - text_section(); \ - else if (in_section != in_const) \ - { \ - fprintf (asm_out_file, "%s\n", CONST_SECTION_ASM_OP); \ - in_section = in_const; \ - } \ -} - /* A C statement or statements to switch to the appropriate section for output of RTX in mode MODE. RTX is some kind of constant in RTL. The argument MODE is redundant except @@ -289,4 +268,4 @@ const_section () \ go into the const section. */ #undef SELECT_RTX_SECTION -#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) const_section() +#define SELECT_RTX_SECTION(MODE,RTX,ALIGN) readonly_data_section() diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index c47e47b3dcd..72129d3868d 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -2890,7 +2890,7 @@ v850_select_section (exp, reloc, align) default: if (is_const) - const_section (); + readonly_data_section (); else data_section (); break; @@ -2899,10 +2899,10 @@ v850_select_section (exp, reloc, align) else if (TREE_CODE (exp) == STRING_CST) { if (! flag_writable_strings) - const_section (); + readonly_data_section (); else data_section (); } else - const_section (); + readonly_data_section (); } diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index 4f637ff7095..becef7cc7bb 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1021,7 +1021,7 @@ typedef enum `in_text' and `in_data'. You need not define this macro on a system with no other sections (that GCC needs to use). */ #undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, in_const, \ +#define EXTRA_SECTIONS in_tdata, in_sdata, in_zdata, \ in_rozdata, in_rosdata, in_sbss, in_zbss, in_zcommon, in_scommon /* One or more functions to be defined in `varasm.c'. These @@ -1032,8 +1032,6 @@ typedef enum /* This could be done a lot more cleanly using ANSI C ... */ #define EXTRA_SECTION_FUNCTIONS \ -CONST_SECTION_FUNCTION \ - \ void \ sdata_section () \ { \ diff --git a/gcc/config/we32k/we32k.h b/gcc/config/we32k/we32k.h index 1bf6805d1e7..e918ac0cd15 100644 --- a/gcc/config/we32k/we32k.h +++ b/gcc/config/we32k/we32k.h @@ -672,12 +672,11 @@ enum reg_class { NO_REGS, GENERAL_REGS, #define DATA_SECTION_ASM_OP "\t.data" -/* Read-only data goes in the data section because - AT&T's assembler doesn't guarantee the proper alignment - of data in the text section even if an align statement - is used. */ +/* Read-only data goes in the data section because AT&T's assembler + doesn't guarantee the proper alignment of data in the text section + even if an align statement is used. */ -#define READONLY_DATA_SECTION() data_section() +#define READONLY_DATA_SECTION data_section /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f3b379fb896..339d83d2be4 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5668,6 +5668,22 @@ A C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as writable initialized data. Normally @code{"\t.data"} is right. +@findex READONLY_DATA_SECTION_ASM_OP +@item READONLY_DATA_SECTION_ASM_OP +A C expression whose value is a string, including spacing, containing the +assembler operation to identify the following data as read-only initialized +data. + +@findex READONLY_DATA_SECTION +@item READONLY_DATA_SECTION +A macro naming a function to call to switch to the proper section for +read-only data. The default is to use @code{READONLY_DATA_SECTION_ASM_OP} +if defined, else fall back to @code{text_section}. + +The most common definition will be @code{data_section}, if the target +does not have a special read-only data section, and does not put data +in the text section. + @findex SHARED_SECTION_ASM_OP @item SHARED_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, @@ -5741,17 +5757,6 @@ functions should do jobs analogous to those of @code{text_section} and @code{data_section}, for your additional sections. Do not define this macro if you do not define @code{EXTRA_SECTIONS}. -@findex READONLY_DATA_SECTION -@item READONLY_DATA_SECTION -On most machines, read-only variables, constants, and jump tables are -placed in the text section. If this is not the case on your machine, -this macro should be defined to be the name of a function (either -@code{data_section} or a function defined in @code{EXTRA_SECTIONS}) that -switches to the section to be used for read-only items. - -If these items should be placed in the text section, this macro should -not be defined. - @findex SELECT_RTX_SECTION @item SELECT_RTX_SECTION (@var{mode}, @var{rtx}, @var{align}) A C statement or statements to switch to the appropriate section for diff --git a/gcc/final.c b/gcc/final.c index 2eeeb8c39a8..eeed1a1e892 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -99,6 +99,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define JUMP_TABLES_IN_TEXT_SECTION 0 #endif +#if defined(READONLY_DATA_SECTION) || defined(READONLY_DATA_SECTION_ASM_OP) +#define HAVE_READONLY_DATA_SECTION 1 +#else +#define HAVE_READONLY_DATA_SECTION 0 +#endif + /* Last insn processed by final_scan_insn. */ static rtx debug_insn; rtx current_output_insn; @@ -1115,11 +1121,7 @@ shorten_branches (first) next = NEXT_INSN (insn); /* ADDR_VECs only take room if read-only data goes into the text section. */ - if (JUMP_TABLES_IN_TEXT_SECTION -#if !defined(READONLY_DATA_SECTION) - || 1 -#endif - ) + if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION) if (next && GET_CODE (next) == JUMP_INSN) { rtx nextbody = PATTERN (next); @@ -1282,11 +1284,7 @@ shorten_branches (first) { /* This only takes room if read-only data goes into the text section. */ - if (JUMP_TABLES_IN_TEXT_SECTION -#if !defined(READONLY_DATA_SECTION) - || 1 -#endif - ) + if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION) insn_lengths[uid] = (XVECLEN (body, GET_CODE (body) == ADDR_DIFF_VEC) * GET_MODE_SIZE (GET_MODE (body))); @@ -1487,11 +1485,7 @@ shorten_branches (first) PUT_MODE (body, CASE_VECTOR_SHORTEN_MODE (min_addr - rel_addr, max_addr - rel_addr, body)); - if (JUMP_TABLES_IN_TEXT_SECTION -#if !defined(READONLY_DATA_SECTION) - || 1 -#endif - ) + if (JUMP_TABLES_IN_TEXT_SECTION || !HAVE_READONLY_DATA_SECTION) { insn_lengths[uid] = (XVECLEN (body, 1) * GET_MODE_SIZE (GET_MODE (body))); diff --git a/gcc/varasm.c b/gcc/varasm.c index 1709233ade0..3fc3af8d8d0 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -196,6 +196,9 @@ static enum in_section { no_section, in_text, in_data, in_named #ifdef DTORS_SECTION_ASM_OP , in_dtors #endif +#ifdef READONLY_DATA_SECTION_ASM_OP + , in_readonly_data +#endif #ifdef EXTRA_SECTIONS , EXTRA_SECTIONS #endif @@ -234,12 +237,12 @@ text_section () { if (in_section != in_text) { + in_section = in_text; #ifdef TEXT_SECTION TEXT_SECTION (); #else fprintf (asm_out_file, "%s\n", TEXT_SECTION_ASM_OP); #endif - in_section = in_text; } } @@ -250,6 +253,7 @@ data_section () { if (in_section != in_data) { + in_section = in_data; if (flag_shared_data) { #ifdef SHARED_SECTION_ASM_OP @@ -260,8 +264,6 @@ data_section () } else fprintf (asm_out_file, "%s\n", DATA_SECTION_ASM_OP); - - in_section = in_data; } } @@ -284,8 +286,17 @@ readonly_data_section () #ifdef READONLY_DATA_SECTION READONLY_DATA_SECTION (); /* Note this can call data_section. */ #else +#ifdef READONLY_DATA_SECTION_ASM_OP + if (in_section != in_readonly_data) + { + in_section = in_readonly_data; + fputs (READONLY_DATA_SECTION_ASM_OP, asm_out_file); + fputc ('\n', asm_out_file); + } +#else text_section (); #endif +#endif } /* Determine if we're in the text section. */ -- 2.11.4.GIT