Discussion:
Any future plans on existing sparc64 port?
Artem Falcon
2014-02-16 06:31:46 UTC
Permalink
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?
Lionel Cons
2014-02-16 14:36:55 UTC
Permalink
Post by Artem Falcon
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
http://permalink.gmane.org/gmane.comp.compilers.pcc/2594
% 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
--- 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));
/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
University of California. All rights reserved.\012,#object
University of California. All rights reserved.\012,99
...
--- 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.
1) chio.c, line 423: compiler error: Coalesce: src class 1, dst class 4
2) chmod.c, line 282: compiler error: getlr: free node
: 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?
_______________________________________________
Pcc mailing list
http://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
Yes, there is interest from our side, but first pcc must get into a
state where a simple application like a prime number generator (like
[http://www.programmingsimplified.com/c/source-code/c-program-for-prime-number])
works so we can work from there.

Lionel
Anders Magnusson
2014-02-20 11:51:24 UTC
Permalink
Hi,
Post by Artem Falcon
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
http://permalink.gmane.org/gmane.comp.compilers.pcc/2594
% 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
--- 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));
/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
University of California. All rights reserved.\012,#object
University of California. All rights reserved.\012,99
...
This was really odd, something is calling the wrong subroutine somewhere
I assume
Post by Artem Falcon
--- 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.
1) chio.c, line 423: compiler error: Coalesce: src class 1, dst class 4
2) chmod.c, line 282: compiler error: getlr: free node
: 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?
Not in the near future unfortunalely, unless someone steps up and want
to fix it. I myself is unfortunately really behind when it comes to
pcc, and have never been looking at the sparc architecture.

Note that these faults you show are usually quite simple to fix if you
know the architecture.

-- Ragge
Artem Falcon
2014-02-20 13:06:27 UTC
Permalink
Hi,
Post by Artem Falcon
...
% as -v
GNU assembler version 2.15
% cc -S domainname.c
% cat domainname.s
. section .rodata
University of California. All rights reserved.\012,#object
University of California. All rights reserved.\012,99
...
This was really odd, something is calling the wrong subroutine somewhere I assume
Post by Artem Falcon
So my questions are: any plans to revive the sparc64 port and is it
hard to eliminate these remaining (maybe more to come) issues?
Not in the near future unfortunalely, unless someone steps up and want to fix it. I myself is unfortunately really behind when it comes to pcc, and have never been looking at the sparc architecture.
Note that these faults you show are usually quite simple to fix if you know the architecture.
-- Ragge
Thanks guys! I’ll also wait for a response from David Crawshaw.
Seems he was the only person behind sparc support in pcc.

--
dukzcry
David Crawshaw
2014-03-24 21:39:01 UTC
Permalink
Sorry, I'm not planning to work on it any more.
Post by Artem Falcon
Hi,
Post by Artem Falcon
...
% as -v
GNU assembler version 2.15
% cc -S domainname.c
% cat domainname.s
. section .rodata
University of California. All rights reserved.\012,#object
University of California. All rights reserved.\012,99
...
This was really odd, something is calling the wrong subroutine somewhere I assume
Post by Artem Falcon
So my questions are: any plans to revive the sparc64 port and is it
hard to eliminate these remaining (maybe more to come) issues?
Not in the near future unfortunalely, unless someone steps up and want to fix it. I myself is unfortunately really behind when it comes to pcc, and have never been looking at the sparc architecture.
Note that these faults you show are usually quite simple to fix if you know the architecture.
-- Ragge
Thanks guys! I’ll also wait for a response from David Crawshaw.
Seems he was the only person behind sparc support in pcc.
--
dukzcry
Loading...