From: Stefan Weil <sw@weilnetz.de>
To: Richard Henderson <rth@twiddle.net>,
qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: Ed Maste <emaste@freebsd.org>
Subject: Re: [Qemu-devel] [PATCH v3] configure: Simplify alternate .text segment
Date: Wed, 07 Jan 2015 19:02:49 +0100 [thread overview]
Message-ID: <54AD74C9.1000405@weilnetz.de> (raw)
In-Reply-To: <1371867016-7660-1-git-send-email-rth@twiddle.net>
Hello,
this patch which is part of QEMU for more than a year now needs to be
fixed for builds on Mac OS X:
I just saw that the Mac's native linker ld does not support --verbose,
but shows a warning.
Would it be sufficient to redirect that warning to /dev/null (as it was
done in the previous code)?
Regards
Stefan
Am 22.06.2013 um 04:10 schrieb Richard Henderson:
> For bsd-user and linux-user emulation modes QEMU needs to be linked at an
> alternate .text segment address, so that it's out of the way of the guest
> executable. Instead of including modified linker scripts for each arch,
> just set the address with -Ttext-segment if supported, or by using sed to
> edit the default linker script.
>
> Cc: Ed Maste <emaste@freebsd.org>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> configure | 48 +++++++++++++++++++++++++++++++-----------------
> 2 files changed, 31 insertions(+), 18 deletions(-)
> --
>
> Changes v2-v3:
> * Move the check for textseg_ldflags much earlier in the configure file,
> so that we've not got cflags invalid for configure time. Plus, the
> check (and generated ld script) only gets done once, not once per
> target directory.
> * Remove ia64 from the hosts that get relocation
> * Handle s390x like s390.
>
> Tested on x86_64, arm, hppa (old binutils needing config-host.ld),
> sparc64, and ia64. All various versions of linux.
>
>
> r~
>
>
>
> diff --git a/configure b/configure
> index ad32f87..63da418 100755
> --- a/configure
> +++ b/configure
> @@ -3444,6 +3444,36 @@ if test "$cpu" = "s390x" ; then
> roms="$roms s390-ccw"
> fi
>
> +# Probe for the need for relocating the user-only binary.
> +if test "$pie" = "no" ; then
> + textseg_addr=
> + case "$cpu" in
> + arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64)
> + textseg_addr=0x60000000
> + ;;
> + mips)
> + textseg_addr=0x400000
> + ;;
> + esac
> + if [ -n "$textseg_addr" ]; then
> + cat > $TMPC <<EOF
> + int main(void) { return 0; }
> +EOF
> + textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
> + if ! compile_prog "" "$textseg_ldflags"; then
> + # In case ld does not support -Ttext-segment, edit the default linker
> + # script via sed to set the .text start addr. This is needed on FreeBSD
> + # at least.
> + $ld --verbose | sed \
This $ld --verbose raises a warning when configure is run.
> + -e '1,/==================================================/d' \
> + -e '/==================================================/,$d' \
> + -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
> + -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
> + textseg_ldflags="-Wl,-T../config-host.ld"
> + fi
> + fi
> +fi
> +
> # add pixman flags after all config tests are done
> QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
> libs_softmmu="$libs_softmmu $pixman_libs"
> @@ -4072,9 +4102,6 @@ if test "$gcov" = "yes" ; then
> echo "GCOV=$gcov_tool" >> $config_host_mak
> fi
>
> -# generate list of library paths for linker script
> -$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > config-host.ld
The old code redirected stderr, so any warning was not visible.
> -
> # use included Linux headers
> if test "$linux" = "yes" ; then
> mkdir -p linux-headers
> @@ -4437,21 +4464,8 @@ if test "$gprof" = "yes" ; then
> fi
> fi
>
> -if test "$ARCH" = "tci"; then
> - linker_script=""
> -else
> - linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/ldscripts/\$(ARCH).ld"
> -fi
> -
> if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
> - case "$ARCH" in
> - alpha | s390x | aarch64)
> - # The default placement of the application is fine.
> - ;;
> - *)
> - ldflags="$linker_script $ldflags"
> - ;;
> - esac
> + ldflags="$ldflags $textseg_ldflags"
> fi
>
> echo "LDFLAGS+=$ldflags" >> $config_target_mak
next prev parent reply other threads:[~2015-01-07 18:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-22 2:10 [Qemu-devel] [PATCH v3] configure: Simplify alternate .text segment Richard Henderson
2013-06-22 10:58 ` Peter Maydell
2013-06-23 18:20 ` Richard Henderson
2013-06-23 18:22 ` Peter Maydell
2013-06-24 19:45 ` Ed Maste
2013-07-02 15:12 ` Richard Henderson
2013-07-09 15:43 ` Richard Henderson
2013-07-10 19:33 ` Anthony Liguori
2015-01-07 18:02 ` Stefan Weil [this message]
2015-01-07 18:44 ` Richard Henderson
2015-01-07 20:37 ` Peter Maydell
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=54AD74C9.1000405@weilnetz.de \
--to=sw@weilnetz.de \
--cc=emaste@freebsd.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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.