aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1996-09-18 11:07:42 +0000
committerJason Merrill <merrill@gnu.org>1996-09-18 11:07:42 +0000
commit7988fa6d84461f28a5c74f31de7be514c569e228 (patch)
treec1c0c371005b3462f1316b5ede3d9d4b901f69bf /gcc
parentc5bd82cb0ff4e7f66bf49031d8953b76f354a54b (diff)
downloadgcc-7988fa6d84461f28a5c74f31de7be514c569e228.zip
gcc-7988fa6d84461f28a5c74f31de7be514c569e228.tar.gz
gcc-7988fa6d84461f28a5c74f31de7be514c569e228.tar.bz2
(MAKE_DECL_ONE_ONLY): Define.
From-SVN: r12736
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/svr4.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/config/svr4.h b/gcc/config/svr4.h
index 4332c0f..f39dd15 100644
--- a/gcc/config/svr4.h
+++ b/gcc/config/svr4.h
@@ -639,6 +639,37 @@ do { \
} \
} while (0)
+/* A C statement (sans semicolon) to mark DECL to be emitted as a
+ public symbol such that extra copies in multiple translation units will
+ be discarded by the linker. */
+#define MAKE_DECL_ONE_ONLY(DECL) \
+do { \
+ int len; \
+ char *name, *string, *prefix; \
+ \
+ DECL_WEAK (DECL) = 1; \
+ \
+ name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); \
+ \
+ if (DECL_ONE_ONLY (decl)) \
+ { \
+ if (TREE_CODE (decl) == FUNCTION_DECL) \
+ prefix = ".gnu.linkonce.t."; \
+ else if (TREE_READONLY (decl)) \
+ prefix = ".gnu.linkonce.r."; \
+ else \
+ prefix = ".gnu.linkonce.d."; \
+ } \
+ else \
+ prefix = ""; \
+ \
+ len = strlen (name) + strlen (prefix); \
+ string = alloca (len + 1); \
+ sprintf (string, "%s%s", prefix, name); \
+ \
+ DECL_SECTION_NAME (DECL) = build_string (len, string); \
+} while (0)
+
/* A C statement (sans semicolon) to output an element in the table of
global constructors. */
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \