Enable build flags inheritance for nonshared flags

This commit is contained in:
Florian Weimer 2018-07-05 12:45:10 +02:00
parent 8a71833984
commit 04e38e02b7
1 changed files with 26 additions and 4 deletions

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.27.9000-545-gb7b88cea41 %define glibcsrcdir glibc-2.27.9000-545-gb7b88cea41
%define glibcversion 2.27.9000 %define glibcversion 2.27.9000
%define glibcrelease 32%{?dist} %define glibcrelease 33%{?dist}
# Pre-release tarballs are pulled in from git using a command that is # Pre-release tarballs are pulled in from git using a command that is
# effectively: # effectively:
# #
@ -731,7 +731,14 @@ df
GCC=gcc GCC=gcc
GXX=g++ GXX=g++
# Propagates the listed flags to BuildFlags if supplied by redhat-rpm-config. # Part of rpm_inherit_flags. Is overridden below.
rpm_append_flag ()
{
BuildFlags="$BuildFlags $*"
}
# Propagates the listed flags to rpm_append_flag if supplied by
# redhat-rpm-config.
BuildFlags="-O2 -g" BuildFlags="-O2 -g"
rpm_inherit_flags () rpm_inherit_flags ()
{ {
@ -739,7 +746,7 @@ rpm_inherit_flags ()
local flag local flag
for flag in $RPM_OPT_FLAGS $RPM_LD_FLAGS ; do for flag in $RPM_OPT_FLAGS $RPM_LD_FLAGS ; do
if echo "$reference" | grep -q -F " $flag " ; then if echo "$reference" | grep -q -F " $flag " ; then
BuildFlags="$BuildFlags $flag" rpm_append_flag "$flag"
fi fi
done done
} }
@ -772,6 +779,18 @@ rpm_inherit_flags \
"-mtune=zEC12" \ "-mtune=zEC12" \
"-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \ "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \
# Propagate additional build flags to BuildFlagsNonshared. This is
# very special because some of these files are part of the startup
# code. We essentially hope that these flags have little effect
# there, and only specify the, for consistency, so that annobin
# records the expected compiler flags.
BuildFlagsNonshared=
rpm_append_flag () {
BuildFlagsNonshared="$BuildFlagsNonshared $*"
}
rpm_inherit_flags \
"-Wp,-D_FORTIFY_SOURCE=2" \
# Special flag to enable annobin annotations for statically linked # Special flag to enable annobin annotations for statically linked
# assembler code. Needs to be passed to make; not preserved by # assembler code. Needs to be passed to make; not preserved by
# configure. # configure.
@ -802,7 +821,7 @@ build()
../configure CC="$GCC" CXX="$GXX" CFLAGS="$BuildFlags $*" \ ../configure CC="$GCC" CXX="$GXX" CFLAGS="$BuildFlags $*" \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--with-headers=%{_prefix}/include $EnableKernel \ --with-headers=%{_prefix}/include $EnableKernel \
--with-nonshared-cflags="-D_FORTIFY_SOURCE=2" \ --with-nonshared-cflags="$BuildFlagsNonshared" \
--enable-bind-now \ --enable-bind-now \
--build=%{target} \ --build=%{target} \
--enable-stack-protector=strong \ --enable-stack-protector=strong \
@ -1886,6 +1905,9 @@ fi
%endif %endif
%changelog %changelog
* Thu Jul 5 2018 Florian Weimer <fweimer@redhat.com> - 2.27.9000-33
- Enable build flags inheritance for nonshared flags
* Wed Jul 4 2018 Florian Weimer <fweimer@redhat.com> - 2.27.9000-32 * Wed Jul 4 2018 Florian Weimer <fweimer@redhat.com> - 2.27.9000-32
- Add annobin annotations to assembler code (#1548438) - Add annobin annotations to assembler code (#1548438)