summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2017-01-21 00:46:32 +0000
committerguenther <guenther@openbsd.org>2017-01-21 00:46:32 +0000
commite5da831f0bb139a39089279765a481d828e4c0fa (patch)
treefdac3b9bdb43c78196e05bf433ced2fc92a3c2af
parentDeclare the symbols that label the .ctors, .dtors, .eh_frame, and .jcr (diff)
downloadwireguard-openbsd-e5da831f0bb139a39089279765a481d828e4c0fa.tar.xz
wireguard-openbsd-e5da831f0bb139a39089279765a481d828e4c0fa.zip
amd64 can build rcrt0.o with the stack-protector
ok kettenis@ deraadt@
-rw-r--r--lib/csu/Makefile13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/csu/Makefile b/lib/csu/Makefile
index 2fc81198fcd..3d689ef8e08 100644
--- a/lib/csu/Makefile
+++ b/lib/csu/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.25 2016/11/08 19:04:48 natano Exp $
+# $OpenBSD: Makefile,v 1.26 2017/01/21 00:46:32 guenther Exp $
OBJS= crt0.o gcrt0.o
OBJS+= crtbegin.o crtend.o
@@ -33,6 +33,13 @@ PICFLAG=
PICFLAG= -fPIC
.endif
+RCFLAGS=-DRCRT0
+# amd64 can access the stack protector before relocation has occurred.
+# Other archs aren't so lucky
+.if ${MACHINE_ARCH} != "amd64"
+RCFLAGS+=-fno-stack-protector
+.endif
+
all: ${OBJS}
crt0.o: crt0.c
@@ -48,8 +55,8 @@ gcrt0.o: crt0.c
@rm -f ${.TARGET}.o
rcrt0.o: crt0.c
- @echo ${COMPILE.c} -DRCRT0 -fno-stack-protector ${.CURDIR}/crt0.c -o ${.TARGET}
- @${COMPILE.c} -DRCRT0 -fno-stack-protector ${.CURDIR}/crt0.c -o ${.TARGET}.o
+ @echo ${COMPILE.c} ${RCFLAGS} ${.CURDIR}/crt0.c -o ${.TARGET}
+ @${COMPILE.c} ${RCFLAGS} ${.CURDIR}/crt0.c -o ${.TARGET}.o
@${LD} -x -r -o ${.TARGET} ${.TARGET}.o
@rm -f ${.TARGET}.o