summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2018-10-16 18:20:58 +0000
committerkettenis <kettenis@openbsd.org>2018-10-16 18:20:58 +0000
commitbe332feb14a7223035c5ac7dee7d2c5f8314744b (patch)
treeda00c5d485f8aa9504161546c9dc8047623f17f3
parentAdd a test covering the recently fixed fcntl() panic. (diff)
downloadwireguard-openbsd-be332feb14a7223035c5ac7dee7d2c5f8314744b.tar.xz
wireguard-openbsd-be332feb14a7223035c5ac7dee7d2c5f8314744b.zip
Add linker script to assis lld with building something usable that doesn't
have a PT_GNU_STACK segment and doesn't pad the bootblocks to a full page. ok naddy@, help from guenther@
-rw-r--r--sys/arch/amd64/stand/biosboot/Makefile3
-rw-r--r--sys/arch/amd64/stand/biosboot/ld.script12
-rw-r--r--sys/arch/i386/stand/biosboot/Makefile3
-rw-r--r--sys/arch/i386/stand/biosboot/ld.script12
4 files changed, 28 insertions, 2 deletions
diff --git a/sys/arch/amd64/stand/biosboot/Makefile b/sys/arch/amd64/stand/biosboot/Makefile
index e1e8bdd03ce..be3cfddc1d3 100644
--- a/sys/arch/amd64/stand/biosboot/Makefile
+++ b/sys/arch/amd64/stand/biosboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.13 2017/10/17 19:31:56 naddy Exp $
+# $OpenBSD: Makefile,v 1.14 2018/10/16 18:20:58 kettenis Exp $
MAN= biosboot.8
@@ -10,6 +10,7 @@ PROG= biosboot
SRCS= biosboot.S
LD=ld
LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie -znorelro
+LDFLAGS+=-T ${.CURDIR}/ld.script
LDFLAGS+=-melf_i386 -L/usr/libdata
INSTALL_STRIP=
diff --git a/sys/arch/amd64/stand/biosboot/ld.script b/sys/arch/amd64/stand/biosboot/ld.script
new file mode 100644
index 00000000000..aa4fc0b260f
--- /dev/null
+++ b/sys/arch/amd64/stand/biosboot/ld.script
@@ -0,0 +1,12 @@
+PHDRS
+{
+ text PT_LOAD;
+}
+
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ } :text
+}
diff --git a/sys/arch/i386/stand/biosboot/Makefile b/sys/arch/i386/stand/biosboot/Makefile
index b27e546af8c..1553f3851f6 100644
--- a/sys/arch/i386/stand/biosboot/Makefile
+++ b/sys/arch/i386/stand/biosboot/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.29 2017/10/17 19:31:56 naddy Exp $
+# $OpenBSD: Makefile,v 1.30 2018/10/16 18:20:58 kettenis Exp $
MAN= biosboot.8
@@ -10,6 +10,7 @@ PROG= biosboot
SRCS= biosboot.S
LD=ld
LDFLAGS=-nostdlib -Ttext 0 -N -x -Bstatic -nopie -znorelro
+LDFLAGS+=-T ${.CURDIR}/ld.script
INSTALL_STRIP=
biosboot.o: assym.h
diff --git a/sys/arch/i386/stand/biosboot/ld.script b/sys/arch/i386/stand/biosboot/ld.script
new file mode 100644
index 00000000000..aa4fc0b260f
--- /dev/null
+++ b/sys/arch/i386/stand/biosboot/ld.script
@@ -0,0 +1,12 @@
+PHDRS
+{
+ text PT_LOAD;
+}
+
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ } :text
+}