Artem Falcon
2014-02-16 06:31:46 UTC
After the recent info that clang is now self-hosting on sparc64 platform
(http://www.phoronix.com/scan.php?page=news_item&px=MTU5MDE),
i've got an interest to check how well this target is supported by pcc.
% uname -ms
OpenBSD sparc64
% pcc -v
pcc 1.1.0.DEVEL -20130227- actually, it's a pcc-20140215 (also tested
pcc-1.0.0 with same hacks and result)
% gcc -v
gcc version 3.3.5 (propolice)
This is what i'm using for pcc building.
First, to make pcc compile, i've needed to add stub functions to the
arch/sparc64/code.c, like explained here:
http://permalink.gmane.org/gmane.comp.compilers.pcc/2594
Ok, now let's try to build something simple:
% cd /usr/src/bin/domainname
% make
cc -O2 -pipe -c domainname.c
domainname.c, line 74: compiler error: Cannot generate code, node
0x4f9108c0 op TEMP
From discussion with another person, Anders Magnusson says about
this: "The error above is probably because the table is missing an
OPLTYPE that moves a register value into another register for this
specific type."
Hmm, i'm not going to do a coding work now, and as this issue is
triggered by using of an optimization flag, let's just disable passing of
-xtemps argument to the actual compiler (ccom):
--- cc/ccom/cgram.y.orig
+++ cc/ccom/cgram.y
@@ -1667,7 +1667,9 @@ fundef(NODE *tp, NODE *p)
if (xtemps == 0) alwinl |= 2;
xtemps = 1;
}
+ else
#endif
+ xtemps = 0;
prolab = getlab();
if ((c = cftnsp->soname) == NULL)
c = addname(exname(cftnsp->sname));
Getting futher:
/tmp/ctm.Qzfipj: Assembler messages:
/tmp/ctm.Qzfipj:2: Error: unrecognized symbol type ""
/tmp/ctm.Qzfipj:2: Error: junk at end of line, first unrecognized
character is `('
/tmp/ctm.Qzfipj:3: Error: expected comma after name `' in .size
directive
...
% as -v
GNU assembler version 2.15
% cc -S domainname.c
% cat domainname.s
. section .rodata
.type @(#) Copyright (c) 1988, 1993\012\011The Regents of the
University of California. All rights reserved.\012,#object
.size @(#) Copyright (c) 1988, 1993\012\011The Regents of the
University of California. All rights reserved.\012,99
...
I'll handle it in a quick way:
--- sparc64/code.c.orig
+++ sparc64/code.c
@@ -56,11 +56,13 @@ defloc(struct symtab *sp)
if ((name = sp->soname) == NULL)
name = exname(sp->sname);
+#ifndef 0
if (!ISFTN(t)) {
printf("\t.type %s,#object\n", name);
printf("\t.size %s," CONFMT "\n", name,
tsize(sp->stype, sp->sdf, sp->sap) / SZCHAR);
}
+#endif
if (sp->sclass == EXTDEF)
printf("\t.global %s\n", name);
if (sp->slevel == 0) {
Now, simple programs are building and final binaries just work.
However, some programs raise few more issues:
1) chio.c, line 423: compiler error: Coalesce: src class 1, dst class 4
2) chmod.c, line 282: compiler error: getlr: free node
3) cp.o(.text+0xe74): In function `L693':
: relocation truncated to fit: R_SPARC_13 to
ld terminated with status 1
...
All programs i'm trying with are all tested for successful compilation
by pcc on i386 and amd64 targets under the same OS release.
So my questions are: any plans to revive the sparc64 port and is it
hard to eliminate these remaining (maybe more to come) issues?
(http://www.phoronix.com/scan.php?page=news_item&px=MTU5MDE),
i've got an interest to check how well this target is supported by pcc.
% uname -ms
OpenBSD sparc64
% pcc -v
pcc 1.1.0.DEVEL -20130227- actually, it's a pcc-20140215 (also tested
pcc-1.0.0 with same hacks and result)
% gcc -v
gcc version 3.3.5 (propolice)
This is what i'm using for pcc building.
First, to make pcc compile, i've needed to add stub functions to the
arch/sparc64/code.c, like explained here:
http://permalink.gmane.org/gmane.comp.compilers.pcc/2594
Ok, now let's try to build something simple:
% cd /usr/src/bin/domainname
% make
cc -O2 -pipe -c domainname.c
domainname.c, line 74: compiler error: Cannot generate code, node
0x4f9108c0 op TEMP
From discussion with another person, Anders Magnusson says about
this: "The error above is probably because the table is missing an
OPLTYPE that moves a register value into another register for this
specific type."
Hmm, i'm not going to do a coding work now, and as this issue is
triggered by using of an optimization flag, let's just disable passing of
-xtemps argument to the actual compiler (ccom):
--- cc/ccom/cgram.y.orig
+++ cc/ccom/cgram.y
@@ -1667,7 +1667,9 @@ fundef(NODE *tp, NODE *p)
if (xtemps == 0) alwinl |= 2;
xtemps = 1;
}
+ else
#endif
+ xtemps = 0;
prolab = getlab();
if ((c = cftnsp->soname) == NULL)
c = addname(exname(cftnsp->sname));
Getting futher:
/tmp/ctm.Qzfipj: Assembler messages:
/tmp/ctm.Qzfipj:2: Error: unrecognized symbol type ""
/tmp/ctm.Qzfipj:2: Error: junk at end of line, first unrecognized
character is `('
/tmp/ctm.Qzfipj:3: Error: expected comma after name `' in .size
directive
...
% as -v
GNU assembler version 2.15
% cc -S domainname.c
% cat domainname.s
. section .rodata
.type @(#) Copyright (c) 1988, 1993\012\011The Regents of the
University of California. All rights reserved.\012,#object
.size @(#) Copyright (c) 1988, 1993\012\011The Regents of the
University of California. All rights reserved.\012,99
...
I'll handle it in a quick way:
--- sparc64/code.c.orig
+++ sparc64/code.c
@@ -56,11 +56,13 @@ defloc(struct symtab *sp)
if ((name = sp->soname) == NULL)
name = exname(sp->sname);
+#ifndef 0
if (!ISFTN(t)) {
printf("\t.type %s,#object\n", name);
printf("\t.size %s," CONFMT "\n", name,
tsize(sp->stype, sp->sdf, sp->sap) / SZCHAR);
}
+#endif
if (sp->sclass == EXTDEF)
printf("\t.global %s\n", name);
if (sp->slevel == 0) {
Now, simple programs are building and final binaries just work.
However, some programs raise few more issues:
1) chio.c, line 423: compiler error: Coalesce: src class 1, dst class 4
2) chmod.c, line 282: compiler error: getlr: free node
3) cp.o(.text+0xe74): In function `L693':
: relocation truncated to fit: R_SPARC_13 to
ld terminated with status 1
...
All programs i'm trying with are all tested for successful compilation
by pcc on i386 and amd64 targets under the same OS release.
So my questions are: any plans to revive the sparc64 port and is it
hard to eliminate these remaining (maybe more to come) issues?