Inherit further build flags (downstream only)

This commit is contained in:
Florian Weimer 2018-07-06 16:28:44 +02:00
parent e7871dc745
commit cf31c32499

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.27-71-g5fab7fe1dc %define glibcsrcdir glibc-2.27-71-g5fab7fe1dc
%define glibcversion 2.27 %define glibcversion 2.27
%define glibcrelease 24%{?dist} %define glibcrelease 26%{?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:
# #
@ -862,7 +862,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 ()
{ {
@ -870,7 +877,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
} }
@ -890,6 +897,8 @@ rpm_inherit_flags \
"-m64" \ "-m64" \
"-mstackrealign" \ "-mstackrealign" \
%if 0%{?rhel} > 0 %if 0%{?rhel} > 0
"-Wp,-D_GLIBCXX_ASSERTIONS" \
"-fcf-protection" \
"-march=i686" \ "-march=i686" \
"-march=x86-64" \ "-march=x86-64" \
"-march=z13" \ "-march=z13" \
@ -904,6 +913,18 @@ rpm_inherit_flags \
"-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \ "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \
%endif %endif
# 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.
@ -938,7 +959,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 \
@ -2023,6 +2044,12 @@ fi
%endif %endif
%changelog %changelog
* Fri Jul 6 2018 Florian Weimer <fweimer@redhat.com> - 2.27-26
- Enable build flags inheritance for nonshared flags
* Fri Jul 6 2018 Florian Weimer <fweimer@redhat.com> - 2.27-25
- Inherit further build flags (downstream only)
* Wed Jul 4 2018 Florian Weimer <fweimer@redhat.com> - 2.27-24 * Wed Jul 4 2018 Florian Weimer <fweimer@redhat.com> - 2.27-24
- Add annobin annotations to assembler code (downstream only) (#1548438) - Add annobin annotations to assembler code (downstream only) (#1548438)