Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -7,12 +7,10 @@ LIBS = @LIBS@ @PTHREAD_LIBS@ SHOBJFLAGS = @SHOBJFLAGS@ SHOBJLDFLAGS = @SHOBJLDFLAGS@ AR = @AR@ RANLIB = @RANLIB@ -STRIP = @STRIP@ -OBJCOPY = @OBJCOPY@ prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ @SET_MAKE@ @@ -26,16 +24,16 @@ cackey_g.o: cackey.c cackey_builtin_certs.h sha1.c sha1.h md5.c md5.h asn1-x509.c asn1-x509.h config.h $(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) -o cackey_g.o -c cackey.c libcackey.@SHOBJEXT@: cackey.o $(CC) $(SHOBJFLAGS) $(CPPFLAGS) $(CFLAGS) $(SHOBJLDFLAGS) $(LDFLAGS) -o libcackey.@SHOBJEXT@ cackey.o $(LIBS) - -$(OBJCOPY) --wildcard --keep-global-symbol 'C_*' libcackey.@SHOBJEXT@ - -$(STRIP) -x "libcackey.@SHOBJEXT@" + -@WEAKENSYMS@ "libcackey.@SHOBJEXT@" + -@REMOVESYMS@ "libcackey.@SHOBJEXT@" libcackey_g.@SHOBJEXT@: cackey_g.o $(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) $(SHOBJLDFLAGS) $(LDFLAGS) -o libcackey_g.@SHOBJEXT@ cackey_g.o $(LIBS) - -$(OBJCOPY) --wildcard --keep-global-symbol 'C_*' libcackey.@SHOBJEXT@ + -@WEAKENSYMS@ "libcackey_g.@SHOBJEXT@" test: test.c libcackey_g.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test test.c -Wl,-R,. libcackey_g.@SHOBJEXT@ splint-cackey.txt: cackey.c cackey_builtin_certs.h asn1-x509.c asn1-x509.h config.h Index: aclocal/dc_versionscript.m4 ================================================================== --- aclocal/dc_versionscript.m4 +++ aclocal/dc_versionscript.m4 @@ -20,5 +20,37 @@ else LDFLAGS="${SAVE_LDFLAGS}" AC_MSG_RESULT([don't know]) fi ]) + +AC_DEFUN(DC_FIND_STRIP_AND_REMOVESYMS, [ + SYMFILE="$1" + + dnl Determine how to strip executables + AC_CHECK_TOOL(OBJCOPY, objcopy, [false]) + AC_CHECK_TOOL(STRIP, strip, [false]) + + if test "x${STRIP}" = "xfalse"; then + STRIP="${OBJCOPY}" + fi + + WEAKENSYMS='true' + REMOVESYMS='true' + + case $host_os in + darwin*) + REMOVESYMS="${STRIP} -s ${SYMFILE}" + ;; + *) + if test "x${OBJCOPY}" != "xfalse"; then + WEAKENSYMS="${OBJCOPY} --keep-global-symbols=${SYMFILE}" + REMOVESYMS="${OBJCOPY} --discard-all" + elif test "x${STRIP}" != "xfalse"; then + REMOVESYMS="${STRIP} -x" + fi + ;; + esac + + AC_SUBST(WEAKENSYMS) + AC_SUBST(REMOVESYMS) +]) Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,6 +1,6 @@ -AC_INIT(cackey, 0.6.3) +AC_INIT(cackey, 0.6.4) AC_CONFIG_HEADERS(config.h) dnl Locate standard tools AC_PROG_CC AC_PROG_MAKE_SET @@ -20,13 +20,12 @@ dnl Determine how to create static archives on this platform AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(RANLIB, ranlib) -dnl Determine how to strip executables -AC_CHECK_TOOL(OBJCOPY, objcopy) -AC_CHECK_TOOL(STRIP, strip, [$OBJCOPY]) +dnl Determine how to strip executables and remove symbols +DC_FIND_STRIP_AND_REMOVESYMS(libcackey.syms) dnl Check for all required headers AC_CHECK_HEADERS(arpa/inet.h inttypes.h stdarg.h stdint.h stdio.h stdlib.h string.h sys/socket.h sys/types.h sys/un.h time.h unistd.h pthread.h zlib.h limits.h,,[ AC_WARN([Required header missing, compilation will likely fail.]) ], [ ADDED libcackey.syms Index: libcackey.syms ================================================================== --- /dev/null +++ libcackey.syms @@ -0,0 +1,68 @@ +C_CancelFunction +C_CloseAllSessions +C_CloseSession +C_CopyObject +C_CreateObject +C_Decrypt +C_DecryptDigestUpdate +C_DecryptFinal +C_DecryptInit +C_DecryptUpdate +C_DecryptVerifyUpdate +C_DeriveKey +C_DestroyObject +C_Digest +C_DigestEncryptUpdate +C_DigestFinal +C_DigestInit +C_DigestKey +C_DigestUpdate +C_Encrypt +C_EncryptFinal +C_EncryptInit +C_EncryptUpdate +C_Finalize +C_FindObjects +C_FindObjectsFinal +C_FindObjectsInit +C_GenerateKey +C_GenerateKeyPair +C_GenerateRandom +C_GetAttributeValue +C_GetFunctionList +C_GetFunctionStatus +C_GetInfo +C_GetMechanismInfo +C_GetMechanismList +C_GetObjectSize +C_GetOperationState +C_GetSessionInfo +C_GetSlotInfo +C_GetSlotList +C_GetTokenInfo +C_InitPIN +C_InitToken +C_Initialize +C_Login +C_Logout +C_OpenSession +C_SeedRandom +C_SetAttributeValue +C_SetOperationState +C_SetPIN +C_Sign +C_SignEncryptUpdate +C_SignFinal +C_SignInit +C_SignRecover +C_SignRecoverInit +C_SignUpdate +C_UnwrapKey +C_Verify +C_VerifyFinal +C_VerifyInit +C_VerifyRecover +C_VerifyRecoverInit +C_VerifyUpdate +C_WaitForSlotEvent +C_WrapKey