summaryrefslogtreecommitdiff
path: root/include/features.h
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-18 08:34:59 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-18 08:34:59 +0000
commit5305b3df0ac3b6970947180fa9b2fcad0b6e6364 (patch)
tree4d4e390fd0f8b77e73e3e96542956df47582b3b5 /include/features.h
parentdc3cbf11415312c6a28dc8c652ee2bec7e6a6f8e (diff)
Support strong_alias and begin merging usage of weak_function
Diffstat (limited to 'include/features.h')
-rw-r--r--include/features.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/include/features.h b/include/features.h
index 22795e0b3..562dca91f 100644
--- a/include/features.h
+++ b/include/features.h
@@ -333,28 +333,31 @@
/* Some nice features only work properly with ELF */
#if defined _LIBC && defined HAVE_ELF
+/* Define ALIASNAME as a weak alias for NAME. */
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
+# define _weak_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+/* Define ALIASNAME as a strong alias for NAME. */
+# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+/* This comes between the return type and function name in
+ * a function definition to make that definition weak. */
+# define weak_function __attribute__ ((weak))
+/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
+ * section attributes on what looks like a comment to the assembler. */
# define link_warning(symbol, msg) \
asm (".section " ".gnu.warning." #symbol "\n\t.previous"); \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
-# define _weak_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
-/*
-# define _weak_alias(name, aliasname) \
- asm(".global " C_SYMBOL_PREFIX #name ";" \
- ".weak " C_SYMBOL_PREFIX #aliasname ";" \
- C_SYMBOL_PREFIX #aliasname "=" C_SYMBOL_PREFIX #name ";");
-*/
-# define weak_symbol(name) \
- asm(".weak " C_SYMBOL_PREFIX #name ";");
#else
-# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
+# define strong_alias(name, aliasname) _strong_alias (name, aliasname)
+# define weak_alias(name, aliasname) _strong_alias (name, aliasname)
+# define _strong_alias(name, aliasname) \
+ __asm__(".global _" #aliasname "\n.set _" #aliasname ",_" #name);
# define link_warning(symbol, msg) \
asm (".stabs \"" msg "\",30,0,0,0\n\t" \
".stabs \"" #symbol "\",1,0,0,0\n");
-# define _weak_alias(name, aliasname) \
- __asm__(".global _" #aliasname "\n.set _" #aliasname ",_" #name);
#endif
/* --- this is added to integrate linuxthreads */