OpenBSD Journal

Competition between open source compilers

Contributed by marco on from the give-us-your-tokens dept.

Old, but interesting InformIT article about two possible alternatives to the GCC compiler. They review LLVM and PCC, and discuss both the technical and licensing aspects of each.

Read it here.

(Comments are closed)


Comments
  1. By Cabal (Cabal) Cabal on http://www.romraider.com/

    There was a big presentation about LLVM at the Apple WWDC, which will be included in Snow Leopard and under the BSD license. More here.

    Comments
    1. By Anonymous Coward (216.138.195.228) on

      > There was a big presentation about LLVM at the Apple WWDC, which will be included in Snow Leopard and under the BSD license. More here.

      Last time I checked undeadly is not an OS X site.

  2. By Renaud Allard (renaud) renaud@llorien.org on

    Humm, this is slightly misleading.

    quote: "First, GCC is released under the GNU General Public License, which means that any other program built using it is required to be under the same license."

    Comments
    1. By Anonymous Coward (68.1.64.249) on

      > Humm, this is slightly misleading.
      >
      > quote: "First, GCC is released under the GNU General Public License, which means that any other program built using it is required to be under the same license."

      That quote is not correct. I scoured the license with gcc a long time, and if there had been a "you must release source of compiled binaries" clause I'd have looked for a cheap copy of Turbo C at the time.

      Comments
      1. By Anonymous Coward (134.58.253.57) on

        > > Humm, this is slightly misleading.
        > >
        > > quote: "First, GCC is released under the GNU General Public License, which means that any other program built using it is required to be under the same license."
        >
        > That quote is not correct. I scoured the license with gcc a long time, and if there had been a "you must release source of compiled binaries" clause I'd have looked for a cheap copy of Turbo C at the time.

        The quote refers to software built using parts of gcc, e.g., an IDE using parts of gcc for code parsing for syntax highlighting. An there, the GPL does impose restrictions.

    2. By David Chisnall (82.7.199.50) on

      > Humm, this is slightly misleading.
      >
      > quote: "First, GCC is released under the GNU General Public License, which means that any other program built using it is required to be under the same license."

      If you read the context, you will see that I am talking about programs built using GCC as a component (i.e. LLVM taking the GCC front ends), not programs compiled using GCC. That said, the GPL would apply to code compiled using GCC, since it embeds parts of itself and calls to libgcc (also GPL'd) in your code. Both GCC and libgcc, however, come with an exemption from the GPL for code simply compiled with GCC.

      I'd love to see LLVM make it into OpenBSD. It's a lot smaller than GCC and the individual optimisations are entirely separate and so could be enabled one at a time, after a thorough code review. The JIT now supports W^X (it allocates W and sets the buffer to X after code generation), so it should work on OpenBSD without major effort. Clang is now at a state where it can compile a lot of C code - including the FreeBSD kernel, as of a few weeks ago - and so it would be possible to ship a fully BSDL C compiler. The major down side is that LLVM is written in C++, and so currently needs to be built with gcc or llvm-gcc.

  3. By Anonymous Coward (80.37.248.67) on

    http://llvm.org/demo/index.cgi
    Here you cant test the code generation yourselves, it takes a bit of work to fool the static optimizer to output your retarded code :)
    What are the chances of this making its way to OpenBSD base in the near future?

    Comments
    1. By Anonymous Coward (134.58.253.57) on

      > http://llvm.org/demo/index.cgi
      > Here you cant test the code generation yourselves, it takes a bit of work to fool the static optimizer to output your retarded code :)
      > What are the chances of this making its way to OpenBSD base in the near future?

      Since PCC has been imported into the tree -- for the purpose of evaluating and further developing it. I'd guess it is far more likely that we will one day see PCC as the default compiler, rather than LLVM.

      Then again, I do not own a crystal ball.

    2. By Laurence Tratt (79.68.65.91) on http://tratt.net/laurie/

      > What are the chances of this making its way to OpenBSD
      > base in the near future?

      I doubt it's going to be making it into base any time soon.

      That said, as of this morning it looks like the subversion version of LLVM now largely works on OpenBSD (previously it tended to randomly crash on certain operations). Thanks to Edd Barrett, Andrew Dalgleish, Chris Lattner, and Anton Korobeyniko for tracking down this particular problem.

      If anyone's interested in helping out with LLVM on OpenBSD, there are still about 25 failing tests in the test suite that need looking at to determine whether they're real problems or not.

    3. By tedu (74.68.146.146) on


      > What are the chances of this making its way to OpenBSD base in the near future?

      Very unlikely.

    4. By Anonymous Coward (151.136.100.2) on

      > http://llvm.org/demo/index.cgi
      > Here you cant test the code generation yourselves, it takes a bit of work to fool the static optimizer to output your retarded code :)
      > What are the chances of this making its way to OpenBSD base in the near future?

      it has the same problem as gcc -- enormous codebase and written in c++.

      Comments
      1. By Laurence Tratt (ltratt) on http://tratt.net/laurie/

        > it has the same problem as gcc -- enormous codebase and written in c++.

        From my very limited poking around so far, LLVM doesn't look ridicuously huge for what it does. The fact of the matter is that optimising compilers that target multiple architectures (and that, in the case of LLVM, have extensive run-time abilities that GCC doesn't) aren't going to weigh in at a couple of KLoC - especially if they're written in a low-level language like C or C++. So discriminating just on KLoC probably won't turn out to be a good long term bet. I agree that C++ is never a tantalising option though.

        Comments
        1. By tedu (207.99.73.226) on

          > > it has the same problem as gcc -- enormous codebase and written in c++.
          >
          > From my very limited poking around so far, LLVM doesn't look ridicuously huge for what it does.

          If you define "what it does" as "turn C code into machine code", yes, it is huge. And that is precisely the what OpenBSD is interested in having a compiler do.

  4. By iru (189.25.167.158) on

    http://gsoc.cat-v.org/hg/kenc/

    Comments
    1. By Anonymous Coward (88.217.158.50) on

      > http://gsoc.cat-v.org/hg/kenc/

      it's full of plan9isms and not very well commented inside.
      not to mention an awesome naming conventions in the code
      to make it even more readable.

      Comments
      1. By iru (201.83.6.44) on

        > > http://gsoc.cat-v.org/hg/kenc/
        >
        > it's full of plan9isms and not very well commented inside.
        > not to mention an awesome naming conventions in the code
        > to make it even more readable.
        go back to k&r. you haven't finished your C lessons yet, son.

  5. By Terrell Prude' Jr. (98.172.26.6) tprude@cmosnetworks.com (this is a spamtrap address) on http://www.cmosnetworks.com

    Hey, I'm all for it. A little healthy competition never hurt anybody. It's like GNOME vs. KDE vs. XFce, ad nauseum; or BSD vs. GNU/Linux. Ultimately, everybody gets motivation to become better.

    Yeah, I use GNU/Linux most of the time (Slackware). But I wouldn't balk at using another Free Software compiler as long as it actually works well, i. e. compiles code at least as correctly as GCC does. And if you go by some of the comments by BSD'ers in this forum in the past, that shouldn't be too hard. :-)

    --TP

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]