scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit cbdbca36e443913fefb45f11065e92f7f3d490be
parent e82dec18e190a3b7f99f033e4487d02ab407e26f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 30 May 2021 18:12:03 +0200

cc2: Fix target generation

There were several targets that were not generated,
and in the case of two of them the type definition
was wrong. This patch solves both problems.

Diffstat:
Msrc/cmd/cc/cc2/Makefile | 5+++--
Msrc/cmd/cc/cc2/target/amd64-sysv/types.c | 2+-
Msrc/cmd/cc/cc2/target/arm64-sysv/types.c | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/cmd/cc/cc2/target/qbe_arm64-sysv/target.mk | 3+++
4 files changed, 99 insertions(+), 3 deletions(-)

diff --git a/src/cmd/cc/cc2/Makefile b/src/cmd/cc/cc2/Makefile @@ -16,9 +16,10 @@ OBJS =\ TARGET =\ $(LIBEXEC)/scc/cc2-amd64-sysv\ - $(LIBEXEC)/scc//cc2-i386-sysv\ + $(LIBEXEC)/scc/cc2-i386-sysv\ $(LIBEXEC)/scc/cc2-qbe_amd64-sysv\ - $(LIBEXEC)/scc//cc2-z80-scc\ + $(LIBEXEC)/scc/cc2-qbe_arm64-sysv\ + $(LIBEXEC)/scc/cc2-z80-scc\ all: $(TARGET) diff --git a/src/cmd/cc/cc2/target/amd64-sysv/types.c b/src/cmd/cc/cc2/target/amd64-sysv/types.c @@ -48,7 +48,7 @@ Type uint32type = { Type uint64type = { .flags = INTF, .size = 8, - .align = 2 + .align = 8 }; Type ptrtype = { diff --git a/src/cmd/cc/cc2/target/arm64-sysv/types.c b/src/cmd/cc/cc2/target/arm64-sysv/types.c @@ -0,0 +1,92 @@ +#include <scc/scc.h> + +#include "../../cc2.h" + + +Type int8type = { + .flags = SIGNF | INTF, + .size = 1, + .align = 1 +}; + +Type int16type = { + .flags = SIGNF | INTF, + .size = 2, + .align = 2 +}; + +Type int32type = { + .flags = SIGNF | INTF, + .size = 4, + .align = 4 +}; + +Type int64type = { + .flags = SIGNF | INTF, + .size = 8, + .align = 8 +}; + +Type uint8type = { + .flags = INTF, + .size = 1, + .align = 1 +}; + +Type uint16type = { + .flags = INTF, + .size = 2, + .align = 2 +}; + +Type uint32type = { + .flags = INTF, + .size = 4, + .align = 4 +}; + +Type uint64type = { + .flags = INTF, + .size = 8, + .align = 8 +}; + +Type ptrtype = { + .flags = INTF, + .size = 8, + .align = 8 +}; + +Type booltype = { + .flags = INTF, + .size = 1, + .align = 1 +}; + +Type float32type = { + .flags = FLOATF, + .size = 4, + .align = 4 +}; + +Type float64type = { + .flags = FLOATF, + .size = 8, + .align = 8 +}; + +Type float80type = { + .flags = FLOATF, + .size = 16, + .align = 16 +}; + +Type voidtype = { + .size = 0, + .align = 0 +}; + +Type arg_type = { + .size = 24, + .align = 8 +}; diff --git a/src/cmd/cc/cc2/target/qbe_arm64-sysv/target.mk b/src/cmd/cc/cc2/target/qbe_arm64-sysv/target.mk @@ -3,3 +3,6 @@ OBJ-qbe_arm64-sysv = $(OBJS) \ target/qbe/optm.o \ target/qbe/code.o \ target/arm64-sysv/types.o \ + +$(LIBEXEC)/scc/cc2-qbe_arm64-sysv: $(LIBSCC) $(OBJ-qbe_arm64-sysv) + $(CC) $(PROJ_LDFLAGS) $(OBJ-qbe_arm64-sysv) -lscc -o $@