--- qemu/linux-user/main.c	2004-10-09 20:08:01.000000000 +0200
+++ qemu-ldpath/linux-user/main.c	2004-11-02 22:15:49.000000000 +0100
@@ -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);
