diff options
author | H.J. Lu <hjl@gnu.org> | 2002-08-01 23:29:55 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2002-08-01 16:29:55 -0700 |
commit | 4e4d733e19a420252f401c7e5a469abda6a48998 (patch) | |
tree | 194c05431fa23bd64a67f9d0a7826dbb16f016c2 | |
parent | 32e9b9606f88e84fc2ffe07a094ed70b60633693 (diff) | |
download | gcc-4e4d733e19a420252f401c7e5a469abda6a48998.zip gcc-4e4d733e19a420252f401c7e5a469abda6a48998.tar.gz gcc-4e4d733e19a420252f401c7e5a469abda6a48998.tar.bz2 |
output.h (DECL_READONLY_SECTION): Remove.
* output.h (DECL_READONLY_SECTION): Remove.
(decl_readonly_section): Declare.
* varasm.c (decl_readonly_section): New.
(default_section_type_flags, default_select_section): Use it.
* config/arm/pe.c (arm_pe_unique_section): Likewise.
* config/i386/interix.c (i386_pe_unique_section): Likewise.
* config/i386/winnt.c (i386_pe_unique_section): Likewise.
* config/mcore/mcore.c (mcore_unique_section): Likewise.
* config/mips/mips.c (mips_unique_section): Likewise.
Co-Authored-By: Richard Henderson <rth@redhat.com>
From-SVN: r55957
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/config/arm/pe.c | 2 | ||||
-rw-r--r-- | gcc/config/i386/interix.c | 2 | ||||
-rw-r--r-- | gcc/config/i386/winnt.c | 4 | ||||
-rw-r--r-- | gcc/config/mcore/mcore.c | 2 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 4 | ||||
-rw-r--r-- | gcc/output.h | 13 | ||||
-rw-r--r-- | gcc/varasm.c | 23 |
8 files changed, 44 insertions, 19 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c65c89e..22f4ba1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2002-08-01 H.J. Lu <hjl@gnu.org> + Richard Henderson <rth@redhat.com> + + * output.h (DECL_READONLY_SECTION): Remove. + (decl_readonly_section): Declare. + * varasm.c (decl_readonly_section): New. + (default_section_type_flags, default_select_section): Use it. + * config/arm/pe.c (arm_pe_unique_section): Likewise. + * config/i386/interix.c (i386_pe_unique_section): Likewise. + * config/i386/winnt.c (i386_pe_unique_section): Likewise. + * config/mcore/mcore.c (mcore_unique_section): Likewise. + * config/mips/mips.c (mips_unique_section): Likewise. + 2002-08-01 Richard Henderson <rth@redhat.com> * integrate.c (copy_rtx_and_substitute): Squash MEM_EXPR when it diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index c86e231..848d198 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -264,7 +264,7 @@ arm_pe_unique_section (decl, reloc) (everything from the $ on is stripped). */ if (TREE_CODE (decl) == FUNCTION_DECL) prefix = ".text$"; - else if (DECL_READONLY_SECTION (decl, reloc)) + else if (decl_readonly_section (decl, reloc)) prefix = ".rdata$"; else prefix = ".data$"; diff --git a/gcc/config/i386/interix.c b/gcc/config/i386/interix.c index 58a19ab..e2222ca 100644 --- a/gcc/config/i386/interix.c +++ b/gcc/config/i386/interix.c @@ -112,7 +112,7 @@ i386_pe_unique_section (decl, reloc) without a .rdata section. */ if (TREE_CODE (decl) == FUNCTION_DECL) prefix = ".text$"; - else if (DECL_READONLY_SECTION (decl, reloc)) + else if (decl_readonly_section (decl, reloc)) prefix = ".rdata$"; else prefix = ".data$"; diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index d6f0a7a..066b4d2 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -472,7 +472,7 @@ i386_pe_unique_section (decl, reloc) without a .rdata section. */ if (TREE_CODE (decl) == FUNCTION_DECL) prefix = ".text$"; - else if (DECL_READONLY_SECTION (decl, reloc)) + else if (decl_readonly_section (decl, reloc)) prefix = ".rdata$"; else prefix = ".data$"; @@ -518,7 +518,7 @@ i386_pe_section_type_flags (decl, name, reloc) if (decl && TREE_CODE (decl) == FUNCTION_DECL) flags = SECTION_CODE; - else if (decl && DECL_READONLY_SECTION (decl, reloc)) + else if (decl && decl_readonly_section (decl, reloc)) flags = 0; else { diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index 2b7747e..650d0dd 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -3540,7 +3540,7 @@ mcore_unique_section (decl, reloc) prefix = ".text$"; /* For compatibility with EPOC, we ignore the fact that the section might have relocs against it. */ - else if (DECL_READONLY_SECTION (decl, 0)) + else if (decl_readonly_section (decl, 0)) prefix = ".rdata$"; else prefix = ".data$"; diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 532e559..d04f4ce 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -10310,7 +10310,7 @@ mips_unique_section (decl, reloc) read-only data if possible, in order to reduce RAM usage. */ - if (DECL_READONLY_SECTION (decl, reloc)) + if (decl_readonly_section (decl, reloc)) sec = 1; else if (size > 0 && size <= mips_section_threshold) sec = 3; @@ -10325,7 +10325,7 @@ mips_unique_section (decl, reloc) if (size > 0 && size <= mips_section_threshold) sec = 3; - else if (DECL_READONLY_SECTION (decl, reloc)) + else if (decl_readonly_section (decl, reloc)) sec = 1; else sec = 2; diff --git a/gcc/output.h b/gcc/output.h index 53ed810..533af93 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -468,16 +468,9 @@ extern struct rtx_def *current_output_insn; The precise value is the insn being output, to pass to error_for_asm. */ extern rtx this_is_asm_operands; -/* Decide whether DECL needs to be in a writable section. RELOC is the same - as for SELECT_SECTION. */ - -#define DECL_READONLY_SECTION(DECL,RELOC) \ - (TREE_READONLY (DECL) \ - && ! TREE_THIS_VOLATILE (DECL) \ - && DECL_INITIAL (DECL) \ - && (DECL_INITIAL (DECL) == error_mark_node \ - || TREE_CONSTANT (DECL_INITIAL (DECL))) \ - && ! (RELOC && (flag_pic || DECL_ONE_ONLY (DECL)))) +/* Decide whether DECL needs to be in a writable section. + RELOC is the same as for SELECT_SECTION. */ +extern bool decl_readonly_section PARAMS ((tree, int)); /* User label prefix in effect for this compilation. */ extern const char *user_label_prefix; diff --git a/gcc/varasm.c b/gcc/varasm.c index d22cb11..e35d8a2 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4712,7 +4712,7 @@ default_section_type_flags (decl, name, reloc) if (decl && TREE_CODE (decl) == FUNCTION_DECL) flags = SECTION_CODE; - else if (decl && DECL_READONLY_SECTION (decl, reloc)) + else if (decl && decl_readonly_section (decl, reloc)) flags = 0; else flags = SECTION_WRITE; @@ -4872,7 +4872,7 @@ default_select_section (decl, reloc, align) if (DECL_P (decl)) { - if (DECL_READONLY_SECTION (decl, reloc)) + if (decl_readonly_section (decl, reloc)) readonly = true; } else if (TREE_CODE (decl) == CONSTRUCTOR) @@ -5011,6 +5011,25 @@ categorize_decl_for_section (decl, reloc) return ret; } +bool +decl_readonly_section (decl, reloc) + tree decl; + int reloc; +{ + switch (categorize_decl_for_section (decl, reloc)) + { + case SECCAT_RODATA: + case SECCAT_RODATA_MERGE_STR: + case SECCAT_RODATA_MERGE_STR_INIT: + case SECCAT_RODATA_MERGE_CONST: + return true; + break; + default: + return false; + break; + } +} + /* Select a section based on the above categorization. */ void |