Enable binary annotations in compiler flags

This commit is contained in:
Nick Clifton 2017-10-03 15:53:23 +02:00 committed by Igor Gnatenko
parent fb76fd5200
commit b5ea4b290b
3 changed files with 21 additions and 2 deletions

9
macros
View File

@ -148,7 +148,14 @@
%_hardened_cflags %{?_hardened_build:%{_hardening_cflags}} %_hardened_cflags %{?_hardened_build:%{_hardening_cflags}}
%_hardened_ldflags %{?_hardened_build:%{_hardening_ldflags}} %_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_cflags %{optflags}
%__global_cxxflags %{optflags} %__global_cxxflags %{optflags}

2
redhat-annobin-cc1 Normal file
View File

@ -0,0 +1,2 @@
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 68 Version: 69
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -21,6 +21,9 @@ Source1: rpmrc
Source50: redhat-hardened-cc1 Source50: redhat-hardened-cc1
Source51: redhat-hardened-ld 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 # 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 # 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 # 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: rpm >= 4.11.0
Requires: dwz >= 0.4 Requires: dwz >= 0.4
Requires: zip Requires: zip
Requires: annobin
Provides: system-rpm-config = %{version}-%{release} Provides: system-rpm-config = %{version}-%{release}
%global rrcdir /usr/lib/rpm/redhat %global rrcdir /usr/lib/rpm/redhat
@ -102,6 +107,7 @@ cp -p %{sources} .
mkdir -p %{buildroot}%{rrcdir} mkdir -p %{buildroot}%{rrcdir}
install -p -m 644 -t %{buildroot}%{rrcdir} macros rpmrc 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-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} config.*
install -p -m 755 -t %{buildroot}%{rrcdir} dist.sh rpmsort symset-table kmodtool 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}/rpmrc
%{rrcdir}/dist.sh %{rrcdir}/dist.sh
%{rrcdir}/redhat-hardened-* %{rrcdir}/redhat-hardened-*
%{rrcdir}/redhat-annobin-*
%{rrcdir}/config.* %{rrcdir}/config.*
%{rrcdir}/find-provides %{rrcdir}/find-provides
%{rrcdir}/find-requires %{rrcdir}/find-requires
@ -143,6 +150,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Wed Nov 22 2017 Nick Clifton <nickc@redhat.com> - 69-1
- Enable binary annotations in compiler flags
* Thu Oct 26 2017 Troy Dawson <tdawson@redhat.com> - 68-1 * Thu Oct 26 2017 Troy Dawson <tdawson@redhat.com> - 68-1
- Remove Requires: fedora-rpm-macros - Remove Requires: fedora-rpm-macros