From 964c6fa16f50a607f9da5068d6bf15ccc93872c0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 21 Jun 2013 19:10:16 -0700 Subject: [PATCH] configure: Simplify alternate .text segment 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 Signed-off-by: Richard Henderson Acked-by: Ed Maste Signed-off-by: Ed Maste Message-id: 1371867016-7660-1-git-send-email-rth@twiddle.net Signed-off-by: Anthony Liguori --- configure | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 0e0adde410..cb0f870b95 100755 --- a/configure +++ b/configure @@ -3445,6 +3445,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 < 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" @@ -4073,9 +4103,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 - # use included Linux headers if test "$linux" = "yes" ; then mkdir -p linux-headers @@ -4438,21 +4465,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