* [Qemu-devel] [PATCH for-1.7] Fix QEMU build on OpenBSD on x86 archs
@ 2013-11-24 20:52 Brad Smith
2013-11-27 19:32 ` Anthony Liguori
0 siblings, 1 reply; 3+ messages in thread
From: Brad Smith @ 2013-11-24 20:52 UTC (permalink / raw)
To: qemu-devel
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 <brad@comstyle.com>
diff --git a/configure b/configure
index 508f6a5..7f060a4 100755
--- a/configure
+++ b/configure
@@ -1342,6 +1342,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"
@@ -4307,6 +4311,8 @@ if test "$gcov" = "yes" ; then
echo "CONFIG_GCOV=y" >> $config_host_mak
echo "GCOV=$gcov_tool" >> $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
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 57d8bd0..0b35000 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 += $(CC_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) $(LD_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.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.7] Fix QEMU build on OpenBSD on x86 archs
2013-11-24 20:52 [Qemu-devel] [PATCH for-1.7] Fix QEMU build on OpenBSD on x86 archs Brad Smith
@ 2013-11-27 19:32 ` Anthony Liguori
2013-11-27 22:26 ` Brad Smith
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2013-11-27 19:32 UTC (permalink / raw)
To: Brad Smith, qemu-devel
Brad Smith <brad@comstyle.com> writes:
> 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 <brad@comstyle.com>
>
> diff --git a/configure b/configure
> index 508f6a5..7f060a4 100755
> --- a/configure
> +++ b/configure
> @@ -1342,6 +1342,10 @@ EOF
> if compile_prog "-fPIE -DPIE" "-pie"; then
> QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
> LDFLAGS="-pie $LDFLAGS"
> + if test "$targetos" == OpenBSD; then
'==' is not portable syntax. You need to use '='.
Regards,
Anthony Liguori
> + 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"
> @@ -4307,6 +4311,8 @@ if test "$gcov" = "yes" ; then
> echo "CONFIG_GCOV=y" >> $config_host_mak
> echo "GCOV=$gcov_tool" >> $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
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 57d8bd0..0b35000 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 += $(CC_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) $(LD_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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for-1.7] Fix QEMU build on OpenBSD on x86 archs
2013-11-27 19:32 ` Anthony Liguori
@ 2013-11-27 22:26 ` Brad Smith
0 siblings, 0 replies; 3+ messages in thread
From: Brad Smith @ 2013-11-27 22:26 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
On Wed, Nov 27, 2013 at 11:32:51AM -0800, Anthony Liguori wrote:
> Brad Smith <brad@comstyle.com> writes:
>
> > 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 <brad@comstyle.com>
> >
> > diff --git a/configure b/configure
> > index 508f6a5..7f060a4 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1342,6 +1342,10 @@ EOF
> > if compile_prog "-fPIE -DPIE" "-pie"; then
> > QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
> > LDFLAGS="-pie $LDFLAGS"
> > + if test "$targetos" == OpenBSD; then
>
> '==' is not portable syntax. You need to use '='.
Doh. My bad.
> Regards,
>
> Anthony Liguori
>
> > + 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"
> > @@ -4307,6 +4311,8 @@ if test "$gcov" = "yes" ; then
> > echo "CONFIG_GCOV=y" >> $config_host_mak
> > echo "GCOV=$gcov_tool" >> $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
> > diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> > index 57d8bd0..0b35000 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 += $(CC_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) $(LD_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.
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-27 22:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-24 20:52 [Qemu-devel] [PATCH for-1.7] Fix QEMU build on OpenBSD on x86 archs Brad Smith
2013-11-27 19:32 ` Anthony Liguori
2013-11-27 22:26 ` Brad Smith
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).