From: notaz Date: Sun, 10 Jan 2016 01:34:08 +0000 (+0200) Subject: fix missing syms in ginge_dyn X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=commitdiff_plain;h=d5a3e1bccc54036e8b659f22dc704fa257f5734d;hp=7868435641e4209e956a591ff0844afc14f83f16;ds=sidebyside fix missing syms in ginge_dyn --- diff --git a/loader/Makefile b/loader/Makefile index f326814..85c25ba 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -47,6 +47,7 @@ all: $(TARGET_S) $(TARGET_D) $(TARGET_S): LDFLAGS += -Wl,-T script_$(ARCH).lds $(TARGET_D): LDFLAGS += -ldl -Wl,--version-script=ginge_dyn.symver +$(TARGET_D): LDFLAGS += -Wl,--no-undefined $(TARGET_S): $(OBJ_S) $(CC) -o $@ $^ -static $(LDFLAGS) diff --git a/loader/host.c b/loader/host.c index a6c2856..796d980 100644 --- a/loader/host.c +++ b/loader/host.c @@ -26,6 +26,8 @@ #include "host_wiz.c" #endif +char **g_argv; + int host_init(void) { in_init(); @@ -54,11 +56,13 @@ void host_forced_exit(int status) printf("forced exit...\n"); - snprintf(cmd, sizeof(cmd), "killall %s", g_argv[0]); - system(cmd); - usleep(300000); - snprintf(cmd, sizeof(cmd), "killall -9 %s", g_argv[0]); - system(cmd); + if (g_argv != NULL) { + snprintf(cmd, sizeof(cmd), "killall %s", g_argv[0]); + system(cmd); + usleep(300000); + snprintf(cmd, sizeof(cmd), "killall -9 %s", g_argv[0]); + system(cmd); + } exit(status); } diff --git a/loader/override.c b/loader/override.c index 1e0d415..c5b0a09 100644 --- a/loader/override.c +++ b/loader/override.c @@ -282,6 +282,7 @@ static ssize_t w_readlink(const char *path, char *buf, size_t bufsiz) { long ret; +#ifndef DL if (path != NULL && strncmp(path, "/proc/", 6) == 0 && strcmp(strrchr(path, '/'), "/exe") == 0) { @@ -290,6 +291,7 @@ static ssize_t w_readlink(const char *path, char *buf, size_t bufsiz) ret = bufsiz; } else +#endif ret = g_readlink_raw(path, buf, bufsiz); strace("readlink(%s, %s, %zd) = %ld\n", path, buf, bufsiz, ret);