GCC vs LLVM
I saw this news in Phoronix.
I have tried to understand which is better. I have always used GCC, is there a significant reason to change? |
Not a Slackware question. There are programming forums.
|
http://llvm.org/
1) There's a llvm/clang Slackbuild ( Version 2.9 ) http://slackbuilds.org/result/?search=llvm&sv=13.37 LLVM 3.0 : http://llvm.org/releases/download.html#svn Clang http://clang.llvm.org/ 2) Gcc will compile "everything". LLVM can compile some (the most?) applications / libraries. Why not try out llvm / clang, to know ? ( export CC=clang CXX=clang++ && <other-command> ). |
This is not a programming question per sé.
You could also see it as a philosophical question - everybody grew up with GCC - what will a move to LLVM bring to Linux distributions? I have no doubt that Redhat considers a move away from GCC. This is just one step in a trend to abandon the platform-agnostic tools of old and push Linux into a direction which will separate it from it's UNIX cousins. Some would call it "refreshment of Linux" but mainly this is a push to get the Linux desktop into a state where it will be commercially exploitable. The big distro vendors are not concerning themselves with compatibility issues - look at how we, Slackware, must struggle to keep our own distro sane. Their ulterior motive is simply: to earn more money. And **** the hippies. Eric |
Quote:
I am only trying to understand, from the point of view from Linux Distro Maintainers is there any major step in using LLVM? Based on Phonorix Apple use it and Fedora is considering. After so many time with GCC, and from several post that I read, many program use specific GCC Macros and options, what is the force to change? And as a Linux user, is this change for the better or worse? |
Quote:
Maybe if i have time I can write a simple code in C and compile with GCC and CLANG and see the differences. Namely compilation time, execution time and try different optimizations :D |
that llvm hypes currently several comanies have several motivations to use it as 'their' compiler is on thing
the advantage of llvm/clang is its modular design, so it can be interfaced and used for example to create static code analysis tools, what becomes more and more important and competition is good, even for gcc beside that, it is great to use more than one compiler, especially in so exiting times where the new c++11 stuff comes into the compilers for C++ this is a big win, compaired to the situation of the last years for me it is realy exiting to see how various tools and compilers work with each other and how they continue brining new features, and I currently use gcc/clang++ and msvc10 to compile my code. also, there is no real a vs b situation for me , cause my code has to work with all 3 compilers, or 2 for the linux only parts |
Quote:
Quote:
|
Some people may not know this, but gcc has been replaced before. At least by a fork of itself.
http://en.wikipedia.org/wiki/GNU_Com...tion#EGCS_fork Maybe this is not as drastic as moving to a new compiler code base, but this could shed light why LLVM is getting new attention. Many times, forks or replacements are written, not so much for technical reasons, but control of the code base. (Don't get me wrong, the project leads may make technical decisions different than their competing project, to "improve" things) So EGCS is an example of developers not happy of the management of GCC, going out on their own, and eventually being the leader. This led back to remerging the code bases under the new leadership (or at least being called the defacto GCC). So GCC is one big happy family again right? LLVM could prove to be successful that it becomes a standard, but I will wait and see. I do have it installed for my Mesa driver. Not every competing faction succeeds. Take again Red Hat and GCC, which produced the ill-fated GCC 2.96 (an unofficial fork of GCC 2.95). Unfortunately it was popular among some commercial vendors using Red Hat, and I've finally just got off a vendor produced program myself which required those C++ libs by just finally rewriting a new program for my company in the last 6 months. |
Quote:
|
Martinus2u ... you also wrote software on Atari? How funny, I did this too.
I must have my Pure C floppies still, somewhere, but I only run Atari emulators these days, having done away with the 1040ST and the TT long ago. Eric |
Quote:
but all that is history now. I sometimes play with vice, the c 64 emulator. :D |
As it seems Debian are also thinking in trying out LLVM compiler, here.
|
LLVM/Clang: It's Great for Students!
I don't know how it would fit for distribution maintainers; it is attractive to companies trying to make money since it's "BSD" stye license (U. of Chicago license I think) is probably easier to use for financial gain than the GPL though many companies have proved you could profit with GPLed software. Probably why Apple is pushing it in favor of GCC.
I am a student currently studying C and Unix systems programming and I must say that for me Clang has been a godsend and that is mainly because it's warning and error messages are infinitely easier to understand than those of GCC. It also will usually accurately highlight and literally "point to" your errors. I just find it much more user friendly. I am using it from the CLI in a GNU/linux box, so this is not due to a particular implementation in an IDE. |
The only thing I've ever used LLVM for was to compile Mesa to support 3D acceleration for various video cards using Gallium3D.
It's just another compiler for another purpose. GCC is and will always be the defacto open source compiler not just for Linux but for many open source projects. |
Quote:
Check out a nice detailed benchmark here. |
that's why llvm is also good for gcc
http://gcc.gnu.org/ml/gcc/2012-03/msg00256.html http://gcc.gnu.org/ml/gcc/2012-03/msg00263.html |
Free BSD 10 To Use Clang Compiler, Deprecate GCC, link.
Maybe there is some important advantage of LLVM on top of GCC. |
Quote:
|
From what I read in the Phoronix forum the bitcode compiled by clang is 5-15% slower than the same code compiled with GCC without optimizations.
Clang is not a mature yet. |
I'm delighted that LLVM was included with the new X updates in current. I've been watching this project for several years wondering if it would ever come into more general acceptance.
"GCC vs LLVM"??? I don't get it. To me they are very different tools. Yes, LLVM has a compiler--so does Perl. To me, the compiler in LLVM has more in common with the Perl compiler than with GCC. The LLVM compiler targets the Low Level Virtual Machine, just as the Perl compiler targets the Perl runtime. The only differences I see are that the LLVM compiler compiles C and the Perl compiler compiles Perl, and the LLVM operates more closely to the hardware than the Perl runtime does. GCC directly targets a variety of hardware. LLVM targets a VM layer that can make compiled code more portable. Apples and Oranges in my book. |
Sorry, but that's far from being accurate at all. GCC has front-ends to different languages, and backends to multiple architectures. When the frontends run, they translate the code to an intermediate language or virtual machine, if you prefer, like RTL. GCC and LLVM, in that sense, work very similarly. Of course, internally they're very different, but just not in that concept.
http://en.wikipedia.org/wiki/Interme...uage#Languages http://en.wikipedia.org/wiki/Register_Transfer_Language |
also, for historic reasons and for different optimization steps gcc employes a variety of internal representations of the code. of course, this doesn't help performance very much.
|
Quote:
How GCC works internally isn't the point. The output is raw machine code. LLVM's compiler outputs bytecode to run on top of the LLVM, rather like the .Net languages which can't run without .Net LLVM just has a much lower level of abstraction and so, can run much faster. |
Quote:
Code:
gazl@darkstar:/tmp$ cat >clang-test.c |
All times are GMT -5. The time now is 12:47 PM. |