GPC with GCC 4.9.4

Kevan Hashemi <[email protected]> Fri, 8 May 2020 16:00:47 -0400
Newsgroups gmane.comp.compilers.gpc
Organization Brandeis University
Message-ID <[email protected]>
Dear Waldek,

> with GCC-4.3.5.  Look at README, for 4.3.5 you need to use '--disable-mapped-location'. 

I can't get GCC-4.3.5 to compile on MacOS without figuring out a bunch of small modifications. I have GCC-4.9.4 from Home Brew, and that installation applies patches automatically before building. So I started with GCC 4.9.4. The patches for GCC-4.3.5 mostly work, but I had to skip half of them. The patch appears to be Makefile.def and Makefile.in edits. The build proceeds well, with correct identification of the host, build, and target as x86_64-apple-darwin16.7.0. In the libiberty directory, I have 64-bit objects.

First error is when going through gpc.h, where it says several times:

../.././gcc/p/gpc.h:290: parse error: GTY must be specified before identifier

That's because the newer GCC requires that you provide an "identifier" for each GTY type definitions. The existing "tree_inn" structure is:

struct tree_inn GTY(())

I add the identifier "tree_in_gty" like this:

struct tree_inn GTY(()) tree_in_gty

And do so for all other instances in gpc.h, declarations.c, module.c, and plant.c. Now compilation proceeds to:

../.././gcc/p/plant.c:47: undefined type `varray_type'

There is a missing file "varray.h", which appears in GCC-3.4.6, but not in GCC-4.9.4.

I'll look into the varray.h problem.

Best, Kevan


-- 
Kevan Hashemi, Electrical Engineer
Physics Department, Brandeis University
http://www.bndhep.net