From df70204db53e3611af986f434e74a882bce190ca Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Sat, 12 Sep 2009 02:17:54 +0300 Subject: Fix text relocations in linux-user targets There is a link hack in linux-user which produces an executable that looks like PIE, but always has text relocations since all object files isn't position-independent (compiled without -fpic/-fpie). Dynamic loader has to do more work to load a binary with text relocations. The best way to keep this functionality is to build a true PIE without text relocations. Signed-off-by: Kirill A. Shutemov Signed-off-by: Blue Swirl --- linux-user/main.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'linux-user') diff --git a/linux-user/main.c b/linux-user/main.c index a628c01725..81a1ada50b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -48,32 +48,6 @@ int have_guest_base; static const char *interp_prefix = CONFIG_QEMU_PREFIX; const char *qemu_uname_release = CONFIG_UNAME_RELEASE; -#if defined(__i386__) && !defined(CONFIG_STATIC) -/* Force usage of an ELF interpreter even if it is an ELF shared - object ! */ -const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2"; -#endif - -/* 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) -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 */ -- cgit v1.2.3