summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-09-13 13:33:05 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-09-13 13:33:05 +0000
commit91b40c5be84a478e98c0416325844a7f66d0efae (patch)
treed1dbdb15bc8aed0e6ff70dc6a7832af14d6b9f92
parentc5ff6d547299a04f03ed8bcf538a4a5fb2124bbf (diff)
Fix Sparc/Linux host breakage by df70204db53e3611af986f434e74a882bce190ca
While i386, x86_64 and Sparc64/OpenBSD still worked after df70204db53e3611af986f434e74a882bce190ca, Sparc32 and Sparc64 Linux hosts broke. Partially revert the commit: make the restored code conditional to !CONFIG_USER_PIE. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rwxr-xr-xconfigure3
-rw-r--r--linux-user/main.c21
2 files changed, 23 insertions, 1 deletions
diff --git a/configure b/configure
index 494e9ced7b..2d46d399a3 100755
--- a/configure
+++ b/configure
@@ -2364,9 +2364,10 @@ if test "$target_softmmu" = "yes" ; then
fi
if test "$target_user_only" = "yes" -a "$static" = "no" -a \
- "$user_pie" = "yes" ; then
+ "$user_pie" = "yes" ; then
cflags="-fpie $cflags"
ldflags="-pie $ldflags"
+ echo "CONFIG_USER_PIE=y" >> $config_mak
fi
if test "$target_softmmu" = "yes" -a \( \
diff --git a/linux-user/main.c b/linux-user/main.c
index 81a1ada50b..f3455c5a3e 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -48,6 +48,27 @@ int have_guest_base;
static const char *interp_prefix = CONFIG_QEMU_PREFIX;
const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
+/* for recent libc, we add these dummy symbols which are not declared
+ when generating a linked object (bug in ld ?) */
+#if ((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && \
+ !defined(CONFIG_STATIC)) && !defined(CONFIG_USER_PIE)
+asm(".globl __preinit_array_start\n"
+ ".globl __preinit_array_end\n"
+ ".globl __init_array_start\n"
+ ".globl __init_array_end\n"
+ ".globl __fini_array_start\n"
+ ".globl __fini_array_end\n"
+ ".section \".rodata\"\n"
+ "__preinit_array_start:\n"
+ "__preinit_array_end:\n"
+ "__init_array_start:\n"
+ "__init_array_end:\n"
+ "__fini_array_start:\n"
+ "__fini_array_end:\n"
+ ".long 0\n"
+ ".previous\n");
+#endif
+
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
we allocate a bigger stack. Need a better solution, for example
by remapping the process stack directly at the right place */