From e7871dc7450c9b6560137cd3780e21b0263c0515 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 4 Jul 2018 16:55:34 +0200 Subject: [PATCH] Add annobin annotations to assembler code (downstream only) (#1548438) --- glibc-asflags.patch | 25 +++++++++++++++++++++++++ glibc.spec | 23 +++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 glibc-asflags.patch diff --git a/glibc-asflags.patch b/glibc-asflags.patch new file mode 100644 index 0000000..9bd733f --- /dev/null +++ b/glibc-asflags.patch @@ -0,0 +1,25 @@ +Author: Florian Weimer +Date: Wed Jul 4 16:16:57 2018 +0200 + + Makeconfig (ASFLAGS): Always append required assembler flags. + +Submitted upstream here: + + https://sourceware.org/ml/libc-alpha/2018-07/msg00077.html + +Otherwise, we lose essential flags such as -Wa,--noexecstack due to +the way += works in make due to the ASFLAGS command line override. + +diff --git a/Makeconfig b/Makeconfig +index b0b27f0113ac18b8..92e76d6200bbcd5b 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -1047,7 +1047,7 @@ endif + ifndef ASFLAGS + ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) + endif +-ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) ++override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) + + ifndef BUILD_CC + BUILD_CC = $(CC) diff --git a/glibc.spec b/glibc.spec index 57f8cee..ef16681 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.27-71-g5fab7fe1dc %define glibcversion 2.27 -%define glibcrelease 23%{?dist} +%define glibcrelease 24%{?dist} # Pre-release tarballs are pulled in from git using a command that is # effectively: # @@ -262,6 +262,7 @@ Patch2057: glibc-collation-cldr-15.patch Patch2058: glibc-python3.patch Patch2059: glibc-rh1592270.patch Patch2060: glibc-with-nonshared-cflags.patch +Patch2061: glibc-asflags.patch ############################################################################## # End of glibc patches. @@ -340,8 +341,13 @@ BuildRequires: make >= 4.0 # The intl subsystem generates a parser using bison. BuildRequires: bison >= 2.7 +%if 0%{?rhel} > 0 +# binutils 2.30-17 is needed for --generate-missing-build-notes. +BuildRequires: binutils >= 2.30-17 +%else # binutils 2.29 is needed for static PIE support in i386/x86_64. BuildRequires: binutils >= 2.29 +%endif # Earlier releases have broken support for IRELATIVE relocations Conflicts: prelink < 0.4.2 @@ -811,6 +817,7 @@ microbenchmark tests on the system. %patch2058 -p1 %patch2059 -p1 %patch2060 -p1 +%patch2061 -p1 ############################################################################## # %%prep - Additional prep required... @@ -897,6 +904,15 @@ rpm_inherit_flags \ "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" \ %endif +# Special flag to enable annobin annotations for statically linked +# assembler code. Needs to be passed to make; not preserved by +# configure. +%if 0%{?rhel} > 0 +%define glibc_make_flags ASFLAGS="-g -Wa,--generate-missing-build-notes=yes" +%else +%define glibc_make_flags %{nil} +%endif + ############################################################################## # %%build - Generic options. ############################################################################## @@ -945,7 +961,7 @@ build() --disable-crypt || { cat config.log; false; } - make %{?_smp_mflags} -O -r + make %{?_smp_mflags} -O -r %{glibc_make_flags} popd } @@ -2007,6 +2023,9 @@ fi %endif %changelog +* Wed Jul 4 2018 Florian Weimer - 2.27-24 +- Add annobin annotations to assembler code (downstream only) (#1548438) + * Wed Jul 4 2018 Florian Weimer - 2.27-23 - Enable -D_FORTIFY_SOURCE=2 for nonshared code