[COMMIT osv-apps master] native-example: add statically linked executables

3 views
Skip to first unread message

Commit Bot

unread,
Jan 9, 2024, 7:56:23 PM1/9/24
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

native-example: add statically linked executables

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/native-example/Makefile b/native-example/Makefile
--- a/native-example/Makefile
+++ b/native-example/Makefile
@@ -1,10 +1,16 @@
.PHONY: module
-module: hello
+module: hello hello-static-pie hello-static-non-pie

CFLAGS = -std=gnu99 -fpie -rdynamic

hello: hello.c
$(CC) -pie -o $@ $(CFLAGS) $(LDFLAGS) hello.c

+hello-static-pie: hello.c
+ $(CC) -fPIE -static-pie -o hello-static-pie hello.c
+
+hello-static-non-pie: hello.c
+ $(CC) -static -o hello-static-non-pie hello.c
+
clean:
- rm -f hello
+ rm -f hello hello-static-pie hello-static-non-pie
diff --git a/native-example/usr.manifest b/native-example/usr.manifest
--- a/native-example/usr.manifest
+++ b/native-example/usr.manifest
@@ -1 +1,3 @@
/hello: ${MODULE_DIR}/hello
+/hello-static-pie: ${MODULE_DIR}/hello-static-pie
+/hello-static-non-pie: ${MODULE_DIR}/hello-static-non-pie
Reply all
Reply to author
Forward
0 new messages