From 3081c4e7d573893caa1f2813e0a658d0a53d1991 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Nov 30 2016 11:41:57 +0000 Subject: Introduce macros for language specific compiler options Introduce new language specific __global_fooflags for C, C++ and Fortran This looks mildly strange and suspicious since because the global flags get pulled in indirectly via %optflags (that doesn't change here but becomes more obvious). Depends on previous commit (8fe5b078719c7f29c7bf7a681c7ec8445f5f7817) which was done separately to make the actual change (or lack of thereof) stand out here. This is not supposed to change any actual values for current usages, so if it does it's a bug. However there's a minor bonus involved for Fortran users who can now get the correct FFLAGS/FCFLAGS for non-autoconf projects too by using __global_fflags/fcflags --- diff --git a/macros b/macros index 9532fa2..fbe3186 100644 --- a/macros +++ b/macros @@ -32,10 +32,10 @@ # way to turn it back off. # %_configure_disable_silent_rules 1 %configure \ - CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ - CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ - FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \ - FCFLAGS="${FCFLAGS:-%optflags -I%_fmoddir}" ; export FCFLAGS ; \ + CFLAGS="${CFLAGS:-%__global_cflags}" ; export CFLAGS ; \ + CXXFLAGS="${CXXFLAGS:-%__global_cxxflags}" ; export CXXFLAGS ; \ + FFLAGS="${FFLAGS:-%__global_fflags}" ; export FFLAGS ; \ + FCFLAGS="${FCFLAGS:-%__global_fcflags}" ; export FCFLAGS ; \ LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS; \ [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \ [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \ @@ -146,6 +146,11 @@ %_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} + +%__global_cflags %{optflags} +%__global_cxxflags %{optflags} +%__global_fflags %{optflags} -I%_fmoddir +%__global_fcflags %{optflags} -I%_fmoddir %__global_ldflags -Wl,-z,relro %{_hardened_ldflags} #============================================================================== diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index b06df87..6c220a0 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: 58 +Version: 59 Release: 1%{?dist} # No version specified. License: GPL+ @@ -140,6 +140,10 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Wed Nov 30 2016 Panu Matilainen - 59-1 +- Move global compiler flags to __global_compiler_flags macro +- Introduce separate __global_fooflags for C, C++ and Fortran + * Tue Nov 29 2016 Panu Matilainen - 58-1 - Drop atom optimization on i686 (#1393492)