shithub: scc

Download patch

ref: c3b9a7407da63336ba06d617eefab16e82aa7c5b
parent: 827299db4eab543b94db5bc5137b3ebb1e5ec31e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun May 30 14:12:03 EDT 2021

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.

--- a/src/cmd/cc/cc2/Makefile
+++ b/src/cmd/cc/cc2/Makefile
@@ -16,9 +16,10 @@
 
 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)
 
--- 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 uint64type = {
 	.flags  = INTF,
 	.size   = 8,
-	.align  = 2
+	.align  = 8
 };
 
 Type ptrtype = {
--- a/src/cmd/cc/cc2/target/arm64-sysv/types.c
+++ b/src/cmd/cc/cc2/target/arm64-sysv/types.c
@@ -1,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
+};
--- 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 @@
         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 $@