mass rename and rebranding from xwt to ibex - fixed to use ixt files
[org.ibex.core.git] / src / org / ibex / plat / Linux.cc
diff --git a/src/org/ibex/plat/Linux.cc b/src/org/ibex/plat/Linux.cc
new file mode 100644 (file)
index 0000000..9a9e324
--- /dev/null
@@ -0,0 +1,21 @@
+#include <stdint.h>
+#include "X11.cc"
+
+#include <org/ibex/plat/Linux.h>
+
+// we love libgcj!
+extern const char **_Jv_argv;
+extern int _Jv_argc;
+
+void org::ibex::plat::Linux::fixEnvironment() {
+    // see http://lists.debian.org/debian-glibc/2003/debian-glibc-200311/msg00647.html
+    const char* ld_assume_kernel = getenv("LD_ASSUME_KERNEL");
+    if (ld_assume_kernel == NULL || strcmp("2.4.1", ld_assume_kernel)) {
+        int result;
+        printf("respawning self (%s) with LD_ASSUME_KERNEL=2.4.1\n", _Jv_argv[0]);
+        setenv("LD_ASSUME_KERNEL", "2.4.1", 1);
+        result = execvp(_Jv_argv[0], (char* const*)((void*)_Jv_argv));
+        printf("execvp() failed with error code %d\n", result);
+       exit(-1);
+    }
+}