LD_LIBRARY_PATH for linux-user client application
PATCH 1/1 LD_LIBRARY_PATH for linux-user client application
Hi!
I've successfully managed to get IDA Pro 4.7 Linux/x86 running on my Linux/PPC Powerbook wit qemu-i386. It's running stable, I am amazed :)
Unfortunately I had to make a small modification to qemu (see attached patch) in order to allow specification of a x86-specific LD_LIBRARY_PATH.
If I set the real LD_LIBRARY_PATH on the host system, qemu won't work anymore, since it already respects this path.
I think either this patch, or a more generic mechanism for passing a user-defined enviroment to the client program inside the emulation is a generally useful thing and should be considered for inclusion into qemu.
Cheers,
Harald
Signature · 3 lines
- Harald Welte <[email protected]> http://www.gnumonks.org/ ============================================================================ Programming is like sex: One mistake and you have to support it your lifetime
linux-user/main.c +15 -0
@@ -1015,6 +1015,21 @@qemu_host_page_size */ env =cpu_init (); + { +#define QLDP "QEMU_LD_LIBRARY_PATH" +#define LDP "LD_LIBRARY_PATH" +char *qldp =getenv (QLDP ); +if (qldp &&strlen (qldp) >=strlen (QLDP )+1 ) { +int size =strlen (qldp) +strlen (LDP ); +char *ldp =malloc (size); +if (ldp) { +sprintf (ldp,"%s=%s" ,LDP , qldp); +fprintf (stderr,"LDP=`%s'\n" , ldp); +putenv (ldp); + } + } + } +if (elf_exec (filename, argv+optind, environ, regs, info) !=0 ) {printf ("Error loading %s\n" , filename);_exit (1 );