aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Stump <mrs@gcc.gnu.org>1993-12-16 00:15:21 +0000
committerMike Stump <mrs@gcc.gnu.org>1993-12-16 00:15:21 +0000
commit2c0d84d608a0f13c7ef2bab30e31960cbf8cc828 (patch)
treef01094003c85b950042ac6f04b34b7c4ce8cc80e
parent3d5e2367e9ff1a9613471c621b16f89dd3b8cb67 (diff)
downloadgcc-2c0d84d608a0f13c7ef2bab30e31960cbf8cc828.zip
gcc-2c0d84d608a0f13c7ef2bab30e31960cbf8cc828.tar.gz
gcc-2c0d84d608a0f13c7ef2bab30e31960cbf8cc828.tar.bz2
cp-decl.c (flag_conserve_space): New language specific flag to tell the compiler to use .common when possible.
* cp-decl.c (flag_conserve_space): New language specific flag to tell the compiler to use .common when possible. Reduces the size of .o files. * cp-decl.c (duplicate_decls): Copy DECL_COMMON from the olddecl. * cp-decl.c (start_decl): Set DECL_COMMON appropriately. * cp-decl.c (finish_decl): Use flag_conserve_space, instead of flag_no_common. * cp-decl2.c (flag_conserve_space, lang_f_options): New flag. * toplev.c (lang_options): New -fconserve-space flag. * tree.h (DECL_COMMON): New flag. * tree.h (tree_decl): New common_flag. * varasm.c (assemble_variable): Use DECL_COMMON to help determine if an object can be put in .common. * c-decl.c (start_decl): Set DECL_COMMON to 1.. From-SVN: r6244
-rw-r--r--gcc/c-decl.c4
-rw-r--r--gcc/toplev.c4
-rw-r--r--gcc/tree.h8
-rw-r--r--gcc/varasm.c1
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 7a18d44..bdfb7b4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3333,6 +3333,10 @@ start_decl (declarator, declspecs, initialized)
TEM may equal DECL or it may be a previous decl of the same name. */
tem = pushdecl (decl);
+ /* For C and Obective-C, we by default put things in .common when
+ possible. */
+ DECL_COMMON (tem) = 1;
+
/* For a local variable, define the RTL now. */
if (current_binding_level != global_binding_level
/* But not if this is a duplicate decl
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 7acabf6..b60c624 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -646,6 +646,10 @@ char *lang_options[] =
"-fno-external-templates",
"-fansi-overloading",
"-fno-ansi-overloading",
+ "-fhuge-objects",
+ "-fno-huge-objects",
+ "-fconserve-space",
+ "-fno-conserve-space",
"-Wreturn-type",
"-Wno-return-type",
diff --git a/gcc/tree.h b/gcc/tree.h
index 50b4d7e..a697f96 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -832,6 +832,11 @@ struct tree_type
because this decl is unused. */
#define DECL_IN_SYSTEM_HEADER(NODE) ((NODE)->decl.in_system_header_flag)
+/* Nonzero for a given ..._DECL node means that this node should be
+ put in .common, if possible. If a DECL_INITIAL is given, and it
+ is not error_mark_node, then the decl cannot be put in .common. */
+#define DECL_COMMON(NODE) ((NODE)->decl.common_flag)
+
/* Language-specific decl information. */
#define DECL_LANG_SPECIFIC(NODE) ((NODE)->decl.lang_specific)
@@ -914,7 +919,8 @@ struct tree_decl
unsigned abstract_flag : 1;
unsigned in_system_header_flag : 1;
- /* room for seven more */
+ unsigned common_flag : 1;
+ /* room for six more */
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 013be97..3dbc517 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -979,6 +979,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
-fno-common gives strict ANSI behavior. Usually you don't want it.
This matters only for variables with external linkage. */
if ((! flag_no_common || ! TREE_PUBLIC (decl))
+ && DECL_COMMON (decl)
&& ! dont_output_data
&& (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
{