aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-04-11 00:13:41 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-04-11 00:13:41 +0000
commit74cd30b811cc2fe4b376bc1c0fa2cf48810d5103 (patch)
treed33082c8c8bf3bba62c029506d3f76287011910f /linux-user
parent7fb9a24e3925cecc4b6e4a47a27c2caba077b2f6 (diff)
RH9 fix - path patch
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@93 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/main.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 0c8480dff9..5c1dd8ce9f 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -23,9 +23,6 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)
-#include <sys/personality.h>
-#endif
#include "qemu.h"
@@ -35,12 +32,22 @@
FILE *logfile = NULL;
int loglevel;
-const char *interp_prefix = CONFIG_QEMU_PREFIX "/qemu-i386";
+static const char *interp_prefix = CONFIG_QEMU_PREFIX;
#ifdef __i386__
/* 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";
+
+/* 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
/* XXX: on x86 MAP_GROWSDOWN only works if ESP <= address + 32, so
@@ -358,7 +365,7 @@ void usage(void)
DEBUG_LOGFILE,
interp_prefix,
x86_stack_size);
- exit(1);
+ _exit(1);
}
/* XXX: currently only used for async signals (see signal.c) */
@@ -379,12 +386,6 @@ int main(int argc, char **argv)
if (argc <= 1)
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;
optind = 1;
for(;;) {
@@ -423,7 +424,7 @@ int main(int argc, char **argv)
logfile = fopen(DEBUG_LOGFILE, "w");
if (!logfile) {
perror(DEBUG_LOGFILE);
- exit(1);
+ _exit(1);
}
setvbuf(logfile, NULL, _IOLBF, 0);
}
@@ -434,9 +435,12 @@ int main(int argc, char **argv)
/* Zero out 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);
- exit(1);
+ _exit(1);
}
if (loglevel) {