Re: Adding old compilers to Compiler Explorer

8 views
Skip to first unread message

Matt Godbolt

unread,
Sep 21, 2020, 11:37:35 PM9/21/20
to Geoff Wozniak, compiler-explo...@googlegroups.com
Hey Geoff!

I'm excited to hear you're thinking seriously about adding your old compilers!

  • We run all our compilers in a bit of a sandbox. If the emulation setup interferes (or vice versa) that might be a bit of a problem. That said: we have hacked WINE enough to run under it...so I think we should be ok! We can help (if you're in to that kind of thing, then CppLang slack #compiler_explorer-development is the place to be: https://cppalliance.org/slack/ )
    • the current sandbox is firejail, but in a pinch we could probably move to nsjail too (that's what we use for running user binaries)
  • Colouring...I wouldn't worry too much. We hackily parse all the debug info (DWARF or stabs). If it's not there, it won't matter, it'll just be fun to see the output. Our asm parser is vague enough it mostly "just works" with any output, and our syntax highlighting is also pretty forgiving. It might Just Work.
  • Licensing...there's a fun one :| You make a good point there, and I'm glad you're thinking about it. I married a lawyer so have become sensitive to this stuff myself....
So: you're not going into the woods! To run locally to spike it out, you can probably get some kind of thing up and running in under an hour with:
  • there's no sandboxing when you run locally
  • so... make a shell script to run the emulator the way you'd like, pretending to be something vaguely gcc-like. It's easy to hack the CE source to run it however you like though, no need to go to heroics in the shell script
  • point etc/config/c.local.properties at it as per the docs you've found...
  • `make run`
  • enjoy the success!! (or not)
If that "works" we can see about the other issues. I am most worried about the licensing situation, in my journey through old-computer-space it's been surprising how acrimonious the ownership of long-dead software can be...!

Keep me posted, and let us know (CC-ing the other CE folks) if we can help, either email or on slack!

Cheers, Matt :)

On Mon, Sep 21, 2020 at 9:57 PM Geoff Wozniak <ge...@wozniak.ca> wrote:
As part of a personal research project (that may be getting out of
hand!) I’m looking at how to add support for old compilers to Compiler
Explorer.  I’ve read what I think are the key documents for adding
compiler support and I see these main obstacles.

- Having some sort of reasonably unified front end that hides all the
  mess of running an emulator to actually run the compiler and get some
  kind of output that is useful.  I’m currently working with C compilers
  that run on DOS that are roughly from 1985 or earlier.  I am also
  considering ones that ran on Amiga and maybe Atari ST.  This seems
  doable, if not a bit messy.

- Providing usable assembler output will likely be the hard part.  I’ve
  no idea how the output gets from the compiler to the output window
  with the proper colouring.  I’m assuming it’s some use of debug info,
  which basically doesn’t exist in the compilers I’ve been trying, at
  least.  If there is any kind of line to instruction mapping, it’s in
  long dead proprietary formats.  It may be that any kind of colour map
  would just not work.

- For this to ever actually end up on the public CE site, there could be
  some licensing issues.  The emulator may be open source, but I don’t
  know about the OSes or compilers themselves.  I’ve been able to find
  copies, but that doesn’t mean they were all legit.

Before I embark on a potentially epic yak shave, I’m wondering how
feasible the first two points are.  I think the first one can be done;
I’m in the process of trying to find a way to do it now using either
DOSbox or Bochs.  If the second is just "shove output in window and not
worry about mapping" then it would also be doable.  If it fundamentally
relies on some kind of debug info then I’m guessing it would be a lot of
work.

If I am going off into the woods, I’d appreciate being told now. :) If
you can point me to some code in the repo I should take a look at to
better understand what would be required, that would also be
appreciated.

--
Geoff Wozniak
https://wozniak.ca


--
Matt

Geoff Wozniak

unread,
Sep 22, 2020, 8:39:53 AM9/22/20
to Matt Godbolt, compiler-explo...@googlegroups.com
Well this is all good news. :)

If the assembly output is not really a problem then I am not too
worried. I guess we’ll just have to see, since the assembler output in
some cases is really weird.

Sounds like the Slack channel may be the place to be once I get going on
this. I’m currently in the midst of trying to make a script that gives
the illusion that the compilers are vaguely modern. Once I have that it
sounds like getting it up and running locally will not be a burden.

Thanks for the help.

--
Geoff


Matt Godbolt <ma...@godbolt.org> writes:

> Hey Geoff!
>
> I'm excited to hear you're thinking seriously about adding your old
> compilers!
>
>
> - We run all our compilers in a bit of a sandbox. If the emulation setup
> interferes (or vice versa) that might be a bit of a problem. That said: we
> have hacked WINE enough to run under it...so I think we should be ok! We
> can help (if you're in to that kind of thing, then CppLang slack
> #compiler_explorer-development is the place to be:
> https://cppalliance.org/slack/ )
> - the current sandbox is firejail, but in a pinch we could probably
> move to nsjail too (that's what we use for running user binaries)
> - Colouring...I wouldn't worry too much. We hackily parse all the debug
> info (DWARF or stabs). If it's not there, it won't matter, it'll just be
> fun to see the output. Our asm parser is vague enough it mostly "just
> works" with any output, and our syntax highlighting is also pretty
> forgiving. It might Just Work.
> - Licensing...there's a fun one :| You make a good point there, and I'm
> glad you're thinking about it. I married a lawyer so have become sensitive
> to this stuff myself....
>
> So: you're not going into the woods! To run locally to spike it out, you
> can probably get some kind of thing up and running in under an hour with:
>
> - there's no sandboxing when you run locally
> - so... make a shell script to run the emulator the way you'd like,
> pretending to be something vaguely gcc-like. It's easy to hack the CE
> source to run it however you like though, no need to go to heroics in the
> shell script
> - point etc/config/c.local.properties at it as per the docs you've
> found...
> - `make run`
> - enjoy the success!! (or not)
Reply all
Reply to author
Forward
0 new messages