implement compatibility shim for __warn_references

This will allow us to warn about deprecated function references at link-time.
This commit is contained in:
Brent Cook 2015-07-17 16:54:23 -05:00
parent fafc3e47f2
commit a1a0f2c6e2
3 changed files with 44 additions and 0 deletions

View File

@ -88,6 +88,18 @@ case $host_cpu in
;;
esac
AC_MSG_CHECKING([if .gnu.warning accepts long strings])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
extern void SSLv3_method();
__asm__(".section .gnu.warning.SSLv3_method; .ascii \"SSLv3_method is insecure\" ; .text");
int main() {return 0;}
]])], [
AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
])
AC_ARG_ENABLE([asm],
AS_HELP_STRING([--disable-asm], [Disable assembly]))
AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"])

View File

@ -21,6 +21,7 @@ noinst_HEADERS += machine/endian.h
noinst_HEADERS += netinet/in.h
noinst_HEADERS += netinet/tcp.h
noinst_HEADERS += sys/cdefs.h
noinst_HEADERS += sys/ioctl.h
noinst_HEADERS += sys/mman.h
noinst_HEADERS += sys/select.h

31
include/sys/cdefs.h Normal file
View File

@ -0,0 +1,31 @@
/*
* Public domain
* sys/cdefs.h compatibility shim
*/
#ifndef LIBCRYPTOCOMPAT_SYS_CDEFS_H
#define LIBCRYPTOCOMPAT_SYS_CDEFS_H
#ifdef _WIN32
#define __warn_references(sym,msg)
#else
#include_next <sys/cdefs.h>
#ifndef __warn_references
#if defined(__GNUC__) && defined (HAS_GNU_WARNING_LONG)
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." __STRING(sym) \
" ; .ascii \"" msg "\" ; .text");
#else
#define __warn_references(sym,msg)
#endif
#endif /* __warn_references */
#endif /* _WIN32 */
#endif /* LIBCRYPTOCOMPAT_SYS_CDEFS_H */