aboutsummaryrefslogtreecommitdiffstats
path: root/dynlink-static.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-03-08 18:33:50 -0800
committerDavid 'Digit' Turner <digit@google.com>2010-03-08 18:33:50 -0800
commitab873b750621bca7eef41869c685dec8c363333a (patch)
tree94ea3d5e4634e4346280be35cd8ed80414a1b614 /dynlink-static.c
parent9a0f1fba0cacee05513653a553052e97e475b51c (diff)
downloadexternal_qemu-ab873b750621bca7eef41869c685dec8c363333a.zip
external_qemu-ab873b750621bca7eef41869c685dec8c363333a.tar.gz
external_qemu-ab873b750621bca7eef41869c685dec8c363333a.tar.bz2
Add --static option to android-configure.sh in order to build static emulator executable.
This is needed to run the emulator in restricted environment where libX11.so and even libstdc++.so are not available. Only tested on Linux. The resulting binary will not start unless you use -no-window. Also don't expect any audio output working. Change-Id: Ia736898cd3ae6eb928614a00a1a3e18cc8086a5c
Diffstat (limited to 'dynlink-static.c')
-rw-r--r--dynlink-static.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/dynlink-static.c b/dynlink-static.c
new file mode 100644
index 0000000..420f847
--- /dev/null
+++ b/dynlink-static.c
@@ -0,0 +1,49 @@
+/* Copyright (c) 2010 The Android Open Source Project
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* dummy dlopen()/dlclose()/dlsym() implementations to be used in static builds */
+#include <stddef.h>
+
+void* dlopen(void)
+{
+ /* Do not return NULL to route around a bug in our SDL configure script */
+ /* mimick succesful load, then all calls to dlsym/dlvsym will fail */
+ return (void*)"XXX";
+}
+
+void dlclose(void)
+{
+}
+
+void* dlsym(void)
+{
+ return NULL;
+}
+
+void* dlvsym(void)
+{
+ return NULL;
+}
+
+const char* dlerror(void)
+{
+ return "Dynamic linking not enabled !";
+}