All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brad Smith <brad@comstyle.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] Fix QEMU build on OpenBSD on x86 archs
Date: Sat, 14 Dec 2013 23:27:03 -0500	[thread overview]
Message-ID: <52AD2F97.4090002@comstyle.com> (raw)
In-Reply-To: <20131211004908.GA19241@rox.home.comstyle.com>

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 <brad@comstyle.com>

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.

  reply	other threads:[~2013-12-15  4:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  0:49 [Qemu-devel] [PATCH v3] Fix QEMU build on OpenBSD on x86 archs Brad Smith
2013-12-15  4:27 ` Brad Smith [this message]
2013-12-20 11:19   ` Brad Smith
2014-01-14 19:08     ` Brad Smith
2014-01-02  7:55 ` Stefan Hajnoczi
2014-01-26  1:37   ` Brad Smith
2014-01-26 18:06     ` Paolo Bonzini
2014-01-26 21:40       ` Brad Smith
2014-01-26 22:12         ` Anthony Liguori
2014-01-26 23:04           ` Brad Smith
2014-02-16 22:00       ` Brad Smith
2014-02-17 16:20         ` Peter Maydell
2014-02-18  0:36           ` Brad Smith
2014-02-18  9:45             ` Peter Maydell
2014-02-18 18:02               ` Brad Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52AD2F97.4090002@comstyle.com \
    --to=brad@comstyle.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.