aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-06 19:46:41 -0400
committerIan Moffett <ian@osmora.org>2024-04-06 19:48:10 -0400
commit8370d0a3eb373c37386de32ccd3a8a38ddeb8b02 (patch)
tree2f390a0f8206c8dca80362dd49b01ef3ecec1fc2 /usr.sbin
parenteccaaf54d8e5ab90ed0cf9dd3be8204e35115692 (diff)
build: Statically link libc
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/Makefile5
-rw-r--r--usr.sbin/init/Makefile7
-rw-r--r--usr.sbin/init/main.c5
-rw-r--r--usr.sbin/sbin.mk4
4 files changed, 12 insertions, 9 deletions
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index c75ebd0..30e7248 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -1,7 +1,8 @@
CC =
LD =
-LDSO =
+LIBC =
+USRDIR =
.PHONY: all
all:
- cd init/; make LDSO=$(LDSO) CC=$(CC) LD=$(LD)
+ cd init/; make CC=$(CC) USRDIR=$(USRDIR) LIBC=$(LIBC)
diff --git a/usr.sbin/init/Makefile b/usr.sbin/init/Makefile
index a7af644..13ac173 100644
--- a/usr.sbin/init/Makefile
+++ b/usr.sbin/init/Makefile
@@ -1,7 +1,6 @@
-CC =
-LD =
-LDSO =
+include ../sbin.mk
.PHONY: all
all:
- $(CC) -pie -nostdlib main.c -o init -e main
+ @ # $(CC) -pie -nostdlib main.c -o init -e main
+ $(CC) main.c -o init $(INTERNAL_CFLAGS)
diff --git a/usr.sbin/init/main.c b/usr.sbin/init/main.c
index af62d76..e840c8e 100644
--- a/usr.sbin/init/main.c
+++ b/usr.sbin/init/main.c
@@ -1,6 +1,5 @@
int
-main(void)
+main(int argc, char **argv)
{
- /* Do nothing */
- while (1);
+ return 0;
}
diff --git a/usr.sbin/sbin.mk b/usr.sbin/sbin.mk
new file mode 100644
index 0000000..763e6ec
--- /dev/null
+++ b/usr.sbin/sbin.mk
@@ -0,0 +1,4 @@
+CC =
+LIBDIR =
+USRDIR =
+INTERNAL_CFLAGS = -znoexecstack -nostdlib -I$(USRDIR)/include/ $(USRDIR)/lib/libc.a