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 <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2019-03-13 17:12:54 +01:00
parent c46ed0d26c
commit 23dde70494
2 changed files with 23 additions and 1 deletions

View File

@ -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=

View File

@ -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 <pbonzini@redhat.com> - 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 <releng@fedoraproject.org> - 0.3.111-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild