From c10abe6fe6583d57326400a98791da44d542166d Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Wed, 5 Feb 2020 10:58:04 -0500 Subject: OSX build fixes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- lib/crypt-port.h | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3