aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in3
-rw-r--r--conf/user-link.ld27
-rw-r--r--usr.sbin/sbin.mk3
3 files changed, 31 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in
index 37f1e98..d5893c5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -27,7 +27,8 @@ endif
override AS = $(CC)
override USRDIR=$(shell pwd)/base/usr/
override LIBC = libc.a
-override USER_MKFLGS = CC=$(CC) LD=$(LD) LIBC=$(LIBC) USRDIR=$(USRDIR)
+override USER_LDSCRIPT = $(shell pwd)/conf/user-link.ld
+override USER_MKFLGS = LDSCRIPT=$(USER_LDSCRIPT) CC=$(CC) LD=$(LD) LIBC=$(LIBC) USRDIR=$(USRDIR)
##########################
# Architecture specifics
diff --git a/conf/user-link.ld b/conf/user-link.ld
new file mode 100644
index 0000000..9bbe6ae
--- /dev/null
+++ b/conf/user-link.ld
@@ -0,0 +1,27 @@
+ENTRY(_start)
+
+SECTIONS
+{
+ . = 0x10000;
+
+ .text :
+ {
+ *(.text)
+ *(.text.*)
+ }
+
+ .data : ALIGN(8)
+ {
+ *(.data)
+ *(.data.*)
+ }
+
+ .bss : ALIGN(8)
+ {
+ __bss_start = .;
+ *(.bss)
+ *(.bss.*)
+ __bss_end = .;
+ }
+}
+
diff --git a/usr.sbin/sbin.mk b/usr.sbin/sbin.mk
index 763e6ec..a7a7bb9 100644
--- a/usr.sbin/sbin.mk
+++ b/usr.sbin/sbin.mk
@@ -1,4 +1,5 @@
CC =
LIBDIR =
USRDIR =
-INTERNAL_CFLAGS = -znoexecstack -nostdlib -I$(USRDIR)/include/ $(USRDIR)/lib/libc.a
+LDSCRIPT =
+INTERNAL_CFLAGS = -T$(LDSCRIPT) -znoexecstack -nostdlib -I$(USRDIR)/include/ $(USRDIR)/lib/libc.a