Forráskód Böngészése

loader: use dynamic loading of libBB.so by default, because compile-time link method not works in Ubuntu (initialization section of library not executes on program start)

Alexander Shiryaev 12 éve
szülő
commit
39e5778a94

+ 5 - 5
BlackBox/Linux/Lin/Rsrc/loader/Makefile

@@ -4,18 +4,18 @@
 # ${.ALLSRC}    $^
 # ${.IMPSRC}    $<
 
-all: lindev BlackBox BlackBox-dl
+all: lindev BlackBox
 
 CFLAGS += -Wall -O0 -g -m32
 
-BlackBox: BlackBox.c
-	${CC} ${CFLAGS} -o $@ $^ -L. -lBB
+#BlackBox: BlackBox.c
+#	${CC} ${CFLAGS} -o $@ $^ -L. -lBB
 
-BlackBox-dl: BlackBox-dl.c
+BlackBox: BlackBox-dl.c
 	${CC} ${CFLAGS} -o $@ $^ -ldl
 
 lindev: BlackBox1.c
 	${CC} ${CFLAGS} -o $@ $^ -L . -lBB0
 
 clean:
-	rm -f lindev BlackBox BlackBox-dl
+	rm -f lindev BlackBox

+ 6 - 1
BlackBox/OpenBSD/Lin/Rsrc/loader/BlackBox-dl.c

@@ -4,13 +4,16 @@
 int main (int argc, char *argv[])
 {
 	void * h;
+	/*
 	void * h1;
 	void (*SetKernelBaseStack) (int);
 	void (*Init) (void);
+	*/
 	int res;
 
 	h = dlopen("libBB.so", RTLD_LAZY | RTLD_GLOBAL);
-	if (h == NULL) {
+	if (h != NULL) {
+		/*
 		h1 = dlsym(h, "SetKernelBaseStack");
 		if (h1 != NULL) {
 			*(void **) (&SetKernelBaseStack) = h1;
@@ -34,6 +37,8 @@ int main (int argc, char *argv[])
 			perror(dlerror());
 			res = 2;
 		}
+		*/
+		res = 0;
 	} else {
 		perror(dlerror());
 		res = 1;

+ 6 - 5
BlackBox/OpenBSD/Lin/Rsrc/loader/Makefile

@@ -6,17 +6,18 @@
 
 CFLAGS += -Wall -O0 -g
 
-all: libdlobsdwrap.so lindev BlackBox BlackBox-dl
+all: libdlobsdwrap.so lindev BlackBox
 
 # libdlobsdwrap.so: universal method of correct access to dl* functions
 #	in case of dynamic loading of libBB*.so "ld.so" in LibDl may be used instead of "libc.so", but not in case of static linking
 #	wrapper method is universal
 
 # -pthread required to dlopen libraries that depends on pthread
-BlackBox: BlackBox.c
-	${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L. -lBB -pthread
 
-BlackBox-dl: BlackBox-dl.c
+#BlackBox: BlackBox.c
+#	${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -L. -lBB -pthread
+
+BlackBox: BlackBox-dl.c
 	${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -pthread
 
 lindev: BlackBox1.c
@@ -26,4 +27,4 @@ libdlobsdwrap.so: libdlobsdwrap.c
 	${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} -fPIC -shared
 
 clean:
-	rm -f lindev BlackBox BlackBox-dl libdlobsdwrap.so
+	rm -f lindev BlackBox libdlobsdwrap.so