From 23dde70494f42f8194b10a5959216c54cda2c314 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Mar 2019 17:12:54 +0100 Subject: [PATCH] pass in distro-provided build flags This resolves the following annocheck warnings: Hardened: ./usr/lib64/libaio.so.1.0.0: FAIL: Not linked with -Wl,-z,now. Hardened: ./usr/lib64/libaio.so.1.0.0: FAIL: GNU Property note is missing. We also get rid of the "-nostartfiles -nostdlib" CFLAGS. nostartfiles just doesn't seem necessary (though I don't think it actually does any harm). -nostdlib is actually problematic for a couple of cases: 1) now that we're using gcc's stack protector hardening, we need to link with libgcc. We're also using the glibc system call wrappers, so we are using libc! 2) It was reported that some architectures require libgcc when compiled with -Os, for example. - Resolves: rhbz#1630578 [Patch originally by Jeff Moyer] Signed-off-by: Paolo Bonzini --- ...ove-nostartfiles-nostdlib-from-build-flags.patch | 13 +++++++++++++ libaio.spec | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 libaio-remove-nostartfiles-nostdlib-from-build-flags.patch diff --git a/libaio-remove-nostartfiles-nostdlib-from-build-flags.patch b/libaio-remove-nostartfiles-nostdlib-from-build-flags.patch new file mode 100644 index 0000000..2f79681 --- /dev/null +++ b/libaio-remove-nostartfiles-nostdlib-from-build-flags.patch @@ -0,0 +1,13 @@ +diff --git a/src/Makefile b/src/Makefile +index eadb336..5911c81 100644 +--- libaio-0.3.111/src/Makefile ++++ libaio-0.3.111/src/Makefile +@@ -3,7 +3,7 @@ includedir=$(prefix)/include + libdir=$(prefix)/lib + + CFLAGS ?= -g -fomit-frame-pointer -O2 +-CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC ++CFLAGS += -Wall -I. -fPIC + SO_CFLAGS=-shared $(CFLAGS) + L_CFLAGS=$(CFLAGS) + LINK_FLAGS= diff --git a/libaio.spec b/libaio.spec index 72fcfe0..391c87c 100644 --- a/libaio.spec +++ b/libaio.spec @@ -1,11 +1,12 @@ Name: libaio Version: 0.3.111 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Linux-native asynchronous I/O access library License: LGPLv2+ Source: http://releases.pagure.org/libaio/libaio-0.3.111.tar.gz Patch1: libaio-install-to-destdir-slash-usr.patch +Patch2: libaio-remove-nostartfiles-nostdlib-from-build-flags.patch BuildRequires: gcc @@ -32,6 +33,8 @@ for the Linux-native asynchronous I/O facility ("async I/O", or "aio"). %setup -q -a 0 %patch1 -p0 -b .install-to-destdir-slash-usr %patch1 -p1 -b .install-to-destdir-slash-usr +%patch2 -p0 -b .nostdlib +%patch2 -p1 -b .nostdlib mv %{name}-%{version} compat-%{name}-%{version} %build @@ -39,6 +42,7 @@ mv %{name}-%{version} compat-%{name}-%{version} # build process builds a version of the library with the broken soname in # the compat-libaio-0.3.103 directory, and then builds the library again # with the correct soname. +%set_build_flags cd compat-%{name}-%{version} make soname='libaio.so.1.0.0' libname='libaio.so.1.0.0' cd .. @@ -65,6 +69,11 @@ find %{buildroot} -name '*.a' -delete %attr(0755,root,root) %{usrlibdir}/libaio.so %changelog +* Wed Mar 13 2019 Paolo Bonzini - 0.3.111-5 +- Pass in the distro-provided CFLAGS and LFLAGS. (Jeff Moyer) +- Get rid of -nostartfiles -nostdlib (Jeff Moyer) +- Resolves: rhbz#1630578 + * Fri Feb 01 2019 Fedora Release Engineering - 0.3.111-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild