summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2014-11-01 17:28:28 +0100
committerMartin Mares <mj@ucw.cz>2014-11-01 17:28:28 +0100
commit6e4adbf543f889d9bcdb296a86a7333ef4b6507b (patch)
tree327deb863f1f82397d8fb6a462eff333dad208e8
parente84876c68e14e882551d3b7eaf60a0f0438c0f67 (diff)
downloadpciutils-6e4adbf543f889d9bcdb296a86a7333ef4b6507b.tar.gz
Work around problems with symbol versioning in globally optimizing GCC
-rw-r--r--lib/access.c2
-rw-r--r--lib/internal.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/access.c b/lib/access.c
index c23a2fd..61b3530 100644
--- a/lib/access.c
+++ b/lib/access.c
@@ -153,7 +153,7 @@ pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
return d->methods->write(d, pos, buf, len);
}
-int
+int VERSIONED
pci_fill_info_v32(struct pci_dev *d, int flags)
{
if (flags & PCI_FILL_RESCAN)
diff --git a/lib/internal.h b/lib/internal.h
index 2c6d3ef..18a59e2 100644
--- a/lib/internal.h
+++ b/lib/internal.h
@@ -10,6 +10,10 @@
#ifdef PCI_SHARED_LIB
#define PCI_ABI __attribute__((visibility("default")))
+// Functions, which are bound to externally visible symbols by the versioning
+// mechanism, have to be declared as VERSIONED. Otherwise, GCC with global
+// optimizations is happy to optimize them away, leading to linker failures.
+#define VERSIONED __attribute__((used))
#ifdef __APPLE__
#define STATIC_ALIAS(_decl, _for) _decl PCI_ABI { return _for; }
#define DEFINE_ALIAS(_decl, _for) extern _decl __attribute__((alias(#_for)))
@@ -20,6 +24,7 @@
#define SYMBOL_VERSION(_int, _ext)
#endif
#else
+#define VERSIONED
#define STATIC_ALIAS(_decl, _for) _decl { return _for; }
#define DEFINE_ALIAS(_decl, _for)
#define SYMBOL_VERSION(_int, _ext)