[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    [Pcc] Snippet to compile pcc via tcc
From:       Steffen Nurpmeso <steffen () sdaoden ! eu>
Date:       2017-10-04 19:49:24
Message-ID: 20171004194924.ai6Wt%steffen () sdaoden ! eu
[Download RAW message or body]

Hello.

With the attached diff it becomes possible to compile pcc with the
Tiny C Compiler (on amd64), maybe this is something you want to
consider?

Ciao!

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

["pcc-via-tcc.diff" (text/x-diff)]

diff --git a/arch/amd64/local2.c b/arch/amd64/local2.c
index fb50983..a15fb47 100644
--- a/arch/amd64/local2.c
+++ b/arch/amd64/local2.c
@@ -41,7 +41,7 @@ deflab(int label)
 
 static int regoff[MAXREGS];
 static TWORD ftype;
-char *rbyte[], *rshort[], *rlong[];
+char const * const rbyte[16], * const rshort[16], * const rlong[16];
 static int needframe;
 
 /*
@@ -667,7 +667,7 @@ void
 adrput(FILE *io, NODE *p)
 {
 	int r;
-	char **rc;
+	char const * const *rc;
 	/* output an address, with offsets, from p */
 
 	switch (p->n_op) {
@@ -926,15 +926,15 @@ char *rnames[MAXREGS] = {
 };
 
 /* register names for shorter sizes */
-char *rbyte[] = {
+char const * const rbyte[16] = {
 	"%al", "%dl", "%cl", "%bl", "%sil", "%dil", "%bpl", "%spl",
 	"%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b", 
 };
-char *rshort[] = {
+char const * const rshort[16] = {
 	"%ax", "%dx", "%cx", "%bx", "%si", "%di", "%bp", "%sp",
 	"%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w", 
 };
-char *rlong[] = {
+char const * const rlong[16] = {
 	"%eax", "%edx", "%ecx", "%ebx", "%esi", "%edi", "%ebp", "%esp",
 	"%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d", 
 };

[Attachment #4 (text/plain)]

_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic