From a1a0f2c6e2c3029020d0f6d0a4277483af05822e Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 17 Jul 2015 16:54:23 -0500 Subject: [PATCH] implement compatibility shim for __warn_references This will allow us to warn about deprecated function references at link-time. --- configure.ac | 12 ++++++++++++ include/Makefile.am | 1 + include/sys/cdefs.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 include/sys/cdefs.h diff --git a/configure.ac b/configure.ac index 43ef0cd..91ae7ce 100644 --- a/configure.ac +++ b/configure.ac @@ -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"]) diff --git a/include/Makefile.am b/include/Makefile.am index b620938..92ee9e7 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -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 diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h new file mode 100644 index 0000000..21ef031 --- /dev/null +++ b/include/sys/cdefs.h @@ -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 + +#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 */