From 95a3d5d4a42225ad1cd1469ab5c7182df6fabd7c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 30 Jul 2021 13:07:12 +0200 Subject: [PATCH] Activate GCC annobin plugin during LTO linking (#1983727) Resolves: #1983727 --- macros | 3 ++- redhat-rpm-config.spec | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/macros b/macros index bb8955f..33035d5 100644 --- a/macros +++ b/macros @@ -89,7 +89,7 @@ # When clang is used as a linker driver, it does not auto-detect the LTO # bytecode and neither does bfd, so we need to explicitly pass the -flto # flag when linking. -%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ] +%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags} %{_annotation_ldflags} %[ "%{toolchain}" == "clang" ? "%{?_lto_cflags}" : "" ] # Expands to shell code to set the compiler/linker environment # variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have @@ -323,6 +323,7 @@ print(result) # The annobin plugin is not built for clang yet %_annobin_clang_plugin %dnl-fplugin=/usr/lib64/clang/`clang -dumpversion`/lib/annobin.so %_annotation_cflags %{?_annotated_build:%{expand:%%{_annobin_%{toolchain}_plugin}}} +%_annotation_ldflags %{?_lto_cflags:%{_annotation_cflags}} # Fail linking if there are undefined symbols. Required for proper # ELF symbol versioning support. Disabled by default. diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 993d520..4269146 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: 186 +Version: 187 Release: 1%{?dist} # No version specified. License: GPL+ @@ -189,6 +189,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Fri Jul 30 2021 Florian Weimer - 187-1 +- Active GCC plugin during LTO linking (#1983727) + * Thu Jul 22 2021 Florian Weimer - 186-1 - aarch64: Do not build with -mbranch-protection=standard (#1984652)