From 2c0d84d608a0f13c7ef2bab30e31960cbf8cc828 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Thu, 16 Dec 1993 00:15:21 +0000 Subject: [PATCH] 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 --- gcc/c-decl.c | 4 ++++ gcc/toplev.c | 4 ++++ gcc/tree.h | 8 +++++++- gcc/varasm.c | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 7a18d446c4f..bdfb7b4e6b0 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 7acabf63308..b60c6245a51 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 50b4d7ea57c..a697f96666b 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 013be976ad0..3dbc517d13d 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)) { -- 2.30.2