Add configure option to compile user targets as PIE

Build uset targers as true PIE if user want to keep qemu
self-virtualizable.

v5:
  - Split into to patches: drop link hack and add PIE support
  - do not build PIE by default and drop toolchain check

v4:
  - Add test for toolchain if it has proper PIE support

v3:
  - One more pice of the hack was removed
  - Description updated

v2:
  - Add configure options do enable/disable PIE for usermode targets.
    Disabling can be useful if you build uswing toolchain which has
    broken PIE support. PIE for usermode targets enabled by default.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Kirill A. Shutemov 2009-09-12 02:17:55 +03:00 committed by Blue Swirl
parent df70204db5
commit 34005a0060
3 changed files with 30 additions and 13 deletions

14
configure vendored
View file

@ -222,6 +222,7 @@ aix="no"
blobs="yes"
pkgversion=""
check_utests="no"
user_pie="no"
# OS specific
if check_define __linux__ ; then
@ -503,6 +504,10 @@ for opt do
;;
--disable-guest-base) guest_base="no"
;;
--enable-user-pie) user_pie="yes"
;;
--disable-user-pie) user_pie="no"
;;
--enable-uname-release=*) uname_release="$optarg"
;;
--sparc_cpu=*)
@ -683,6 +688,8 @@ echo " --disable-bsd-user disable all BSD usermode emulation targets"
echo " --enable-guest-base enable GUEST_BASE support for usermode"
echo " emulation targets"
echo " --disable-guest-base disable GUEST_BASE support"
echo " --enable-user-pie build usermode emulation targets as PIE"
echo " --disable-user-pie do not build usermode emulation targets as PIE"
echo " --fmod-lib path to FMOD library"
echo " --fmod-inc path to FMOD includes"
echo " --oss-lib path to OSS library"
@ -1723,6 +1730,7 @@ echo "Documentation $docs"
echo "uname -r $uname_release"
echo "NPTL support $nptl"
echo "GUEST_BASE $guest_base"
echo "PIE user targets $user_pie"
echo "vde support $vde"
echo "IO thread $io_thread"
echo "Linux AIO support $linux_aio"
@ -2355,6 +2363,12 @@ if test "$target_softmmu" = "yes" ; then
esac
fi
if test "$target_user_only" = "yes" -a "$static" = "no" -a \
"$user_pie" = "yes" ; then
cflags="-fpie $cflags"
ldflags="-pie $ldflags"
fi
if test "$target_softmmu" = "yes" -a \( \
"$TARGET_ARCH" = "microblaze" -o \
"$TARGET_ARCH" = "cris" \) ; then