From 51671a20b3a7d70f275053bc5f662eeef663b4f2 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Fri, 16 Dec 2022 19:43:34 +0100 Subject: [PATCH] fix gcc optimizing-out versioned symbols when -flto is used (gccbz#48200) --- pciutils-3.9.0-extvisible.patch | 12 ++++++++++++ pciutils.spec | 9 +++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 pciutils-3.9.0-extvisible.patch diff --git a/pciutils-3.9.0-extvisible.patch b/pciutils-3.9.0-extvisible.patch new file mode 100644 index 0000000..9b03c23 --- /dev/null +++ b/pciutils-3.9.0-extvisible.patch @@ -0,0 +1,12 @@ +diff -up pciutils-3.9.0/lib/internal.h.extvisible pciutils-3.9.0/lib/internal.h +--- pciutils-3.9.0/lib/internal.h.extvisible 2022-12-16 19:15:16.914850590 +0100 ++++ pciutils-3.9.0/lib/internal.h 2022-12-16 19:15:38.248989198 +0100 +@@ -20,7 +20,7 @@ + #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),visibility("default"),externally_visible)) + #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" \ diff --git a/pciutils.spec b/pciutils.spec index af0da68..71092fd 100644 --- a/pciutils.spec +++ b/pciutils.spec @@ -1,6 +1,6 @@ Name: pciutils Version: 3.9.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: PCI bus related utilities License: GPLv2+ URL: https://mj.ucw.cz/sw/pciutils/ @@ -14,6 +14,9 @@ Patch1: pciutils-2.2.1-idpath.patch #add support for directory with another pci.ids, rejected by upstream, rhbz#195327 Patch2: pciutils-dir-d.patch +#gcc optimizes-out some symbols when -flto is used ttps://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200 +Patch3: pciutils-3.9.0-extvisible.patch + Requires: hwdata Requires: %{name}-libs = %{version}-%{release} BuildRequires: gcc make sed kmod-devel @@ -57,7 +60,6 @@ make clean %make_build SHARED="yes" ZLIB="no" LIBKMOD=yes STRIP="" OPT="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" PREFIX="/usr" LIBDIR="%{_libdir}" IDSDIR="/usr/share/hwdata" PCI_IDS="pci.ids" - %install install -d $RPM_BUILD_ROOT{%{_sbindir},%{_mandir}/man{7,8},%{_libdir},%{_libdir}/pkgconfig,%{_includedir}/pci} @@ -99,6 +101,9 @@ install -p -m 644 lib/libpci.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig %{_mandir}/man7/* %changelog +* Thu Dec 15 2022 Michal Hlavinka - 3.9.0-2 +- fix gcc optimizing-out versioned symbols when -flto is used (gccbz#48200) + * Tue Nov 29 2022 Michal Hlavinka - 3.9.0-1 - updated to 3.9.0