mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
tools/elfutils: use weak alias over no alias for macOS
Clang has support for weak aliases despite no support for strong aliases, but it only works with the #pragma directive. Implementing weak aliases instead of none is likely a more upstream-friendly solution for supporting building on other platforms. Signed-off-by: Michael Pratt <mcpratt@pm.me> Link: https://github.com/openwrt/openwrt/pull/15690 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
52a5344501
commit
e4fb7c9544
@ -34,7 +34,7 @@
|
|||||||
LIBS="$saved_LIBS"
|
LIBS="$saved_LIBS"
|
||||||
--- a/lib/eu-config.h
|
--- a/lib/eu-config.h
|
||||||
+++ b/lib/eu-config.h
|
+++ b/lib/eu-config.h
|
||||||
@@ -59,14 +59,18 @@
|
@@ -59,14 +59,19 @@
|
||||||
# define once(once_control, init_routine) init_routine()
|
# define once(once_control, init_routine) init_routine()
|
||||||
#endif /* USE_LOCKS */
|
#endif /* USE_LOCKS */
|
||||||
|
|
||||||
@ -45,8 +45,9 @@
|
|||||||
#define _(Str) dgettext ("elfutils", Str)
|
#define _(Str) dgettext ("elfutils", Str)
|
||||||
|
|
||||||
/* Compiler-specific definitions. */
|
/* Compiler-specific definitions. */
|
||||||
|
+#define __PRAGMA(str) _Pragma (#str)
|
||||||
+#ifdef __APPLE__
|
+#ifdef __APPLE__
|
||||||
+#define strong_alias(name, aliasname)
|
+#define strong_alias(name, aliasname) __PRAGMA(weak aliasname = name)
|
||||||
+#else
|
+#else
|
||||||
#define strong_alias(name, aliasname) \
|
#define strong_alias(name, aliasname) \
|
||||||
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
|
||||||
@ -54,7 +55,7 @@
|
|||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
# define internal_function __attribute__ ((regparm (3), stdcall))
|
# define internal_function __attribute__ ((regparm (3), stdcall))
|
||||||
@@ -77,7 +81,7 @@
|
@@ -77,7 +82,7 @@
|
||||||
#define internal_strong_alias(name, aliasname) \
|
#define internal_strong_alias(name, aliasname) \
|
||||||
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
|
extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@
|
|||||||
#define attribute_hidden \
|
#define attribute_hidden \
|
||||||
__attribute__ ((visibility ("hidden")))
|
__attribute__ ((visibility ("hidden")))
|
||||||
#else
|
#else
|
||||||
@@ -166,7 +170,7 @@ asm (".section predict_data, \"aw\"; .pr
|
@@ -166,7 +171,7 @@ asm (".section predict_data, \"aw\"; .pr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Avoid PLT entries. */
|
/* Avoid PLT entries. */
|
||||||
|
Loading…
Reference in New Issue
Block a user