shithub: scc

Download patch

ref: 026883187f7ab4fd337ebd4d82a0a8b2797129c1
parent: ad9ac13a7fdef7f29cae041c7556f8dacd239958
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 31 03:40:19 EDT 2018

Disable stack protector in OpenBSD

This option is enabled by default in OpenBSD and it
generates problems with our crts because it expects
some symbols to be defined. We don't need the stack
protector because this is only a first step to test
the library with gcc and being sure that it is
correct before testing it with scc.

--- a/lib/c/target/amd64-sysv-openbsd/Makefile
+++ b/lib/c/target/amd64-sysv-openbsd/Makefile
@@ -3,8 +3,8 @@
 PROJECTDIR = ../../../..
 include $(PROJECTDIR)/rules.mk
 
-SYSNAME    = amd64-sysv-netbsd
-SCC_CFLAGS = -static -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/ -I.
+SYSNAME    = amd64-sysv-openbsd
+SCC_CFLAGS = -fno-stack-protector -static -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/ -I.
 SYSOBJ     = raise.o signal.o _setcontext.o _sigaction.o _sigaction2.o
 
 include syscall.mk
--- a/lib/crt/amd64-sysv-openbsd/crt.s
+++ b/lib/crt/amd64-sysv-openbsd/crt.s
@@ -16,8 +16,3 @@
 	call	main
 	movl    %eax, %edi
 	jmp	exit
-
-	.data
-	.global	__guard_local
-__guard_local:
-	.long	0
--- a/tests/libc/execute/cc.sh
+++ b/tests/libc/execute/cc.sh
@@ -32,5 +32,5 @@
 lib=$root/lib/scc/${abi}-${sys}
 obj=${1%.c}.o
 
-c99 -nostdinc -I$inc -I$arch_inc -c $1
+gcc -fno-stack-protector -std=c99 -static -nostdinc -I$inc -I$arch_inc -c $1
 ld -z nodefaultlib -static -L$lib $lib/crt.o $obj -lc