diff --git a/brp-strip-lto b/brp-strip-lto new file mode 100755 index 0000000..509f9f7 --- /dev/null +++ b/brp-strip-lto @@ -0,0 +1,18 @@ +#!/usr/bin/sh +# If using normal root, avoid changing anything. +if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_BUILD_ROOT" = "/" ]; then + exit 0 +fi + +STRIP=${1:-strip} + +case `uname -a` in +Darwin*) exit 0 ;; +*) ;; +esac + +# Strip ELF binaries +for f in `find "$RPM_BUILD_ROOT" -type f -name \*.[ao] -print | \ + grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug"`; do + $STRIP -p -R .gnu.lto_* -R .gnu.debuglto_* -N __gnu_lto_v1 "$f" || : +done diff --git a/macros b/macros index 2d8e6dd..ee0d81b 100644 --- a/macros +++ b/macros @@ -146,6 +146,7 @@ print(result) %__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig %__brp_compress /usr/lib/rpm/brp-compress %__brp_strip /usr/lib/rpm/brp-strip %{__strip} +%__brp_strip_lto /usr/lib/rpm/redhat/brp-strip-lto %{__strip} %__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} %__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip} %__brp_python_bytecompile /usr/lib/rpm/redhat/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}" @@ -163,6 +164,7 @@ print(result) %{?__brp_strip} \ %{?__brp_strip_comment_note} \ } \ + %{?__brp_strip_lto} \ %{?__brp_strip_static_archive} \ %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \ %{?__brp_python_hardlink} \ diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 876fd01..637da40 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 149 +Version: 150 Release: 1%{?dist} # No version specified. License: GPL+ @@ -78,6 +78,7 @@ Source602: libsymlink.attr # BRPs Source700: brp-ldconfig +Source701: brp-strip-lto # Convenience lua functions Source800: common.lua @@ -207,6 +208,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Fri Feb 14 2019 Jeff Law - 150-1 +- Strip LTO sections/symbols from installed .o/.a files + * Thu Jan 23 2020 Jeff Law - 149-1 - Allow conditionally adding -fcommon to CFLAGS by defining %%_legacy_common_support