commit 1e0f1124de63a6ef2e30314484fca2e2f60da4ad
parent 783ac157e892d418efb54c7c3b4e76e2330f65d9
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 12 May 2026 12:55:38 +0200
build: Continue with the migration to scc
This commits continue with the migration to use scc for the libc
and for the tests. It also means removing the gcc-scc tool that
used to be used to test the libc before scc was able to complie it.
In case of being needed it can be recovered from the history.
Diffstat:
6 files changed, 12 insertions(+), 112 deletions(-)
diff --git a/src/libc/Makefile b/src/libc/Makefile
@@ -24,8 +24,5 @@ all: $(DIRS)
+@$(MAKE) $(TARGET)
$(LIBC): $(OBJS)
- $(AR) $(PROJ_ARFLAGS) $(LIBC) $?
- $(RL) $(PROJ_RLFLAGS) $(LIBC)
-
-$(BINDIR)/gcc-scc: gcc-scc.sh
- cp gcc-scc.sh $@
+ $(AR) $(ARFLAGS) $(LIBC) $?
+ $(RL) $(RLFLAGS) $(LIBC)
diff --git a/src/libc/gcc-scc.sh b/src/libc/gcc-scc.sh
@@ -1,89 +0,0 @@
-#!/bin/sh
-
-set -e
-
-while getopts gr:O:a:s:o:c o
-do
- case $o in
- g)
- g=-g
- ;;
- O)
- opti=-O1
- ;;
- r)
- root=$OPTARG
- ;;
- a)
- abi=$OPTARG
- ;;
- s)
- sys=$OPTARG
- ;;
- o)
- out=$OPTARG
- ;;
- c)
- onlycc=1
- ;;
- *)
- echo >&2 "usage: gcc-scc [-o outfile] [-c] [-r root] [-a abi] [-s sys] file"
- exit 1
- ;;
- esac
-done
-shift $((OPTIND-1))
-
-sys=${sys:-`uname | tr 'A-Z' 'a-z'`}
-abi=${abi:-amd64}
-out=${out:-a.out}
-root=${root:-${SCCPREFIX:-`dirname $0`/..}}
-inc=$root/include/scc
-arch_inc=$inc/bits/$abi
-sys_inc=$inc/bits/$sys
-sys_arch_inc=$inc/bits/$sys/$abi
-lib=$root/lib/scc/${abi}-${sys}
-crt=$root/lib/scc/${abi}-${sys}/crt.o
-obj=${1%.c}.o
-cc=${CROSS_COMPILE}cc
-ld=${CROSS_COMPILE}ld
-
-case `uname` in
-OpenBSD)
- nopie=-no-pie
- ;;
-esac
-
-includes="-nostdinc -I$inc -I$arch_inc -I$sys_inc -I$sys_arch_inc"
-cflags="$opti -std=c99 -w -fno-pie -fno-stack-protector -ffreestanding -static"
-ldflags="-z nodefaultlib -static -L$lib"
-
-if test ${onlycc:-0} -eq 1
-then
- $cc $cflags $includes -c "$@"
-else
- for i
- do
- case $i in
- *.c)
- $cc $g $cflags $includes -c "$i"
- ;;
- esac
- done
-
- # convert *.c args to *.o while correctly maintaing IFS chars
- for i
- do
- shift
- case $i in
- *.c)
- set -- "$@" "${i%c}o"
- ;;
- *)
- set -- "$@" "$i"
- ;;
- esac
- done
-
- $ld $g $ldflags $nopie $crt "$@" -lc -lcrt -o "$out"
-fi
diff --git a/src/libc/rules.mk b/src/libc/rules.mk
@@ -1,12 +1,4 @@
-CPPINCLUDES =\
- -I$(INCDIR)\
- -I$(INCDIR)/bits/$(SYS)\
- -I$(INCDIR)/bits/$(ARCH)\
- -I$(INCDIR)/bits/$(SYS)/$(ARCH)\
-
-MORE_ARFLAGS = -u
-MORE_CFLAGS = $(TOOL_LIBC_CFLAGS) $(NOPIE_CFLAGS)
-CC=$(SCC)
+CC = $(SCC) -t $(SYS) -a $(ARCH)
AR=$(SCC_AR)
RANLIB=$(SCC_RANLIB)
@@ -23,7 +15,7 @@ _sys_errlist.c: $(SYSERRNO)
../../mkerrstr $(SYSERRNO)
_sys_errlist.$O: _sys_errlist.c
- $(CC) $(PROJ_CFLAGS) -c -o $@ _sys_errlist.c
+ $(CC) $(CFLAGS) -c -o $@ _sys_errlist.c
$(CRT): crt.$O
cp crt.$O $@
@@ -34,7 +26,7 @@ clean-libc: FORCE
rm -f *.5? *.6? *.7? *.8? *.z *.q
.c.$O:
- $(CC) $(PROJ_CFLAGS) -o $@ -c $<
+ $(CC) $(CFLAGS) -o $@ -c $<
.s.$O:
$(AS) $(PROJ_ASFLAGS) $< -o $@
diff --git a/tests/cc/error/Makefile b/tests/cc/error/Makefile
@@ -1,8 +1,9 @@
.POSIX:
-ROOT=../../..
-SCCPREFIX=$(ROOT)
-CC=$(EXEC) $(ROOT)/bin/scc cc
+PROJECTDIR = ../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+CC=$(SCC)
all:
@CC='$(CC)' ./runtests.sh scc-tests.lst
diff --git a/tests/cc/execute/Makefile b/tests/cc/execute/Makefile
@@ -3,8 +3,10 @@
PROJECTDIR = ../../..
include $(PROJECTDIR)/scripts/rules.mk
-CC=$(SCC)
+CC=$(BINDIR)/scc
PROJ_CFLAGS = $(CFLAGS)
+PROJ_LDFLAGS= $(LDFLAGS)
+PROJ_LDLIBS =
all:
@CC='$(CC)' ./runtests.sh scc-tests.lst
diff --git a/tests/libc/execute/Makefile b/tests/libc/execute/Makefile
@@ -7,9 +7,6 @@ PROJ_CFLAGS = $(CFLAGS)
PROJ_LDFLAGS = $(LDFLAGS)
CC=$(SCC)
-# Uncomment following line to use gcc to test the libc
-# CC = $(BINDIR)/gcc-scc
-
all:
@CC='$(CC)' \
CFLAGS='$(PROJ_CFLAGS)' \