added -cpu option for x86 - fixed glibc hack in case the global variables are moved

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3548 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2007-11-08 13:56:19 +00:00
parent a049de6161
commit 46027c07de

View File

@ -45,12 +45,20 @@ const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2";
/* 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)
long __preinit_array_start[0];
long __preinit_array_end[0];
long __init_array_start[0];
long __init_array_end[0];
long __fini_array_start[0];
long __fini_array_end[0];
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");
#endif
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
@ -1975,6 +1983,23 @@ int main(int argc, char **argv)
/* Scan interp_prefix dir for replacement files. */
init_paths(interp_prefix);
#if defined(TARGET_I386)
/* must be done before cpu_init() for x86 XXX: suppress this hack
by adding a new parameter to cpu_init and by suppressing
cpu_xxx_register() */
if (cpu_model == NULL) {
#ifdef TARGET_X86_64
cpu_model = "qemu64";
#else
cpu_model = "qemu32";
#endif
}
if (x86_find_cpu_by_name(cpu_model)) {
fprintf(stderr, "Unable to find x86 CPU definition\n");
exit(1);
}
#endif
/* NOTE: we need to init the CPU at this stage to get
qemu_host_page_size */
env = cpu_init();