summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2020-02-05 10:58:04 -0500
committerZack Weinberg <zackw@panix.com>2020-02-06 11:40:14 -0500
commitc10abe6fe6583d57326400a98791da44d542166d (patch)
tree724036ba570bde0579733ecb9fcd01dc188b04b2 /lib
parent80d052736096538e79ac3a14574ed1d8f72639ee (diff)
downloadlibxcrypt-c10abe6fe6583d57326400a98791da44d542166d.tar.gz
libxcrypt-c10abe6fe6583d57326400a98791da44d542166d.tar.bz2
libxcrypt-c10abe6fe6583d57326400a98791da44d542166d.zip
OSX build fixes.
This fixes all of the failures seen on Travis in a build on MacOS X. I’m doing this now because I’m experimenting with not using libtool, and how you build a shared library on OSX is different enough from how you do it on Linux that it makes a good test case for the replacement. - crypt-port.h: Don’t issue .symver directives on OSX, Mach-O does not support symbol versioning. - m4/zw_simple_warnings.m4: Use -Wno-deprecated-declarations on OSX. (‘syscall’ is apparently deprecated in current revs of the SDK.) - test/symbols-*.sh: When $host_os matches *darwin*, remove a leading underscore from all symbol names before processing them further; Mach-O follows the old a.out tradition of prepending an underscore to all global symbols defined in C. Also use nm --defined-only instead of grep -v ' U ', and accommodate OSX nm’s output syntax (it puts a space between the filename and the address, unlike GNU nm). - Makefile.am: Pass $host_os down to test scripts. Also pass $AWK, which was left out by oversight (this is relatively harmless, nobody’s building this library on any OS where plain ‘awk’ is so old it can’t handle what these scripts do with it). - .travis_script.sh: Don’t add -lprofile_rt to LDFLAGS on OSX, that library does not exist. - .travis.yml: Don’t allow failures on OSX.
Diffstat (limited to 'lib')
-rw-r--r--lib/crypt-port.h53
1 files changed, 22 insertions, 31 deletions
diff --git a/lib/crypt-port.h b/lib/crypt-port.h
index 0d91da4..bec36ac 100644
--- a/lib/crypt-port.h
+++ b/lib/crypt-port.h
@@ -157,50 +157,41 @@ _crypt_strcpy_or_abort (void *, const size_t, const void *);
#define XCRYPT_STRCPY_OR_ABORT(dst, d_size, src) \
_crypt_strcpy_or_abort (dst, d_size, src)
-/* Per-symbol version tagging. Currently we only know how to do this
- using GCC extensions. */
-
-#if defined __GNUC__ && __GNUC__ >= 3
/* Define ALIASNAME as a strong alias for NAME. */
#define strong_alias(name, aliasname) _strong_alias(name, aliasname)
-/* Darwin doesn't support alias attributes. */
-#ifdef __cplusplus
-# ifndef __APPLE__
-# define _strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __THROW __attribute__ ((alias (#name)))
-# else
-# define _strong_alias(name, aliasname) \
- __THROW __asm__(".globl _" #aliasname); \
- __THROW __asm__(".set _" #aliasname ", _" #name); \
- extern __typeof(name) aliasname __THROW
-# endif
-#else
-# ifndef __APPLE__
-# define _strong_alias(name, aliasname) \
- extern __typeof (name) aliasname __attribute__ ((alias (#name))) __THROW
-# else
-# define _strong_alias(name, aliasname) \
- __asm__(".globl _" #aliasname) __THROW; \
- __asm__(".set _" #aliasname ", _" #name) __THROW; \
- extern __typeof(name) aliasname __THROW
-# endif
-#endif
+/* Darwin (Mach-O) doesn't support alias attributes or symbol versioning.
+ It does, however, support symbol aliasing at the object file level. */
+#ifdef __APPLE__
+
+# define _strong_alias(name, aliasname) \
+ __asm__(".globl _" #aliasname); \
+ __asm__(".set _" #aliasname ", _" #name); \
+ extern __typeof(name) aliasname __THROW
+
+# define symver_set(extstr, intname, version, mode) \
+ __asm__(".globl _" extstr); \
+ __asm__(".set _" extstr ", _" #intname)
+
+#elif defined __GNUC__ && __GNUC__ >= 3
+
+# define _strong_alias(name, aliasname) \
+ extern __typeof (name) aliasname __THROW __attribute__ ((alias (#name)))
/* Set the symbol version for EXTNAME, which uses INTNAME as its
implementation. */
-#define symver_set(extstr, intname, version, mode) \
+# define symver_set(extstr, intname, version, mode) \
__asm__ (".symver " #intname "," extstr mode #version)
+#else
+# error "Don't know how to do symbol versioning with this compiler"
+#endif
+
/* A construct with the same syntactic role as the expansion of symver_set,
but which does nothing. */
#define symver_nop() __asm__ ("")
-#else
-#error "Don't know how to do symbol versioning with this compiler"
-#endif
-
/* The macros for versioned symbols work differently in this library
than they do in glibc. They are mostly auto-generated (see gen-vers.awk),
and we currently don't support compatibility symbols that need a different