GSoC: Making ports work with clang

Andrius Morkūnas hinokind at gmail.com
Mon May 3 12:12:53 UTC 2010


On Mon, 03 May 2010 13:38:07 +0300, C. Bergström <cbergstrom at pathscale.com> wrote:
> I can understand from a commercial perspective why having a permissive
> licensed production compiler could be good.. I can understand why many
> people don't like gcc or fsf, but what does the BSD community get?
>
> 1) Performance?
> 2) Robustness?
> 3) ... ?
Seeing how often I see this question, maybe I'll write (or force
rdivacky@ to do it) an explanation why clang/llvm is good for FreeBSD.
Anyway, for now, very short version:
1) Performance - in the long run, yes. gcc 4.2 in base will not be
    updated anymore. llvm on the other hand is actively developed
    and includes fancy stuff that new CPUs have. Clang also compiles
    stuff faster than gcc.
2) Robustness - not yet. It's still too early to rely on stability of
    clang/llvm, but eventually it will get better.
3) BSD-like license, C99 and eventually C++0x support.
I'm too lazy to think about this right now.

> What's really the goal here?
To quote myself: "make clang and ports to be friendly with each other".
My goals are stated in the initial email and the wiki. I'll update the
wiki with some clarification on what are and what are not my goals when
I have more time.

> What problem are you working to solve?
The problem is that ports tree is full of assumptions that compiler is
gcc. At the moment, there is no way to use alternative compiler without
breaking too many things.

> May I humbly say that building software with a different compiler in
> itself doesn't really accomplish anything.
I prefer to think that compiling software with clang is making world a
better place. More seriously - clang is much more strict than gcc. It
forces people to write better, standard C/C++ code and not some random
walls of incomprehensible text that remotely resemble C or C++, but
can't even be compiled by later versions of gcc itself. I've already
seen a lot of things being fixed because clang found a bug that gcc
missed, or application relied on some weird gcc-specific behaviour
and clang refused to compile it.

> Starting early can give valuable feedback , but without actually having
> the resources to follow-up it's wasted effort.
Well it's my effort that's wasted, I don't see how that's bad for
anyone else. And I don't plan to waste anything, I've mentioned that
some of the things I'm going to do over summer (and have been doing
till now) aren't clang-specific. It will also help compile ports with
new versions of gcc (or any other standard C/C++ compiler), and I
don't think I need to explain why newer versions of software are
usually better.

> Is llvm at the point where it can self host BSD?
You obviously aren't subscribed to freebsd-current@, are you?
http://lists.freebsd.org/pipermail/freebsd-current/2010-April/016648.html

> If not why not start there?
It's been started some time ago, by other people. The reason I'm
doing this as a GSoC project is because the person currently working
on ClangBSD suggested me to do it.

> Maybe identify the most used applications..
Not sure if you're talking about base system or ports here. I've
mentioned that I want to get commonly used ports to work, and I've
been doing something like that for some time now.
If you're talking about base system, the problem isn't identifying
most used applications, it's to fix whatever is still broken. Most
of FreeBSD base system works with clang without problems.

-- 
Andrius


More information about the freebsd-ports mailing list