GCC for pdp11

Paul Koning paulkoning at comcast.net
Fri Jul 13 20:04:54 CDT 2018

> On Jul 13, 2018, at 8:18 PM, Warner Losh via cctalk <cctalk at classiccmp.org> wrote:
> On Fri, Jul 13, 2018 at 6:12 PM, Bill Gunshannon via cctalk <
> cctalk at classiccmp.org> wrote:
>> On 07/13/2018 02:32 PM, Paul Koning via cctalk wrote:
>>> Gentlepeople,
>>> Once in a while people ask about GCC.  It has long had pdp11 support,
>> but it hasn't received much attention.  Recently I've done some cleanup on
>> it, and some more is in the pipeline.
>>> One notable new feature is that it can now produce proper DEC Macro-11
>> syntax output.  It has long had a -mdec-asm switch, but that used to
>> produce GNU output.  Now it produces DEC output (and -mgnu-asm is how you
>> get output for "gas".)
>>> The optimizer is better, and a bunch of compiler failures are fixed.
>> Undoubtedly there are more bugs to be worked on.
>>> Oh yes, for grins I told GCC to build not just a C compiler but a C++
>> and Fortran compiler as well.  That seems to work (but I get an error
>> building the libstdc++ library).  I now have C++ translations of the RSTS
>> standard header files common.mac and kernel.mac, and the DECnet definitions
>> in netdef.sml.  :-)
>>> If anyone wants to give this a try, the best way is to get the current
>> code via Subversion (see gcc.gnu.org for details).  Alternatively, get a
>> weekly snapshot; the DEC support is in the current latest, though some
>> optimizer work will appear in the next one.
>> I am going to have to take a look at this.  I have been meaning
>> to dig out a really old version of GCC because I thought they
>> removed all the PDP-11 stuff ages ago.  This could be fun again.
> Can it build interesting things like V7 and/or 2BSD?
> Warner

I don't know; I have not tried that.

One point that may be relevant.  GCC typically supports several variants for any given target processor, for different operating systems or the like.  And the pdp11 target at one point had a 2bsd variant.  That one was indeed removed some years ago.  I haven't yet tried to bring it back, partly due to lack of experience with 2BSD.  But I'm thinking about it.

My expectation is that the code would compile fine, but possibly might not link or produce a valid binary if there are ABI differences or library mismatches.  Input from those who know this stuff better would be helpful.  Note that contributions are welcome; there hasn't been much in recent years but there has been a bit occasionally, and I certainly would appreciate that.

Finally, if you spot bugs, the GCC Bugzilla machinery would probably be the best way to report them, though you can email me if you want for an initial check.


More information about the cctech mailing list