Aharon Robbins
2014-04-17 06:50:54 UTC
Hello All.
I hope this reaches the list. I'm not subscribed - please cc me in any
relevant responses.
I am using x86_64 Ubuntu 12.04 Linux. I maintain GNU Awk (gawk) and
like to compile with different compilers. I recently decided to try pcc
and see if I was able to use it.
The good news is that with a minor patch, I am able to build the
gawk-4.1-stable branch and it passes all its tests. The less good news is
that one test produces different results on the master branch, where the
code works a little differently. Here are details and steps to reproduce.
First, in order to compile shared libraries, I needed to make the
following change. It's likely that this is quick and dirty and not "the"
correct way to do things, so a better fix will be welcome.
Index: cc/cc/cc.c
===================================================================
RCS file: /cvsroot/pcc/cc/cc/cc.c,v
retrieving revision 1.265
diff -u -r1.265 cc.c
--- cc/cc/cc.c 30 Mar 2014 18:06:14 -0000 1.265
+++ cc/cc/cc.c 17 Apr 2014 06:33:31 -0000
@@ -1809,15 +1809,19 @@
if (Bstatic) {
b = CRTBEGIN_T;
e = CRTEND_T;
+#ifndef __linux__
} else if (shared /* || pieflag */) {
b = CRTBEGIN_S;
e = CRTEND_S;
+#endif
} else {
b = CRTBEGIN;
e = CRTEND;
}
+#ifndef __linux__
strap(&middle_linker_flags, &crtdirs, b, 'p');
strap(&late_linker_flags, &crtdirs, e, 'a');
+#endif
strap(&middle_linker_flags, &crtdirs, CRTI, 'p');
strap(&late_linker_flags, &crtdirs, CRTN, 'a');
if (shared == 0) {
Next. To test on the stable branch:
git clone git://git.savannah.gnu.org/gawk.git
cd gawk
git checkout gawk-4.1-stable
./bootstrap.sh
./configure CC=pcc
find . -name Makefile | xargs grep -l export-dynamic | xargs vi
# Remove -export-dynamic from the LDFLAGS in all the Makefile files
# where it appears. (It'd be nice if pcc just passed flags it doesn't
# recognize on to the linker.)
make && make check
For me, all the tests pass. Now, to test on the master branch:
make distclean
git checkout master
./bootstrap.sh
./configure CC=pcc
find . -name Makefile | xargs grep -l export-dynamic | xargs vi
# Same song and dance
make && make check
Here, the "rand" test fails. The code in gawk that handles random
numbers changed between the stable and master branches; see the do_rand()
function in builtin.c.
I would like to comment that it's great to see PCC revived and functioning.
The compile time difference over GCC and clang is quite noticable. I hope
this report is of use to furthering PCC development.
Thanks,
Arnold Robbins
I hope this reaches the list. I'm not subscribed - please cc me in any
relevant responses.
I am using x86_64 Ubuntu 12.04 Linux. I maintain GNU Awk (gawk) and
like to compile with different compilers. I recently decided to try pcc
and see if I was able to use it.
The good news is that with a minor patch, I am able to build the
gawk-4.1-stable branch and it passes all its tests. The less good news is
that one test produces different results on the master branch, where the
code works a little differently. Here are details and steps to reproduce.
First, in order to compile shared libraries, I needed to make the
following change. It's likely that this is quick and dirty and not "the"
correct way to do things, so a better fix will be welcome.
Index: cc/cc/cc.c
===================================================================
RCS file: /cvsroot/pcc/cc/cc/cc.c,v
retrieving revision 1.265
diff -u -r1.265 cc.c
--- cc/cc/cc.c 30 Mar 2014 18:06:14 -0000 1.265
+++ cc/cc/cc.c 17 Apr 2014 06:33:31 -0000
@@ -1809,15 +1809,19 @@
if (Bstatic) {
b = CRTBEGIN_T;
e = CRTEND_T;
+#ifndef __linux__
} else if (shared /* || pieflag */) {
b = CRTBEGIN_S;
e = CRTEND_S;
+#endif
} else {
b = CRTBEGIN;
e = CRTEND;
}
+#ifndef __linux__
strap(&middle_linker_flags, &crtdirs, b, 'p');
strap(&late_linker_flags, &crtdirs, e, 'a');
+#endif
strap(&middle_linker_flags, &crtdirs, CRTI, 'p');
strap(&late_linker_flags, &crtdirs, CRTN, 'a');
if (shared == 0) {
Next. To test on the stable branch:
git clone git://git.savannah.gnu.org/gawk.git
cd gawk
git checkout gawk-4.1-stable
./bootstrap.sh
./configure CC=pcc
find . -name Makefile | xargs grep -l export-dynamic | xargs vi
# Remove -export-dynamic from the LDFLAGS in all the Makefile files
# where it appears. (It'd be nice if pcc just passed flags it doesn't
# recognize on to the linker.)
make && make check
For me, all the tests pass. Now, to test on the master branch:
make distclean
git checkout master
./bootstrap.sh
./configure CC=pcc
find . -name Makefile | xargs grep -l export-dynamic | xargs vi
# Same song and dance
make && make check
Here, the "rand" test fails. The code in gawk that handles random
numbers changed between the stable and master branches; see the do_rand()
function in builtin.c.
I would like to comment that it's great to see PCC revived and functioning.
The compile time difference over GCC and clang is quite noticable. I hope
this report is of use to furthering PCC development.
Thanks,
Arnold Robbins