From: guenther Date: Sat, 30 Jul 2016 03:25:48 +0000 (+0000) Subject: Prep for relro: make sure it's off for any non-PIE stand/ program X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5a5a41c04edae8f143ac17094935c58645592cfa;p=openbsd Prep for relro: make sure it's off for any non-PIE stand/ program ok millert@ kettenis@ --- diff --git a/sys/arch/alpha/stand/boot/Makefile b/sys/arch/alpha/stand/boot/Makefile index 5ba99b7ba28..2dd645160e6 100644 --- a/sys/arch/alpha/stand/boot/Makefile +++ b/sys/arch/alpha/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2015/10/22 18:54:41 miod Exp $ +# $OpenBSD: Makefile,v 1.21 2016/07/30 03:25:48 guenther Exp $ # $NetBSD: Makefile,v 1.17 1997/04/17 07:27:46 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -60,6 +60,6 @@ LIBSA= ${SALIB} ${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${COMPILE.c} vers.c - ${LD} -nopie -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym \ - ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBSA} + ${LD} -nopie -znorelro -Ttext ${BOOT_RELOC} -N -e start \ + -o ${PROG}.sym ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBSA} size ${PROG}.sym diff --git a/sys/arch/alpha/stand/bootxx/Makefile b/sys/arch/alpha/stand/bootxx/Makefile index b57041cd64e..b3118c1ffbf 100644 --- a/sys/arch/alpha/stand/bootxx/Makefile +++ b/sys/arch/alpha/stand/bootxx/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2015/10/22 18:54:41 miod Exp $ +# $OpenBSD: Makefile,v 1.16 2016/07/30 03:25:48 guenther Exp $ # $NetBSD: Makefile,v 1.12 1997/04/17 07:27:49 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -40,5 +40,6 @@ lint: .include ${PROG}.sym: ${OBJS} - ${LD} -nopie -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym ${OBJS} + ${LD} -nopie -znorelro -Ttext ${BOOT_RELOC} -N -e start \ + -o ${PROG}.sym ${OBJS} size ${PROG}.sym diff --git a/sys/arch/alpha/stand/netboot/Makefile b/sys/arch/alpha/stand/netboot/Makefile index 34e6ed29dce..c8f5958eca2 100644 --- a/sys/arch/alpha/stand/netboot/Makefile +++ b/sys/arch/alpha/stand/netboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2014/12/13 14:45:34 miod Exp $ +# $OpenBSD: Makefile,v 1.14 2016/07/30 03:25:48 guenther Exp $ # $NetBSD: Makefile,v 1.11 1997/04/17 07:27:50 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -70,6 +70,6 @@ LIBSA= ${SALIB} ${PROG}.sym: ${OBJS} ${LIBSA} ${LIBZ} sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${COMPILE.c} vers.c - ${LD} -nopie -Ttext ${BOOT_RELOC} -N -e start -o ${PROG}.sym \ - ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBSA} + ${LD} -nopie -znorelro -Ttext ${BOOT_RELOC} -N -e start \ + -o ${PROG}.sym ${OBJS} vers.o ${LIBSA} ${LIBZ} ${LIBSA} size ${PROG}.sym diff --git a/sys/arch/amd64/stand/biosboot/Makefile b/sys/arch/amd64/stand/biosboot/Makefile index 36901b17480..70beaa86877 100644 --- a/sys/arch/amd64/stand/biosboot/Makefile +++ b/sys/arch/amd64/stand/biosboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2014/07/13 21:18:44 jasper Exp $ +# $OpenBSD: Makefile,v 1.11 2016/07/30 03:25:48 guenther Exp $ MAN= biosboot.8 @@ -9,7 +9,7 @@ SADIR= ${.CURDIR}/.. PROG= biosboot SRCS= biosboot.S LD=ld -LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie +LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata INSTALL_STRIP= diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index 7b13b086e0e..567f85967f4 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.31 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.32 2016/07/30 03:25:48 guenther Exp $ COPTS?= MAN?= boot.8 @@ -17,7 +17,7 @@ PROG?= boot SRCS= srt0.S conf.c LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie +LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata .PATH: ${S}/stand/boot diff --git a/sys/arch/amd64/stand/cdboot/Makefile b/sys/arch/amd64/stand/cdboot/Makefile index 23a261fd7e6..e431f4be3f9 100644 --- a/sys/arch/amd64/stand/cdboot/Makefile +++ b/sys/arch/amd64/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.27 2015/09/02 01:52:25 yasuoka Exp $ +# $OpenBSD: Makefile,v 1.28 2016/07/30 03:25:48 guenther Exp $ MAN= cdboot.8 @@ -10,7 +10,7 @@ PROG= cdboot SRCS= srt0.S boot.c conf.c LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie +LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata INSTALL_STRIP= BINMODE=644 diff --git a/sys/arch/amd64/stand/cdbr/Makefile b/sys/arch/amd64/stand/cdbr/Makefile index 6495d84f27f..2caa5935f44 100644 --- a/sys/arch/amd64/stand/cdbr/Makefile +++ b/sys/arch/amd64/stand/cdbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2015/02/07 23:23:03 miod Exp $ +# $OpenBSD: Makefile,v 1.11 2016/07/30 03:25:48 guenther Exp $ # S= ${.CURDIR}/../../../.. @@ -13,7 +13,7 @@ AFLAGS+=-DMACH=\"${MACHINE}\" -DMACH_U=\"${MACHINE:U}\" AFLAGS+=-fno-pie LD=ld ORG= 0x0000 -LDFLAGS=-nostdlib -Ttext ${ORG} -x -N -s -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext ${ORG} -x -N -s -Bstatic -e start -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata INSTALL_STRIP= BINMODE=644 diff --git a/sys/arch/amd64/stand/mbr/Makefile b/sys/arch/amd64/stand/mbr/Makefile index 4dba61931b4..a51b88429e6 100644 --- a/sys/arch/amd64/stand/mbr/Makefile +++ b/sys/arch/amd64/stand/mbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.10 2014/07/13 21:18:44 jasper Exp $ +# $OpenBSD: Makefile,v 1.11 2016/07/30 03:25:48 guenther Exp $ # S= ${.CURDIR}/../../../.. @@ -10,7 +10,7 @@ AFLAGS+=-m32 AFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../.. #-Wa,-a AFLAGS+=-fno-pie LD=ld -LDFLAGS=-nostdlib -Ttext 0 -x -N -s -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext 0 -x -N -s -Bstatic -e start -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata NOMAN= diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index ddf2880edea..57f7cde6fc6 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.25 2015/11/16 19:33:52 miod Exp $ +# $OpenBSD: Makefile,v 1.26 2016/07/30 03:25:48 guenther Exp $ MAN= pxeboot.8 @@ -10,7 +10,7 @@ PROG= pxeboot SRCS= srt0.S conf.c devopen.c open.c LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie +LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie -znorelro LDFLAGS+=-melf_i386 -L/usr/libdata INSTALL_STRIP= BINMODE=644 diff --git a/sys/arch/armish/stand/Makefile.inc b/sys/arch/armish/stand/Makefile.inc index e858ce97199..43857d6f70b 100644 --- a/sys/arch/armish/stand/Makefile.inc +++ b/sys/arch/armish/stand/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.3 2015/06/05 18:14:26 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.4 2016/07/30 03:25:48 guenther Exp $ BINDIR=/usr/mdec MANSUBDIR=armish CFLAGS+= -fno-pie -LDFLAGS+= -nopie +LDFLAGS+= -nopie -znorelro diff --git a/sys/arch/hppa/stand/boot/Makefile b/sys/arch/hppa/stand/boot/Makefile index 42ce85252b3..1d354d9e740 100644 --- a/sys/arch/hppa/stand/boot/Makefile +++ b/sys/arch/hppa/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.25 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.26 2016/07/30 03:25:48 guenther Exp $ MAN= boot.8 MANSUBDIR=hppa @@ -17,7 +17,7 @@ SRCS+= milli.S ashrdi3.c memcmp.c memcpy.c memset.c moddi3.c muldi3.c \ qdivrem.c strcmp.c strlcpy.c strlen.c strncmp.c strncpy.c divdi3.c LD?= ld -LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) -nopie +LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) -nopie -znorelro LDFLAGS+=-T ${.CURDIR}/ld.script -Map boot.map SIZE?= size STRIP?= strip diff --git a/sys/arch/hppa/stand/cdboot/Makefile b/sys/arch/hppa/stand/cdboot/Makefile index e0408b0a2c5..83ea3e345cc 100644 --- a/sys/arch/hppa/stand/cdboot/Makefile +++ b/sys/arch/hppa/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.9 2014/07/13 21:18:26 miod Exp $ +# $OpenBSD: Makefile,v 1.10 2016/07/30 03:25:48 guenther Exp $ NOMAN= no man S =${.CURDIR}/../../../.. @@ -21,7 +21,7 @@ CPPFLAGS+=-DCONSPEED=9600 SRCS+= milli.S strlen.c strlcpy.c LD?= ld -LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) -nopie +LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) -nopie -znorelro LDFLAGS+=-T ${.CURDIR}/ld.script -Map cdboot.map SIZE?= size STRIP?= strip diff --git a/sys/arch/i386/stand/biosboot/Makefile b/sys/arch/i386/stand/biosboot/Makefile index f078dcde1b5..c2df759a7c8 100644 --- a/sys/arch/i386/stand/biosboot/Makefile +++ b/sys/arch/i386/stand/biosboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.26 2013/01/18 21:09:04 espie Exp $ +# $OpenBSD: Makefile,v 1.27 2016/07/30 03:25:48 guenther Exp $ MAN= biosboot.8 @@ -9,7 +9,7 @@ SADIR= ${.CURDIR}/.. PROG= biosboot SRCS= biosboot.S LD=ld -LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie +LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie -znorelro INSTALL_STRIP= .depend biosboot.o: assym.h diff --git a/sys/arch/i386/stand/boot/Makefile b/sys/arch/i386/stand/boot/Makefile index da21c2e1654..e227dae8534 100644 --- a/sys/arch/i386/stand/boot/Makefile +++ b/sys/arch/i386/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.59 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.60 2016/07/30 03:25:48 guenther Exp $ COPTS?= MAN?= boot.8 @@ -16,7 +16,7 @@ SADIR= ${.CURDIR}/.. PROG?= boot LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -nopie +LDFLAGS+=-nostdlib -Bstatic -nopie -znorelro CLEANFILES+= crt0.o SRCS= srt0.S conf.c diff --git a/sys/arch/i386/stand/cdboot/Makefile b/sys/arch/i386/stand/cdboot/Makefile index 6306887a728..ff9c01452b5 100644 --- a/sys/arch/i386/stand/cdboot/Makefile +++ b/sys/arch/i386/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.24 2015/09/02 04:09:24 yasuoka Exp $ +# $OpenBSD: Makefile,v 1.25 2016/07/30 03:25:48 guenther Exp $ MAN= cdboot.8 @@ -10,7 +10,7 @@ PROG= cdboot SRCS= srt0.S boot.c conf.c LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie +LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie -znorelro INSTALL_STRIP= BINMODE=644 diff --git a/sys/arch/i386/stand/cdbr/Makefile b/sys/arch/i386/stand/cdbr/Makefile index 3f153f4fa55..19e22f96ef8 100644 --- a/sys/arch/i386/stand/cdbr/Makefile +++ b/sys/arch/i386/stand/cdbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2014/07/15 22:14:37 deraadt Exp $ +# $OpenBSD: Makefile,v 1.7 2016/07/30 03:25:48 guenther Exp $ # S= ${.CURDIR}/../../../.. @@ -12,7 +12,7 @@ AFLAGS+=-DMACH=\"${MACHINE}\" -DMACH_U=\"${MACHINE:U}\" AFLAGS+=-fno-pie LD=ld ORG= 0x0000 -LDFLAGS=-nostdlib -Ttext ${ORG} -x -N -s -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext ${ORG} -x -N -s -Bstatic -e start -nopie -znorelro NOMAN= #MAN+= cdbr.8 diff --git a/sys/arch/i386/stand/mbr/Makefile b/sys/arch/i386/stand/mbr/Makefile index 8fb916cbc57..7d98fadf493 100644 --- a/sys/arch/i386/stand/mbr/Makefile +++ b/sys/arch/i386/stand/mbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2013/01/18 21:09:04 espie Exp $ +# $OpenBSD: Makefile,v 1.20 2016/07/30 03:25:48 guenther Exp $ # S= ${.CURDIR}/../../../.. @@ -9,7 +9,7 @@ SRCS= mbr.S AFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../.. #-Wa,-a AFLAGS+=-fno-pie LD=ld -LDFLAGS=-nostdlib -Ttext 0 -x -N -s -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext 0 -x -N -s -Bstatic -e start -nopie -znorelro NOMAN= #MAN+= mbr.8 diff --git a/sys/arch/i386/stand/pxeboot/Makefile b/sys/arch/i386/stand/pxeboot/Makefile index 922724685e5..d2dbd231cc0 100644 --- a/sys/arch/i386/stand/pxeboot/Makefile +++ b/sys/arch/i386/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2015/09/02 04:09:24 yasuoka Exp $ +# $OpenBSD: Makefile,v 1.22 2016/07/30 03:25:48 guenther Exp $ MAN= pxeboot.8 @@ -10,7 +10,7 @@ PROG= pxeboot SRCS= srt0.S conf.c devopen.c open.c LD?= ld SIZE?= size -LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie +LDFLAGS+=-nostdlib -Bstatic -Ttext $(LINKADDR) -N -x -nopie -znorelro INSTALL_STRIP= BINMODE=644 diff --git a/sys/arch/landisk/stand/boot/Makefile b/sys/arch/landisk/stand/boot/Makefile index eb8f4e387e1..1b315cabf55 100644 --- a/sys/arch/landisk/stand/boot/Makefile +++ b/sys/arch/landisk/stand/boot/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.12 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.13 2016/07/30 03:25:48 guenther Exp $ MAN= boot.8 .if ${MACHINE} == "landisk" PROG= boot SRCS= srt0.S conf.c devs.c getsecs.c scifcons.c delay.c -LDFLAGS=-nostdlib -Ttext 0x8ff00000 -N -x -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext 0x8ff00000 -N -x -Bstatic -e start -nopie -znorelro OBJCOPY?=objcopy INSTALL_STRIP= diff --git a/sys/arch/landisk/stand/mbr/Makefile b/sys/arch/landisk/stand/mbr/Makefile index 61743b5a165..e21d596f685 100644 --- a/sys/arch/landisk/stand/mbr/Makefile +++ b/sys/arch/landisk/stand/mbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2012/09/02 16:21:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.5 2016/07/30 03:25:48 guenther Exp $ .include @@ -9,7 +9,7 @@ PROG= mbr SRCS= mbr.S AFLAGS+=-nostdinc -I${.OBJDIR} -I${.CURDIR}/.. -I${.CURDIR}/../../.. #-Wa,a AFLAGS+=-fno-pie -LDFLAGS+=-N -e start -Ttext 0x8c200200 -nopie +LDFLAGS+=-N -e start -Ttext 0x8c200200 -nopie -znorelro OBJCOPY?=objcopy INSTALL_STRIP= diff --git a/sys/arch/landisk/stand/xxboot/Makefile b/sys/arch/landisk/stand/xxboot/Makefile index dfe02078e98..97bf2df934e 100644 --- a/sys/arch/landisk/stand/xxboot/Makefile +++ b/sys/arch/landisk/stand/xxboot/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.9 2015/10/05 04:38:27 miod Exp $ +# $OpenBSD: Makefile,v 1.10 2016/07/30 03:25:48 guenther Exp $ MAN= xxboot.8 .if ${MACHINE} == "landisk" PROG= xxboot SRCS= pbr.S xxboot.S boot1.c -LDFLAGS=-nostdlib -Ttext 0x8c201000 -N -x -Bstatic -e start -nopie +LDFLAGS=-nostdlib -Ttext 0x8c201000 -N -x -Bstatic -e start -nopie -znorelro INSTALL_STRIP= diff --git a/sys/arch/loongson/stand/boot/Makefile b/sys/arch/loongson/stand/boot/Makefile index ddd58124d9f..7d6258397df 100644 --- a/sys/arch/loongson/stand/boot/Makefile +++ b/sys/arch/loongson/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.6 2016/07/30 03:25:48 guenther Exp $ NOMAN= #MAN= boot.8 @@ -10,6 +10,6 @@ NOPROG= .endif CFLAGS+=-fno-pie AFLAGS+=-fno-pie -LDFLAGS+=-nopie +LDFLAGS+=-nopie -znorelro .include diff --git a/sys/arch/luna88k/stand/boot/Makefile b/sys/arch/luna88k/stand/boot/Makefile index 03eca50eb65..19ee4be36f5 100644 --- a/sys/arch/luna88k/stand/boot/Makefile +++ b/sys/arch/luna88k/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2014/02/23 20:01:04 miod Exp $ +# $OpenBSD: Makefile,v 1.7 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.9 2013/01/22 15:48:40 tsutsui Exp $ # @(#)Makefile 8.2 (Berkeley) 8/15/93 @@ -19,7 +19,7 @@ OBJCOPY?= objcopy TEXTADDR= 0x700000 # 7MB LDSCRIPT= ${.CURDIR}/boot.ldscript LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT} \ - --warn-common -nopie + --warn-common -nopie -znorelro SRCS= locore.S SRCS+= init_main.c diff --git a/sys/arch/macppc/stand/boot.mac/Makefile b/sys/arch/macppc/stand/boot.mac/Makefile index 602ba54701a..77367c7e347 100644 --- a/sys/arch/macppc/stand/boot.mac/Makefile +++ b/sys/arch/macppc/stand/boot.mac/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2015/09/11 17:46:59 miod Exp $ +# $OpenBSD: Makefile,v 1.14 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.1 1996/09/30 16:35:05 ws Exp $ S= ${.CURDIR}/../../../.. @@ -17,7 +17,7 @@ INSTALL_STRIP= BINDIR= /usr/mdec OBJCOPY?= objcopy OBJCOPY_ARGS= -O aixcoff-rs6000 -R .comment -R .note -LDFLAGS= -nopie -X -Ttext ${RELOC} -e $(ENTRY) +LDFLAGS= -nopie -znorelro -X -Ttext ${RELOC} -e $(ENTRY) LDFLAGS+= -T ${.CURDIR}/elf32_powerpc_merge.x -Bstatic .PATH: ${S}/stand/boot diff --git a/sys/arch/macppc/stand/ofwboot/Makefile b/sys/arch/macppc/stand/ofwboot/Makefile index f2e89e59f01..176e32f7aa6 100644 --- a/sys/arch/macppc/stand/ofwboot/Makefile +++ b/sys/arch/macppc/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2015/09/11 17:46:59 miod Exp $ +# $OpenBSD: Makefile,v 1.15 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.2 1997/04/17 07:46:24 thorpej Exp $ S= ${.CURDIR}/../../../.. @@ -41,7 +41,7 @@ CPPFLAGS+= -DRELOC=0x${RELOC} -DCONSPEED=57600 LIBS!= cd $(.CURDIR)/$(R); $(MAKE) libdep ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} - ${LD} -nopie -N -X -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \ + ${LD} -nopie -znorelro -N -X -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \ ${OBJS} ${LIBS} .include diff --git a/sys/arch/octeon/stand/boot/Makefile b/sys/arch/octeon/stand/boot/Makefile index 1d90e268fb0..69c83ae7862 100644 --- a/sys/arch/octeon/stand/boot/Makefile +++ b/sys/arch/octeon/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.4 2016/07/30 03:25:49 guenther Exp $ NOMAN= #MAN= boot.8 @@ -12,6 +12,6 @@ NOPROG= CFLAGS+=-fno-pie -DCONSPEED=15200 AFLAGS+=-fno-pie -LDFLAGS+=-nopie +LDFLAGS+=-nopie -znorelro .include diff --git a/sys/arch/sgi/stand/boot/Makefile b/sys/arch/sgi/stand/boot/Makefile index c57e3d7d35c..f307404393f 100644 --- a/sys/arch/sgi/stand/boot/Makefile +++ b/sys/arch/sgi/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.15 2012/08/31 08:14:08 pascal Exp $ +# $OpenBSD: Makefile,v 1.16 2016/07/30 03:25:49 guenther Exp $ NOMAN= noman @@ -7,7 +7,7 @@ CFLAGS+= ${SAABI} -mno-abicalls -D_NO_ABICALLS -nostdinc -D__sgi__ \ -I${.CURDIR}/../../../../lib/libsa \ -I${.OBJDIR} CFLAGS+= -D__INTERNAL_LIBSA_CREAD ${STANDALONE} -fno-pie -LDFLAGS+= -nopie +LDFLAGS+= -nopie -znorelro AFLAGS+= ${SAABI} diff --git a/sys/arch/socppc/stand/boot/Makefile b/sys/arch/socppc/stand/boot/Makefile index 4e25da73e6f..4ad4c127090 100644 --- a/sys/arch/socppc/stand/boot/Makefile +++ b/sys/arch/socppc/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.16 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.17 2016/07/30 03:25:49 guenther Exp $ .include "${.CURDIR}/../Makefile.inc" @@ -44,7 +44,7 @@ LIBSA= ${SALIB} STANDIR= ${.CURDIR}/.. RELOC= 0x100000 -LDFLAGS= -Ttext ${RELOC} -nopie +LDFLAGS= -Ttext ${RELOC} -nopie -znorelro OBJCOPY?= objcopy ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} diff --git a/sys/arch/socppc/stand/mbr/Makefile b/sys/arch/socppc/stand/mbr/Makefile index 0e374f8ceaa..07bc52c4b7c 100644 --- a/sys/arch/socppc/stand/mbr/Makefile +++ b/sys/arch/socppc/stand/mbr/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2012/09/11 15:59:01 kettenis Exp $ +# $OpenBSD: Makefile,v 1.4 2016/07/30 03:25:49 guenther Exp $ .include @@ -9,7 +9,7 @@ NOMAN= PROG= mbr SRCS= mbr.S AFLAGS+=-I${.OBJDIR} -I${.CURDIR}/../../.. #-Wa,a -LDFLAGS+=-N -e start -Ttext 0 -nopie +LDFLAGS+=-N -e start -Ttext 0 -nopie -znorelro OBJCOPY?=objcopy INSTALL_STRIP= diff --git a/sys/arch/sparc/stand/boot/Makefile b/sys/arch/sparc/stand/boot/Makefile index 2d4de961251..25fce1e3910 100644 --- a/sys/arch/sparc/stand/boot/Makefile +++ b/sys/arch/sparc/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2015/06/14 18:33:53 miod Exp $ +# $OpenBSD: Makefile,v 1.22 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.2 1995/09/30 21:43:38 pk Exp $ PROG= boot @@ -27,7 +27,7 @@ elfclean: clean-elf.c ${HOSTCC} -o elfclean ${.ALLSRC} ${PROG}: ${OBJS} ${LIBS} elfclean - ${LD} -nopie -N -Ttext ${RELOC2} --format a.out-sparc-netbsd \ + ${LD} -nopie -znorelro -N -Ttext ${RELOC2} --format a.out-sparc-netbsd \ -e start ${OBJS} ${LIBSA} ${LIBZ} -o ${.TARGET}.elf ./elfclean ${.TARGET}.elf objcopy -j .text -j .data -j .bss -O a.out-sparc-netbsd \ diff --git a/sys/arch/sparc/stand/bootxx/Makefile b/sys/arch/sparc/stand/bootxx/Makefile index 241de4039d9..bf5c39da273 100644 --- a/sys/arch/sparc/stand/bootxx/Makefile +++ b/sys/arch/sparc/stand/bootxx/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2015/03/17 19:59:39 miod Exp $ +# $OpenBSD: Makefile,v 1.14 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.2 1995/09/30 21:43:38 pk Exp $ .PATH: ${.CURDIR}/../common @@ -31,7 +31,7 @@ elfclean: clean-elf.c ${HOSTCC} -o elfclean ${.ALLSRC} ${PROG}: ${OBJS} elfclean - ${LD} -nopie -N -Ttext ${RELOC} -e start ${OBJS} ${_SOBJS} \ + ${LD} -nopie -znorelro -N -Ttext ${RELOC} -e start ${OBJS} ${_SOBJS} \ -o ${.TARGET}.elf ./elfclean ${.TARGET}.elf objcopy -j .text -j .data -j .bss -O a.out-sparc-netbsd \ diff --git a/sys/arch/sparc64/stand/ofwboot/Makefile b/sys/arch/sparc64/stand/ofwboot/Makefile index b3af441c6d2..f030b699294 100644 --- a/sys/arch/sparc64/stand/ofwboot/Makefile +++ b/sys/arch/sparc64/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.19 2014/11/26 20:30:41 stsp Exp $ +# $OpenBSD: Makefile,v 1.20 2016/07/30 03:25:49 guenther Exp $ # $NetBSD: Makefile,v 1.2 2001/03/04 14:50:05 mrg Exp $ CURDIR= ${.CURDIR} @@ -73,7 +73,7 @@ CPPFLAGS+= -DSOFTRAID .endif ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} - ${LD} -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} -nopie \ + ${LD} -N -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} -nopie -znorelro \ ${OBJS} -L${LIBSADIR} ${LIBSA} \ -L${LIBZDIR} ${LIBZ} diff --git a/sys/arch/zaurus/stand/zboot/Makefile b/sys/arch/zaurus/stand/zboot/Makefile index a1b3dab57d1..10c590513c5 100644 --- a/sys/arch/zaurus/stand/zboot/Makefile +++ b/sys/arch/zaurus/stand/zboot/Makefile @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile,v 1.17 2016/03/30 06:38:45 jmc Exp $ +# $OpenBSD: Makefile,v 1.18 2016/07/30 03:25:49 guenther Exp $ MAN= boot.8 MANSUBDIR=zaurus .if ${MACHINE} == "zaurus" PROG= zboot -LDFLAGS+=-nostdlib -Bstatic -nopie +LDFLAGS+=-nostdlib -Bstatic -nopie -znorelro INSTALL_STRIP= SRCS= crt0.c diff --git a/sys/arch/zaurus/stand/zbsdmod/Makefile b/sys/arch/zaurus/stand/zbsdmod/Makefile index f39c9dd2ca2..eabe11a9e0a 100644 --- a/sys/arch/zaurus/stand/zbsdmod/Makefile +++ b/sys/arch/zaurus/stand/zbsdmod/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2012/09/11 17:12:06 deraadt Exp $ +# $OpenBSD: Makefile,v 1.6 2016/07/30 03:25:49 guenther Exp $ OBJS= zbsdmod.o SRCS= zbsdmod.c @@ -18,4 +18,4 @@ afterinstall: CFLAGS= -fno-stack-protector -Wall CFLAGS+= -DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\" CPPFLAGS= -I${.CURDIR}/../include -fno-pie -LDFLAGS+= -nopie +LDFLAGS+= -nopie -znorelro