Some library code that is shared with other packages also
tests this symbol to see if it is being compiled as part
of the C library. */
-#define _LIBC
+#define _LIBC 1
+/*
+\f
+*/
+#ifndef ASSEMBLER
+/* Define the macro `_' for conveniently marking translatable strings
+ in the libc source code. */
+#include <libintl.h>
+extern const char _libc_intl_domainname[];
+#ifdef dgettext
+/* This is defined as an optimizing macro, so use it. */
+#define _(msgid) dgettext (_libc_intl_domainname, (msgid))
+#else
+/* Be sure to use only the __ name when `dgettext' is a plain function
+ instead of an optimizing macro. */
+#define _(msgid) __dgettext (_libc_intl_domainname, (msgid))
+#endif
+#endif
+
+/*
+\f
+*/
/* The symbols in all the user (non-_) macros are C symbols. Predefined
should be HAVE_WEAK_SYMBOLS and/or HAVE_ELF and/or HAVE_GNU_LD.
HAVE_WEAK_SYMBOLS is implied by the other two. HAVE_GNU_LD without
#endif
#endif
+
/* Define ALIAS as a strong alias for ORIGINAL. */
+#ifdef HAVE_ASM_SET_DIRECTIVE
#define strong_alias_asm(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
#ifdef ASSEMBLER
#define strong_alias(original, alias) strong_alias_asm (original, alias)
#else
#define strong_alias(original, alias) \
- asm (".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original);
+ asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
+ ".set " __SYMBOL_PREFIX #alias "," __SYMBOL_PREFIX #original);
+#endif
+#else
+#define strong_alias_asm(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias); \
+ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
+#ifdef ASSEMBLER
+#define strong_alias(original, alias) strong_alias_asm (original, alias)
+#else
+#define strong_alias(original, alias) \
+ asm (__string_1 (ASM_GLOBAL_DIRECTIVE) " " __SYMBOL_PREFIX #alias "\n" \
+ __SYMBOL_PREFIX #alias " = " __SYMBOL_PREFIX #original);
+#endif
#endif
-/* Define ALIAS as a weak alias for ORIGINAL.
- If weak aliases are not available, this defines a strong alias. */
+/* Helper macros used above. */
+#define __string_1(x) __string_0(x)
+#define __string_0(x) #x
+
+
#ifdef HAVE_WEAK_SYMBOLS
#ifdef ASSEMBLER
+
+/* Define ALIAS as a weak alias for ORIGINAL.
+ If weak aliases are not available, this defines a strong alias. */
#define weak_alias(original, alias) \
.weak C_SYMBOL_NAME (alias); \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
/* Declare SYMBOL to be weak. */
#define weak_symbol(symbol) .weak C_SYMBOL_NAME (symbol)
+
#else
#define weak_symbol(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
#define weak_alias(original, alias) \
#endif
+#if (!defined (ASSEMBLER) && \
+ (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)))
+/* GCC 2.7 and later has special syntax for weak symbols and aliases.
+ Using that is better when possible, because the compiler and assembler
+ are better clued in to what we are doing. */
+#undef strong_alias
+#define strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+
+#ifdef HAVE_WEAK_SYMBOLS
+#undef weak_symbol
+#define weak_symbol(name) \
+ extern __typeof (name) name __attribute__ ((weak));
+#undef weak_alias
+#define weak_alias(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
+#endif /* HAVE_WEAK_SYMBOLS. */
+#endif /* Not ASSEMBLER, and GCC 2.7 or later. */
+
+
-/* When the file using this macro is linked in, the linker
- will emit a warning message MSG. */
+/* When a reference to SYMBOL is encountered, the linker will emit a
+ warning message MSG. */
#ifdef HAVE_GNU_LD
#ifdef HAVE_ELF
-#define link_warning(msg) \
- static const char __evoke_link_warning__[] \
- __attribute__ ((section (".gnu.warning"))) = msg;
+#define link_warning(symbol, msg) \
+ static const char __evoke_link_warning_##symbol[] \
+ __attribute__ ((section (".gnu.warning." #symbol))) = msg;
#else
-#define link_warning(msg) \
+#define link_warning(symbol, msg) \
asm(".stabs \"" msg "\",30,0,0,0\n" \
- ".stabs \"__evoke_link_warning__\",1,0,0,0\n"\
- ".stabs \"__evoke_link_warning__\",2,0,0,0\n");
+ ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n");
#endif
#else
/* We will never be heard; they will all die horribly. */
-#define link_warning(msg)
+#define link_warning(symbol, msg)
#endif
/* A canned warning for sysdeps/stub functions. */
#define stub_warning(name) \
- link_warning ("warning: " #name " is not implemented and will always fail")
+ link_warning (name, \
+ "warning: " #name " is not implemented and will always fail")
/*
\f
because it will need to be relocated at run time anyway. */
#define _elf_set_element(set, symbol) \
static const void *__elf_set_##set##_element_##symbol##__ \
- __attribute__ ((section (#set))) = &(symbol)
+ __attribute__ ((unused, section (#set))) = &(symbol)
#else
#define _elf_set_element(set, symbol) \
static const void *const __elf_set_##set##_element_##symbol##__ \
- __attribute__ ((section (#set))) = &(symbol)
+ __attribute__ ((unused, section (#set))) = &(symbol)
#endif
/* Define SET as a symbol set. This may be required (it is in a.out) to
/* Declare SET for use in this module, if defined in another module. */
#define symbol_set_declare(set) \
- extern void *const __start_##set, *const __stop_##set;
+ extern void *const __start_##set __attribute__ ((__weak__)); \
+ extern void *const __stop_##set __attribute__ ((__weak__));
/* Return a pointer (void *const *) to the first element of SET. */
#define symbol_set_first_element(set) (&__start_##set)