build with hardening LDFLAGS (#1548717)

This commit is contained in:
Miroslav Lichvar 2018-02-26 15:52:47 +01:00
parent cd693d0af1
commit 286db42fb4
2 changed files with 2 additions and 23 deletions

View File

@ -1,18 +0,0 @@
diff -up libutempter-1.1.6/Makefile.pierelro libutempter-1.1.6/Makefile
--- libutempter-1.1.6/Makefile.pierelro 2010-11-04 18:14:53.000000000 +0100
+++ libutempter-1.1.6/Makefile 2013-01-24 15:58:06.241865564 +0100
@@ -52,11 +52,12 @@ all: $(TARGETS)
$(COMPILE.c) -fPIC $< $(OUTPUT_OPTION)
$(PROJECT): utempter.c
- $(LINK.c) -Wl,-z,now,-stats $(LDLIBS) $< $(OUTPUT_OPTION)
+ $(LINK.c) -pie -fPIE -Wl,-z,relro,-z,now,-stats $(LDLIBS) \
+ $< $(OUTPUT_OPTION)
$(SHAREDLIB): iface.os $(MAP)
$(LINK.o) -shared \
- -Wl,-soname,$(SONAME),--version-script=$(MAP),-z,defs,-stats \
+ -Wl,-soname,$(SONAME),--version-script=$(MAP),-z,relro,-z,defs,-stats \
-lc $< $(OUTPUT_OPTION)
$(STATICLIB): iface.o

View File

@ -10,9 +10,6 @@ URL: ftp://ftp.altlinux.org/pub/people/ldv/utempter
Source0: ftp://ftp.altlinux.org/pub/people/ldv/utempter/%{name}-%{version}.tar.bz2
# Compile with PIE and RELRO flags.
Patch0: libutempter-pierelro.patch
Requires(pre): shadow-utils
Provides: utempter = %{utempter_compat_ver}
@ -32,10 +29,10 @@ utempter-based software.
%prep
%setup -q
%patch0 -p1 -b .pierelro
%build
make CFLAGS="$RPM_OPT_FLAGS" libdir="%{_libdir}" libexecdir="%{_libexecdir}"
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" \
libdir="%{_libdir}" libexecdir="%{_libexecdir}"
%install
make install DESTDIR="$RPM_BUILD_ROOT" libdir="%{_libdir}" libexecdir="%{_libexecdir}"