]> mj.ucw.cz Git - pciutils.git/commitdiff
Fix versioned symbol aliases when used with link-time optimization
authorMartin Mares <mj@ucw.cz>
Wed, 28 Dec 2022 12:48:47 +0000 (13:48 +0100)
committerMartin Mares <mj@ucw.cz>
Wed, 28 Dec 2022 12:48:47 +0000 (13:48 +0100)
lib/internal.h

index ed0e94f4b7efcc4c730f98fc6f0e90e55a7e9abe..e9e413e3f73c4267f2ac8e155f6545137cd4f04c 100644 (file)
 // optimizations is happy to optimize them away, leading to linker failures.
 #define VERSIONED_ABI __attribute__((used)) PCI_ABI
 #ifdef __APPLE__
-#define STATIC_ALIAS(_decl, _for) _decl PCI_ABI { return _for; }
+#define STATIC_ALIAS(_decl, _for) _decl VERSIONED_ABI { return _for; }
 #define DEFINE_ALIAS(_decl, _for)
 #define SYMBOL_VERSION(_int, _ext)
 #else
 #define STATIC_ALIAS(_decl, _for)
-#define DEFINE_ALIAS(_decl, _for) extern _decl __attribute__((alias(#_for)))
+#define DEFINE_ALIAS(_decl, _for) extern _decl __attribute__((alias(#_for))) VERSIONED_ABI
 #ifdef _WIN32
 /* GCC does not support asm .symver directive for Windows targets, so define new external global function symbol as alias to internal symbol */
 #define SYMBOL_VERSION(_int, _ext) asm(".globl\t" PCI_STRINGIFY(__MINGW_USYMBOL(_ext)) "\n\t" \