From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vs3IU-0006eP-1A for qemu-devel@nongnu.org; Sat, 14 Dec 2013 23:27:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vs3IS-0002mm-Nd for qemu-devel@nongnu.org; Sat, 14 Dec 2013 23:27:17 -0500 Received: from speedy.comstyle.com ([2001:470:1d:8c::2]:20878 helo=mail.comstyle.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vs3IS-0002lU-GI for qemu-devel@nongnu.org; Sat, 14 Dec 2013 23:27:16 -0500 Received: from users-mac-pro.home.comstyle.com (unknown [IPv6:2001:470:b01e:3:214:51ff:fe67:4efb]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: brad) by mail.comstyle.com (Postfix) with ESMTPSA id 3C6EE9847F for ; Sat, 14 Dec 2013 23:27:04 -0500 (EST) Message-ID: <52AD2F97.4090002@comstyle.com> Date: Sat, 14 Dec 2013 23:27:03 -0500 From: Brad Smith MIME-Version: 1.0 References: <20131211004908.GA19241@rox.home.comstyle.com> In-Reply-To: <20131211004908.GA19241@rox.home.comstyle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] Fix QEMU build on OpenBSD on x86 archs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 10/12/13 7:49 PM, Brad Smith wrote: > This resolves the build issue with building the ROMs on OpenBSD on x86 archs. > As of OpenBSD 5.3 the compiler builds PIE binaries by default and thus the > whole OS/packages and so forth. The ROMs need to have PIE disabled. This > is my initial attempt at trying to get somehting upstream so that QEMU > both builds out of the box and to resolve the build issue with the > buildbots that has been around for awhile. We have a patch in our ports > tree but it is just the flags hardcoded into the Makefile which obviously > is not appropriate for upstream. > > From the OpenBSD buildbots.. > Building optionrom/multiboot.img > ld: multiboot.o: relocation R_X86_64_16 can not be used when making a shared object; recompile with -fPIC > > Signed-off by: Brad Smith ping. > --- > > Change in v2: > * Fix '==' is not portable syntax. > > Change in v3: > * Rename variables and use compile_prog to detect the presence of the compiler/linker > flags, as suggested by Stefan Weil. > > diff --git a/configure b/configure > index 5d82283..89ae89d 100755 > --- a/configure > +++ b/configure > @@ -1365,6 +1365,11 @@ EOF > pie="no" > fi > fi > + > + if compile_prog "-fno-pie" "-nopie"; then > + CFLAGS_NOPIE="-fno-pie" > + LDFLAGS_NOPIE="-nopie" > + fi > fi > > ########################################## > @@ -4320,6 +4325,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 > @@ -4333,6 +4339,7 @@ else > echo "AUTOCONF_HOST := " >> $config_host_mak > fi > 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 > diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile > index 57d8bd0..ce4852a 100644 > --- a/pc-bios/optionrom/Makefile > +++ b/pc-bios/optionrom/Makefile > @@ -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 += $(CFLAGS_NOPIE) > QEMU_CFLAGS = $(CFLAGS) > > build-all: multiboot.bin linuxboot.bin kvmvapic.bin > @@ -20,7 +21,7 @@ build-all: multiboot.bin linuxboot.bin kvmvapic.bin > .SECONDARY: > > %.img: %.o > - $(call quiet-command,$(LD) -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)$@") > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.