fix gcc optimizing-out versioned symbols when -flto is used (gccbz#48200)

This commit is contained in:
Michal Hlavinka 2022-12-16 19:43:34 +01:00
parent 9e1a0bb90c
commit 51671a20b3
2 changed files with 19 additions and 2 deletions

View File

@ -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" \

View File

@ -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 <mhlavink@redhat.com> - 3.9.0-2
- fix gcc optimizing-out versioned symbols when -flto is used (gccbz#48200)
* Tue Nov 29 2022 Michal Hlavinka <mhlavink@redhat.com> - 3.9.0-1
- updated to 3.9.0