Discussion:
trying to compile gcc with pcc
u***@aetey.se
2014-08-17 17:27:37 UTC
Permalink
On Linux x86_64 with static uclibc and musl from 2014-05-15,
trying to compile gcc 4.2.3:
(btw, 4.2.3 is the last gcc version under GPLv2, contrary to what
Wikipedia says)

------------------------------------------------------
...
make[3]: Entering directory `[XXXXXXXX]/objdir/gcc'
...
pcc -c -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.2.3/gcc -I../../gcc-4.2.3/gcc/build -I../../gcc-4.2.3/gcc/../include -I./../intl -I../../gcc-4
.2.3/gcc/../libcpp/include -I../../gcc-4.2.3/gcc/../libdecnumber -I../libdecnum
ber -o build/read-rtl.o ../../gcc-4.2.3/gcc/read-rtl.c
../../gcc-4.2.3/gcc/read-rtl.c, line 787: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 788: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 789: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 1592: lvalue required
[YYYYYYYY]/libexec/ccom terminated with status 1
make[3]: *** [build/read-rtl.o] Error 1
make[3]: Leaving directory `[XXXXXXXX]/objdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `[XXXXXXXX]/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `[XXXXXXXX]/objdir'
make: *** [bootstrap] Error 2
------------------------------------------------------
read-rtl.c:
787: obstack_ptr_grow (&joined_conditions_obstack, result);
788: obstack_ptr_grow (&joined_conditions_obstack, cond1);
789: obstack_ptr_grow (&joined_conditions_obstack, cond2);
1592: obstack_ptr_grow (&vector_stack, read_rtx_1 (infile, mode_maps));
------------------------------------------------------
include/obstack.h:
...
/* For GNU C, if not -traditional, we can define these macros to compute all args only once
without using a global variable. Also, we can avoid using the `temp' slot, to make faster code. */
...
# define obstack_ptr_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
obstack_ptr_grow_fast (__o, datum); })
...
------------------------------------------------------

The same source compiles fine with gcc 4.1.2.

pcc is detected as gnu c compiler, otherwise it would probably
get different and more portable code to translate (can I switch
off the gcc compatibility at run time?)

(another small glitch is that pcc does not support -MMD, used in one
of the Makefiles, changing there to -MD seems to work around)

Rune
Anders Magnusson
2014-08-17 20:00:43 UTC
Permalink
The ({ ... }) stuff should work well. Please file a ticket with a
preprocessed output.

Is -MMD used as arg to cpp or pcc? Please file a ticket for that also :-)

...but it may fail later on nevertheless. gcc may use TI mode when
compiled which pcc do not support.

gcc compat cannot be turned off runtime, sorry. You need to compile it
without.

-- Ragge
Post by u***@aetey.se
On Linux x86_64 with static uclibc and musl from 2014-05-15,
(btw, 4.2.3 is the last gcc version under GPLv2, contrary to what
Wikipedia says)
------------------------------------------------------
...
make[3]: Entering directory `[XXXXXXXX]/objdir/gcc'
...
pcc -c -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.2.3/gcc -I../../gcc-4.2.3/gcc/build -I../../gcc-4.2.3/gcc/../include -I./../intl -I../../gcc-4
.2.3/gcc/../libcpp/include -I../../gcc-4.2.3/gcc/../libdecnumber -I../libdecnum
ber -o build/read-rtl.o ../../gcc-4.2.3/gcc/read-rtl.c
../../gcc-4.2.3/gcc/read-rtl.c, line 787: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 788: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 789: lvalue required
../../gcc-4.2.3/gcc/read-rtl.c, line 1592: lvalue required
[YYYYYYYY]/libexec/ccom terminated with status 1
make[3]: *** [build/read-rtl.o] Error 1
make[3]: Leaving directory `[XXXXXXXX]/objdir/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `[XXXXXXXX]/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `[XXXXXXXX]/objdir'
make: *** [bootstrap] Error 2
------------------------------------------------------
787: obstack_ptr_grow (&joined_conditions_obstack, result);
788: obstack_ptr_grow (&joined_conditions_obstack, cond1);
789: obstack_ptr_grow (&joined_conditions_obstack, cond2);
1592: obstack_ptr_grow (&vector_stack, read_rtx_1 (infile, mode_maps));
------------------------------------------------------
...
/* For GNU C, if not -traditional, we can define these macros to compute all args only once
without using a global variable. Also, we can avoid using the `temp' slot, to make faster code. */
...
# define obstack_ptr_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
obstack_ptr_grow_fast (__o, datum); })
...
------------------------------------------------------
The same source compiles fine with gcc 4.1.2.
pcc is detected as gnu c compiler, otherwise it would probably
get different and more portable code to translate (can I switch
off the gcc compatibility at run time?)
(another small glitch is that pcc does not support -MMD, used in one
of the Makefiles, changing there to -MD seems to work around)
Rune
_______________________________________________
Pcc mailing list
http://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
u***@aetey.se
2014-08-18 10:36:56 UTC
Permalink
Post by Anders Magnusson
The ({ ... }) stuff should work well. Please file a ticket with a
preprocessed output.
I let the ticket creaton wait until I test with the latest pcc,
when it handles "\0".
Post by Anders Magnusson
Is -MMD used as arg to cpp or pcc? Please file a ticket for that also :-)
To pcc.
Done.
Post by Anders Magnusson
...but it may fail later on nevertheless. gcc may use TI mode when compiled
which pcc do not support.
Hope not but in the worst case an earlier gcc version will do.

There is no way to bootstrap recent gcc from C without going via multiple
versions anyway. Having said that, skipping extra extra [sic] steps
would be nice.
Post by Anders Magnusson
gcc compat cannot be turned off runtime, sorry. You need to compile it
without.
Hardly a much-wanted feature, so no problem, it takes seconds to recompile
pcc (not a whole coffee break needed to recompile a c-only gcc on the same
machine).

Unfortunately, arch/amd64/code.c contains a reference to GCC_ATYP_PACKED
which makes the build with --disable-gcc-compat fail.

I have now reported this via jira too.

Rune
u***@aetey.se
2014-08-24 13:59:36 UTC
Permalink
Hello Anders,
Post by u***@aetey.se
Unfortunately, arch/amd64/code.c contains a reference to GCC_ATYP_PACKED
which makes the build with --disable-gcc-compat fail.
You fixed this (thanks) but it seems there are more problems
with --disable-gcc-compat.

I commented on

http://pcc.ludd.ltu.se/jira/browse/PCC-474

but this did not reopen it, thus I cloned the issue into

http://pcc.ludd.ltu.se/jira/browse/PCC-479

Regards,
Rune

Loading...