- Sync PIE bits with what was commited upstream

- Use stack protector strong instead of all

ok sthen@
This commit is contained in:
brad 2014-03-09 22:50:17 +00:00
parent fa88dfb572
commit 990f95de44
3 changed files with 51 additions and 29 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.113 2013/11/29 21:21:38 brad Exp $
# $OpenBSD: Makefile,v 1.114 2014/03/09 22:50:17 brad Exp $
ONLY_FOR_ARCHS= amd64 i386 powerpc sparc64
COMMENT= multi system emulator
DISTNAME= qemu-1.7.0
REVISION= 0
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/
EXTRACT_SUFX= .tar.bz2

View File

@ -1,18 +1,32 @@
$OpenBSD: patch-configure,v 1.38 2013/11/29 21:21:38 brad Exp $
--- configure.orig Tue Nov 26 12:47:18 2013
+++ configure Wed Nov 27 00:04:27 2013
@@ -1345,6 +1345,10 @@ EOF
if compile_prog "-fPIE -DPIE" "-pie"; then
QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
LDFLAGS="-pie $LDFLAGS"
+ if test "$targetos" = OpenBSD; then
+ CC_NOPIE="-fno-pie"
+ LD_NOPIE="-nopie"
+ fi
pie="yes"
if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
@@ -3549,8 +3553,6 @@ fi
$OpenBSD: patch-configure,v 1.39 2014/03/09 22:50:17 brad Exp $
--- configure.orig Wed Nov 27 17:15:55 2013
+++ configure Sat Feb 1 23:04:03 2014
@@ -1290,9 +1290,9 @@ for flag in $gcc_flags; do
fi
done
-if compile_prog "-Werror -fstack-protector-all" "" ; then
- QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
- LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
+if compile_prog "-Werror -fstack-protector-strong" "" ; then
+ QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-strong"
+ LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-strong"
fi
# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
@@ -1357,6 +1357,11 @@ EOF
pie="no"
fi
fi
+
+ if compile_prog "-fno-pie" "-nopie"; then
+ CFLAGS_NOPIE="-fno-pie"
+ LDFLAGS_NOPIE="-nopie"
+ fi
fi
##########################################
@@ -3549,8 +3554,6 @@ fi
if test "$gcov" = "yes" ; then
CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
@ -21,12 +35,19 @@ $OpenBSD: patch-configure,v 1.38 2013/11/29 21:21:38 brad Exp $
fi
@@ -4312,6 +4314,8 @@ if test "$gcov" = "yes" ; then
echo "CONFIG_GCOV=y" >> $config_host_mak
echo "GCOV=$gcov_tool" >> $config_host_mak
@@ -4288,6 +4291,7 @@ echo "LD=$ld" >> $config_host_mak
echo "WINDRES=$windres" >> $config_host_mak
echo "LIBTOOL=$libtool" >> $config_host_mak
echo "CFLAGS=$CFLAGS" >> $config_host_mak
+echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
if test "$sparse" = "yes" ; then
@@ -4301,6 +4305,7 @@ else
echo "AUTOCONF_HOST := " >> $config_host_mak
fi
+echo "CC_NOPIE=$CC_NOPIE" >> $config_host_mak
+echo "LD_NOPIE=$LD_NOPIE" >> $config_host_mak
# use included Linux headers
if test "$linux" = "yes" ; then
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
+echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-pc-bios_optionrom_Makefile,v 1.2 2013/11/29 21:21:38 brad Exp $
--- pc-bios/optionrom/Makefile.orig Tue Nov 26 12:47:18 2013
+++ pc-bios/optionrom/Makefile Wed Nov 27 00:05:28 2013
$OpenBSD: patch-pc-bios_optionrom_Makefile,v 1.3 2014/03/09 22:50:17 brad Exp $
--- pc-bios/optionrom/Makefile.orig Wed Nov 27 17:15:55 2013
+++ pc-bios/optionrom/Makefile Sat Feb 1 23:05:11 2014
@@ -12,6 +12,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
CFLAGS += -I$(SRC_PATH)
CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector)
+CFLAGS += $(CC_NOPIE)
+CFLAGS += $(CFLAGS_NOPIE)
QEMU_CFLAGS = $(CFLAGS)
build-all: multiboot.bin linuxboot.bin kvmvapic.bin
@ -14,7 +14,7 @@ $OpenBSD: patch-pc-bios_optionrom_Makefile,v 1.2 2013/11/29 21:21:38 brad Exp $
%.img: %.o
- $(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
+ $(call quiet-command,$(LD) $(LD_NOPIE) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
+ $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -Ttext 0 -e _start -s -o $@ $<," Building $(TARGET_DIR)$@")
%.raw: %.img
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@")