From b5ea4b290b4eace5568bb1a9a3fe178faae1c2d1 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 3 Oct 2017 15:53:23 +0200 Subject: [PATCH] Enable binary annotations in compiler flags --- macros | 9 ++++++++- redhat-annobin-cc1 | 2 ++ redhat-rpm-config.spec | 12 +++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 redhat-annobin-cc1 diff --git a/macros b/macros index b2eeff0..b84899f 100644 --- a/macros +++ b/macros @@ -148,7 +148,14 @@ %_hardened_cflags %{?_hardened_build:%{_hardening_cflags}} %_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}} -%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags} +%_annobin_cflags -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 + +# Add extra information to binary objects created by gcc for Fedora 28: +# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30) +%_annotated_build 1 +%_annotated_cflags %{?_annotated_build:%{_annobin_cflags}} + +%__global_compiler_flags -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags} %{_annotated_cflags} %__global_cflags %{optflags} %__global_cxxflags %{optflags} diff --git a/redhat-annobin-cc1 b/redhat-annobin-cc1 new file mode 100644 index 0000000..edb8245 --- /dev/null +++ b/redhat-annobin-cc1 @@ -0,0 +1,2 @@ +*cc1_options: ++ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin} diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 3fd0e97..d78173d 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: 68 +Version: 69 Release: 1%{?dist} # No version specified. License: GPL+ @@ -21,6 +21,9 @@ Source1: rpmrc Source50: redhat-hardened-cc1 Source51: redhat-hardened-ld +# gcc specs files for annobin builds +Source52: redhat-annobin-cc1 + # The macros defined by these files are for things that need to be defined # at srpm creation time when it is not feasible to require the base packages # that would otherwise be providing the macros. other language/arch specific @@ -78,6 +81,8 @@ Requires: qt5-srpm-macros Requires: rpm >= 4.11.0 Requires: dwz >= 0.4 Requires: zip +Requires: annobin + Provides: system-rpm-config = %{version}-%{release} %global rrcdir /usr/lib/rpm/redhat @@ -102,6 +107,7 @@ cp -p %{sources} . mkdir -p %{buildroot}%{rrcdir} install -p -m 644 -t %{buildroot}%{rrcdir} macros rpmrc install -p -m 444 -t %{buildroot}%{rrcdir} redhat-hardened-* +install -p -m 444 -t %{buildroot}%{rrcdir} redhat-annobin-* install -p -m 755 -t %{buildroot}%{rrcdir} config.* install -p -m 755 -t %{buildroot}%{rrcdir} dist.sh rpmsort symset-table kmodtool @@ -122,6 +128,7 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{rrcdir}/rpmrc %{rrcdir}/dist.sh %{rrcdir}/redhat-hardened-* +%{rrcdir}/redhat-annobin-* %{rrcdir}/config.* %{rrcdir}/find-provides %{rrcdir}/find-requires @@ -143,6 +150,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Wed Nov 22 2017 Nick Clifton - 69-1 +- Enable binary annotations in compiler flags + * Thu Oct 26 2017 Troy Dawson - 68-1 - Remove Requires: fedora-rpm-macros