From c015db3fe0dfd0575a605437e77175fe8970660c Mon Sep 17 00:00:00 2001 From: dnovillo Date: Thu, 18 Nov 1999 00:41:13 +0000 Subject: [PATCH] * invoke.texi: Add documentation for -muninit-const-in-rodata. * config/mips/mips.h (MASK_UNINIT_CONST_IN_RODATA): Define. (TARGET_UNINIT_CONST_IN_RODATA): Define. (text_section): Add switches -munint-const-in-rodata and -mno-uninit-const-in-rodata. (ASM_OUTPUT_COMMON): Remove. (ASM_OUTPUT_ALIGNED_DECL_COMMON): Define. Check if uninitialized const objects should be placed in read-only data. Otherwise declare them in common. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30562 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/config/mips/mips.h | 35 +++++++++++++++++++++++++++++++++-- gcc/invoke.texi | 9 +++++++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0295d7c..fe49964 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +Wed Nov 17 17:39:48 MST 1999 Diego Novillo + + * invoke.texi: Add documentation for -muninit-const-in-rodata. + * config/mips/mips.h (MASK_UNINIT_CONST_IN_RODATA): Define. + (TARGET_UNINIT_CONST_IN_RODATA): Define. + (text_section): Add switches -munint-const-in-rodata and + -mno-uninit-const-in-rodata. + (ASM_OUTPUT_COMMON): Remove. + (ASM_OUTPUT_ALIGNED_DECL_COMMON): Define. Check if uninitialized + const objects should be placed in read-only data. Otherwise declare + them in common. + Wed Nov 17 16:38:32 1999 Richard Henderson * jump.c (jump_optimize_1): Revert last change. diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 9e64f3e..1d0f1a8 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -209,6 +209,8 @@ extern void sbss_section PARAMS ((void)); #define MASK_MIPS16 0x01000000 /* Generate mips16 code */ #define MASK_NO_CHECK_ZERO_DIV 0x04000000 /* divide by zero checking */ #define MASK_CHECK_RANGE_DIV 0x08000000 /* divide result range checking */ +#define MASK_UNINIT_CONST_IN_RODATA 0x10000000 /* Store uninitialized + consts in rodata */ /* Dummy switches used only in spec's*/ #define MASK_MIPS_TFILE 0x00000000 /* flag for mips-tfile usage */ @@ -288,6 +290,11 @@ extern void sbss_section PARAMS ((void)); fastest code. */ #define TARGET_EMBEDDED_DATA (target_flags & MASK_EMBEDDED_DATA) + /* always store uninitialized const + variables in rodata, requires + TARGET_EMBEDDED_DATA. */ +#define TARGET_UNINIT_CONST_IN_RODATA (target_flags & MASK_UNINIT_CONST_IN_RODATA) + /* generate big endian code. */ #define TARGET_BIG_ENDIAN (target_flags & MASK_BIG_ENDIAN) @@ -392,6 +399,10 @@ extern void sbss_section PARAMS ((void)); "Use ROM instead of RAM"}, \ {"no-embedded-data", -MASK_EMBEDDED_DATA, \ "Don't use ROM instead of RAM"}, \ + {"uninit-const-in-rodata", MASK_UNINIT_CONST_IN_RODATA, \ + "Put uninitialized constants in ROM (needs -membedded-data)"}, \ + {"no-uninit-const-in-rodata", -MASK_UNINIT_CONST_IN_RODATA, \ + "Don't put uninitialized constants in ROM"}, \ {"eb", MASK_BIG_ENDIAN, \ "Use big-endian byte order"}, \ {"el", -MASK_BIG_ENDIAN, \ @@ -4188,8 +4199,28 @@ while (0) /* This says how to define a global common symbol. */ -#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ - mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", (SIZE)) +#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \ + do { \ + /* If the target wants uninitialized const declarations in \ + .rdata then don't put them in .comm */ \ + if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA \ + && TREE_CODE (DECL) == VAR_DECL && TREE_READONLY (DECL) \ + && (DECL_INITIAL (DECL) == 0 \ + || DECL_INITIAL (DECL) == error_mark_node)) \ + { \ + if (TREE_PUBLIC (DECL) && DECL_NAME (DECL)) \ + ASM_GLOBALIZE_LABEL (STREAM, NAME); \ + \ + 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)); \ + } \ + else \ + mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n", \ + (SIZE)); \ + } while (0) + /* This says how to define a local common symbol (ie, not visible to linker). */ diff --git a/gcc/invoke.texi b/gcc/invoke.texi index bae33dd..7b7a088 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -334,12 +334,12 @@ in the following sections. -mminimum-fp-blocks -mnohc-struct-return @emph{MIPS Options} --mabicalls -mcpu=@var{cpu type} -membedded-data +-mabicalls -mcpu=@var{cpu type} -membedded-data -muninit-const-in-rodata -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 -mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy -mmips-as -mmips-tfile -mno-abicalls --mno-embedded-data -mno-embedded-pic +-mno-embedded-data -mno-uninit-const-in-rodata -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float @@ -5574,6 +5574,11 @@ next in the small data section if possible, otherwise in data. This gives slightly slower code than the default, but reduces the amount of RAM required when executing, and thus may be preferred for some embedded systems. +@item -muninit-const-in-rodata +@itemx -mno-uninit-const-in-rodata +When used together with -membedded-data, it will always store uninitialized +const variables in the read-only data section. + @item -msingle-float @itemx -mdouble-float The @samp{-msingle-float} switch tells gcc to assume that the floating -- 2.7.4