mirror of https://gitee.com/openkylin/qemu.git
RH9 fix - path patch
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@93 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
7fb9a24e39
commit
74cd30b811
|
@ -23,9 +23,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
|
|
||||||
#include <sys/personality.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "qemu.h"
|
#include "qemu.h"
|
||||||
|
|
||||||
|
@ -35,12 +32,22 @@
|
||||||
|
|
||||||
FILE *logfile = NULL;
|
FILE *logfile = NULL;
|
||||||
int loglevel;
|
int loglevel;
|
||||||
const char *interp_prefix = CONFIG_QEMU_PREFIX "/qemu-i386";
|
static const char *interp_prefix = CONFIG_QEMU_PREFIX;
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
/* Force usage of an ELF interpreter even if it is an ELF shared
|
/* Force usage of an ELF interpreter even if it is an ELF shared
|
||||||
object ! */
|
object ! */
|
||||||
const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2";
|
const char interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2";
|
||||||
|
|
||||||
|
/* for recent libc, we add these dummies symbol which are not declared
|
||||||
|
when generating a linked object (bug in ld ?) */
|
||||||
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
|
||||||
|
long __init_array_start[0];
|
||||||
|
long __init_array_end[0];
|
||||||
|
long __fini_array_start[0];
|
||||||
|
long __fini_array_end[0];
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
|
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
|
||||||
|
@ -358,7 +365,7 @@ void usage(void)
|
||||||
DEBUG_LOGFILE,
|
DEBUG_LOGFILE,
|
||||||
interp_prefix,
|
interp_prefix,
|
||||||
x86_stack_size);
|
x86_stack_size);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: currently only used for async signals (see signal.c) */
|
/* XXX: currently only used for async signals (see signal.c) */
|
||||||
|
@ -379,12 +386,6 @@ int main(int argc, char **argv)
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
/* Set personality to X86_LINUX. May fail on unpatched kernels:
|
|
||||||
if so, they need to have munged paths themselves (eg. chroot,
|
|
||||||
hacked ld.so, whatever). */
|
|
||||||
if (personality(0x11) >= 0)
|
|
||||||
interp_prefix = "";
|
|
||||||
|
|
||||||
loglevel = 0;
|
loglevel = 0;
|
||||||
optind = 1;
|
optind = 1;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
@ -423,7 +424,7 @@ int main(int argc, char **argv)
|
||||||
logfile = fopen(DEBUG_LOGFILE, "w");
|
logfile = fopen(DEBUG_LOGFILE, "w");
|
||||||
if (!logfile) {
|
if (!logfile) {
|
||||||
perror(DEBUG_LOGFILE);
|
perror(DEBUG_LOGFILE);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
setvbuf(logfile, NULL, _IOLBF, 0);
|
setvbuf(logfile, NULL, _IOLBF, 0);
|
||||||
}
|
}
|
||||||
|
@ -434,9 +435,12 @@ int main(int argc, char **argv)
|
||||||
/* Zero out image_info */
|
/* Zero out image_info */
|
||||||
memset(info, 0, sizeof(struct image_info));
|
memset(info, 0, sizeof(struct image_info));
|
||||||
|
|
||||||
if(elf_exec(interp_prefix, filename, argv+optind, environ, regs, info) != 0) {
|
/* Scan interp_prefix dir for replacement files. */
|
||||||
|
init_paths(interp_prefix);
|
||||||
|
|
||||||
|
if (elf_exec(filename, argv+optind, environ, regs, info) != 0) {
|
||||||
printf("Error loading %s\n", filename);
|
printf("Error loading %s\n", filename);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loglevel) {
|
if (loglevel) {
|
||||||
|
|
Loading…
Reference in New Issue