From: Jim Wilson Date: Fri, 18 Mar 1994 23:43:00 +0000 (-0800) Subject: (SELECT_SECTION): Variables go in readonly data X-Git-Tag: misc/cutover-egcs-0~7123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed8969fa7d85d9467bea0379ff4bca782708ac3f;p=thirdparty%2Fgcc.git (SELECT_SECTION): Variables go in readonly data only if the initializer is constant. From-SVN: r6820 --- diff --git a/gcc/config/i386/osfrose.h b/gcc/config/i386/osfrose.h index 858c2772e68d..14f4b95f661b 100644 --- a/gcc/config/i386/osfrose.h +++ b/gcc/config/i386/osfrose.h @@ -707,7 +707,10 @@ while (0) else if (TREE_CODE (DECL) != VAR_DECL) \ readonly_data_section (); \ \ - else if (!TREE_READONLY (DECL)) \ + else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ \ else \ diff --git a/gcc/config/i386/svr3gas.h b/gcc/config/i386/svr3gas.h index d6b0d95b0e12..cafbdd56a4fb 100644 --- a/gcc/config/i386/svr3gas.h +++ b/gcc/config/i386/svr3gas.h @@ -255,7 +255,10 @@ dtors_section () \ else if (TREE_CODE (DECL) == VAR_DECL) \ { \ if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ else \ const_section (); \ diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index a0203b4dfda4..6c41e4e3ffcc 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -197,13 +197,13 @@ extern char * reg_names[]; Redefined in sysv4.h, and luna.h. */ #define VERSION_INFO1 "88open OCS/BCS, " #ifndef VERSION_INFO2 -#define VERSION_INFO2 "$Revision: 1.57 $" +#define VERSION_INFO2 "$Revision: 1.58 $" #endif #ifndef VERSION_STRING #define VERSION_STRING version_string #ifdef __STDC__ -#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.57 $ " __DATE__ +#define TM_RCS_ID "@(#)" __FILE__ " $Revision: 1.58 $ " __DATE__ #else #define TM_RCS_ID "$What$" #endif /* __STDC__ */ @@ -2552,7 +2552,10 @@ sdata_section () \ if (SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0))) \ sdata_section (); \ else if ((flag_pic && RELOC) \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ else \ const_section (); \ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index e9bd74490c63..bb20567bc2a6 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3528,7 +3528,10 @@ rdata_section () \ else if (TREE_CODE (DECL) != VAR_DECL) \ rdata_section (); \ \ - else if (!TREE_READONLY (DECL)) \ + else if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ \ else \ diff --git a/gcc/config/nextstep.h b/gcc/config/nextstep.h index 3fc507a21564..d6e7003cfe89 100644 --- a/gcc/config/nextstep.h +++ b/gcc/config/nextstep.h @@ -536,11 +536,19 @@ objc_section_init () \ else \ data_section (); \ } \ - else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \ - && !TREE_SIDE_EFFECTS (exp)) \ - readonly_data_section (); \ + else if (TREE_CODE (DECL) == VAR_DECL) \ + { \ + if ((flag_pic && RELOC) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ + data_section (); \ + else \ + readonly_data_section (); \ + } \ else \ - data_section (); \ + readonly_data_section (); \ } \ while (0) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 0662d5562f20..3bd77cd369e5 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1747,11 +1747,13 @@ toc_section () \ #define SELECT_SECTION(EXP,RELOC) \ { \ - if ((TREE_READONLY (EXP) \ - || (TREE_CODE (EXP) == STRING_CST \ - && !flag_writable_strings)) \ - && ! TREE_THIS_VOLATILE (EXP) \ - && ! (RELOC)) \ + if ((TREE_CODE (EXP) == STRING_CST \ + && !flag_writable_strings) \ + || (TREE_READONLY (EXP) && ! TREE_THIS_VOLATILE (EXP) \ + && DECL_INITIAL (EXP) \ + && (DECL_INITIAL (EXP) == error_mark_node \ + || TREE_CONSTANT (DECL_INITIAL (EXP))) \ + && ! (RELOC))) \ { \ if (TREE_PUBLIC (EXP)) \ read_only_data_section (); \ diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 76611a9e29b9..9fe8b82bab92 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -282,6 +282,9 @@ extern int target_flags; if (TREE_CODE (T) == VAR_DECL) \ { \ if (TREE_READONLY (T) && ! TREE_SIDE_EFFECTS (T) \ + && DECL_INITIAL (T) \ + && (DECL_INITIAL (T) == error_mark_node \ + || TREE_CONSTANT (DECL_INITIAL (T))) \ && DECL_ALIGN (T) <= MAX_TEXT_ALIGN \ && ! (flag_pic && (RELOC))) \ text_section (); \ diff --git a/gcc/config/svr3.h b/gcc/config/svr3.h index 9f8ddc1530b7..94cefb44f3eb 100644 --- a/gcc/config/svr3.h +++ b/gcc/config/svr3.h @@ -363,7 +363,10 @@ dtors_section () \ else if (TREE_CODE (DECL) == VAR_DECL) \ { \ if ((0 && RELOC) /* should be (flag_pic && RELOC) */ \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ else \ const_section (); \ diff --git a/gcc/config/svr4.h b/gcc/config/svr4.h index 1cdf90c5c0a6..9b5d15cdb9e5 100644 --- a/gcc/config/svr4.h +++ b/gcc/config/svr4.h @@ -513,7 +513,10 @@ dtors_section () \ else if (TREE_CODE (DECL) == VAR_DECL) \ { \ if ((flag_pic && RELOC) \ - || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \ + || !TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL) \ + || !DECL_INITIAL (DECL) \ + || (DECL_INITIAL (DECL) != error_mark_node \ + && !TREE_CONSTANT (DECL_INITIAL (DECL)))) \ data_section (); \ else \ const_section (); \ diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h index fc2ff4b4dc5a..b6f2ebd0a0b7 100644 --- a/gcc/config/vax/vms.h +++ b/gcc/config/vax/vms.h @@ -253,7 +253,10 @@ const_section () \ { \ if (TREE_CODE (T) == VAR_DECL) \ { \ - if (TREE_READONLY (T) && ! TREE_THIS_VOLATILE (T)) \ + if (TREE_READONLY (T) && ! TREE_THIS_VOLATILE (T) \ + && DECL_INITIAL (T) \ + && (DECL_INITIAL (T) == error_mark_node \ + || TREE_CONSTANT (DECL_INITIAL (T)))) \ { \ if (TREE_PUBLIC (T)) \ const_section (); \