]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - include/shlib-compat.h
Further harden glibc malloc metadata against 1-byte overflows.
[thirdparty/glibc.git] / include / shlib-compat.h
index 955c6aeea219b31c1bab842982938e152236756a..41eb362f1dee1d7daae41d81790c6b215cb6d26b 100644 (file)
@@ -1,5 +1,5 @@
 /* Macros for managing ABI-compatibility definitions using ELF symbol versions.
-   Copyright (C) 2000-2013 Free Software Foundation, Inc.
+   Copyright (C) 2000-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #ifndef _SHLIB_COMPAT_H
 #define _SHLIB_COMPAT_H        1
 
-#ifdef SHARED
-
 # include <abi-versions.h>
 
+#ifdef SHARED
+
 /* The file abi-versions.h (generated by scripts/abi-versions.awk) defines
    symbols like `ABI_libm_GLIBC_2_0' for each version set in the source
    code for each library.  For a version set that is subsumed by a later
 # define SHLIB_COMPAT(lib, introduced, obsoleted)                            \
   _SHLIB_COMPAT (lib, introduced, obsoleted)
 # define _SHLIB_COMPAT(lib, introduced, obsoleted)                           \
-  ((IS_IN_##lib - 0)                                                         \
+  (IS_IN (lib)                                                               \
    && (!(ABI_##lib##_##obsoleted - 0)                                        \
        || ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0))))
 
-# ifndef NOT_IN_libc
-#  define IS_IN_libc 1
-# endif
-
 /* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to
    the version set name to use for e.g. symbols first introduced into
    libm in the GLIBC_2.1 version.  Definitions of symbols with explicit
   default_symbol_version (local, symbol, name)
 
 # define compat_symbol(lib, local, symbol, version) \
-  compat_symbol_1 (lib, local, symbol, version)
-# define compat_symbol_1(lib, local, symbol, version) \
-  compat_symbol_2 (local, symbol, VERSION_##lib##_##version)
-# define compat_symbol_2(local, symbol, name) \
-  symbol_version (local, symbol, name)
+  compat_symbol_reference (lib, local, symbol, version)
 
 #else
 
 
 #endif
 
+/* Use compat_symbol_reference for a reference to a specific version
+   of a symbol.  Use compat_symbol to define such a symbol.  */
+#define compat_symbol_reference(lib, local, symbol, version) \
+  compat_symbol_reference_1 (lib, local, symbol, version)
+#define compat_symbol_reference_1(lib, local, symbol, version) \
+  compat_symbol_reference_2 (local, symbol, VERSION_##lib##_##version)
+#define compat_symbol_reference_2(local, symbol, name) \
+  symbol_version_reference (local, symbol, name)
 
 # ifdef LINK_OBSOLETE_RPC
 /* Export the symbol for both static and dynamic linking.  */