aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2003-07-17 21:52:51 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2003-07-17 21:52:51 +0000
commit26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40 (patch)
tree29814f71f7c3a3908af1f0248cd905e9f4e13d0f /gcc/c-opts.c
parent89e9faee226678f1298961f6ef75243f2c1b3b2c (diff)
downloadgcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.zip
gcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.tar.gz
gcc-26e0dcb3262e0b0dae53d60ef6a8ea3cce6b2e40.tar.bz2
re PR middle-end/11498 (asm can't be used to give a variable its own name)
PR 11498 * Makefile.in (c-opts.o): Add $(LANGHOOKS_DEF_H). (langhooks.o): Add $(GGC_H), gt-langhooks.h. (GTFILES): Add langhooks.c. (gt-langhooks.h): New. * c-common.h (c_static_assembler_name): Prototype. * c-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Define. * objc/objc-lang.c (LANG_HOOKS_SET_DECL_ASSEMBLER_NAME): Define. * c-opts.c: Include langhooks-def.h. (c_static_assembler_name): New. * langhooks.c: Include ggc.h. Include gt-langhooks.h. (var_labelno): New. (lhd_set_decl_assembler_name): Give static objects with context unique names. * varasm.c (var_labelno): Delete. (make_decl_rtl): Don't change the assembler name once it's set. From-SVN: r69527
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 1beb651..9fa6dda 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "debug.h" /* For debug_hooks. */
#include "opts.h"
#include "options.h"
+#include "langhooks-def.h"
#ifndef DOLLARS_IN_IDENTIFIERS
# define DOLLARS_IN_IDENTIFIERS true
@@ -1250,6 +1251,22 @@ c_common_finish (void)
fatal_error ("when writing output to %s: %m", out_fname);
}
+/* A wrapper around lhd_set_decl_assembler_name that gives static
+ variables their C names if they are at the top level and only one
+ translation unit is being compiled, for backwards compatibility
+ with certain bizzare assembler hacks (like crtstuff.c). */
+
+void
+c_static_assembler_name (tree decl)
+{
+ if (num_in_fnames == 1
+ && TREE_STATIC (decl) && !TREE_PUBLIC (decl) && DECL_CONTEXT (decl)
+ && TREE_CODE (DECL_CONTEXT (decl)) == TRANSLATION_UNIT_DECL)
+ SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
+ else
+ lhd_set_decl_assembler_name (decl);
+}
+
/* Either of two environment variables can specify output of
dependencies. Their value is either "OUTPUT_FILE" or "OUTPUT_FILE
DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to