Announcement

Collapse
No announcement yet.

Using LLVM As The Compiler Within Fedora?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using LLVM As The Compiler Within Fedora?

    Phoronix: Using LLVM As The Compiler Within Fedora?

    For those wanting to see another polarized discussion taking place within the Fedora camp, similar to the Fedora rolling-release discussion, drop by the mailing list...

    http://www.phoronix.com/vr.php?view=MTA1ODA

  • #2
    Hmm, I'm not sure I see the controversy here. Maybe Phoronix could point it out?

    There's 5 responses to the original post, which doesn't even advocate a switch to llvm - just wondering what the current status of llvm support in linux is.

    The replies all basically come down to, "well, we'd have to have a reason to switch, like if it generated better code. and then someone would need to step up and do the work."

    That's supposed to be polarizing?

    Comment


    • #3
      I tried llvm/clang with several packages on my gentoo system and the result ist: there are many packages that rely on specific gcc behaviour or gcc specific extensions like this endless list: http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html
      So basically, many programs are not written in C anymore, but a GNU dialect. This means: those programs will not compile with clang without patching the usage of GNU extensions out of the code (or bringing those extensions to clang).
      And even if a package compiles, there is no guaranty, that it will work afterwards without segfaults or other crashes (I had this especially with mesa/drivers/X).
      This needs some enthusiasts (or linux developers) who compile everything with llvm/clang, test it and file bug reports to the projects, to llvm/clang and write patches to get rid of GNU extensions and bugs. Have fun :-)
      BSD compiles the system with clang afaik, so my guess is: they have a more standard C codebase, some compatibility patches in other cases and thus no problems with clang.

      and while there are many packages that can be compiled with clang, there are some essential packages that don't: glibc fails afair, the kernel does not support clang completely, Qt is not supported (changes with Qt 5 afaik), I had problems with X
      Last edited by mark_; 02-16-2012, 03:45 AM.

      Comment


      • #4
        Originally posted by smitty3268 View Post
        There's 5 responses to the original post, which doesn't even advocate a switch to llvm - just wondering what the current status of llvm support in linux is.

        The replies all basically come down to, "well, we'd have to have a reason to switch, like if it generated better code. and then someone would need to step up and do the work."

        That's supposed to be polarizing?
        Micheal is a huge proponent of LLVM/Clang, so he inflates anything regarding it. Whenever he brings LLVM/Clang up it's described as 'wildly popular' etc, and GCC at best as 'popular' despite it being the de facto standard compiler toolchain which pretty much the entire open source world relies on while LLVM being mostly used as a JIT solution (although a VERY GOOD solution) and Clang hardly used at all as it's still very immature. He has an agenda in his compiler reporting (and I'm guessing the poor quality of his compiler benchmarks is also a result of tailoring them to present LLVM/Clang as good as possible) and it's sad, that said it's not as if there has ever been anything even remotely objective about Phoronix reporting. This 'article' is just another piece of that LLVM/Clang propaganda.

        Comment


        • #5
          What a dumb article. There's nothing that even suggests they'll switch to that apple's crap. Not only it's usually much slower then GCC, but it can't compile many packages. Afaik apple can't ship with the latest GCC, so what's left for them? Slower and less mature llvm.

          Comment


          • #6
            write patches to get rid of GNU extensions
            The extensions are obviously useful, otherwise they wouldn't be used. I'm going to bet you'd have a hard time trying to convert some linux packages to more/worse code just to compile under clang.

            Comment


            • #7
              Originally posted by curaga View Post
              The extensions are obviously useful, otherwise they wouldn't be used. I'm going to bet you'd have a hard time trying to convert some linux packages to more/worse code just to compile under clang.
              I am not so sure of the usefulness; the extensions certainly make it easy for the programmer to implement something (and thus are useful from this point of view) but as we see now it complicates independance and portability, so there is a high price. As C is Turing complete, the extensions are not necessary and I personally would not want to pay that price of compiler dependence to make some coding techniques a bit easier. In fact, I never had a deeper look at the gcc extensions, always used standard C, never missed something and my code is portable.
              I agree that converting the affected linux packages is hard, but I see it as an improvement in code quality, not as more/worse code - where is the freedom in free software if I cannot choose my favorite compiler? ;-)
              I hope, Fedora succeeds.

              Comment


              • #8
                Of course they are useful, and the reason they were added was at the behest of programmers so it's obvious that they will be used. Many if not the vast majority were added at the request (to put it mildly) of kernel devs who wanted better control of the resulting code (mainly in order to improve performance) than what C can in itself offer without having to resort to assembly code.

                I can't recall ever having use of anything other than the gcc vector type extensions but I have also never written anything remotely as low level as a kernel, drivers, etc. And your argument that they 'aren't necessary' holds no water as it's up to the programmers decide what is necessary. Is C99 necessary? C11? C++11? Should programmers not use the features offered by them if their compiler supports it because say VS2010 doesn't support them fully? The argument is even more hollow when you take into account that anyone can download GCC and use it for free.

                And for the record Clang supports lots of extensions, so it's not 'pure' by any means. And I'm certain that eventually it will support all extensions necessary for it to compile the Linux kernel without having to rewrite the kernel code which is what the BSD devs had to do to it to compile with Clang/LLVM. For them it was obviously worth it as they were stuck with shipping GCC 4.2.1 due to refusing GPLv3 and also because of them identifying themselves with the BSD licence. Obviously there are no such issues for the Linux kernel and it's software ecosystem so for them it's a practical/technical issue and I've seen no indication of the kernel devs being interested in removing compiler extensions from their code.

                That said I don't mind the possible rewriting of code without extensions as long as it doesn't impact the performance which is (most likely) why they were used in the first place and thus unlikely to happen, of course again the BEST solution is if Clang/LLVM simply adds the same extensions and thus became fully compatible with GCC, it's not as if the extensions are proprietary.

                And you can certainly use your favourite compiler, however what you are proposing is that other people shouldn't be able to use all the features made available of _their_ favourite compiler just so that you can compiler their code with _your_ favourite compiler because it doesn't support the same range of features.

                Comment


                • #9
                  Originally posted by XorEaxEax View Post
                  Of course they are useful, and the reason they were added was at the behest of programmers so it's obvious that they will be used. Many if not the vast majority were added at the request (to put it mildly) of kernel devs who wanted better control of the resulting code (mainly in order to improve performance) than what C can in itself offer without having to resort to assembly code.
                  I agree... Just like any product, it needs to meet the needs of the users (programmers) or they'll find something more appropriate to use.

                  Last I heard, LLVM/Clang was a *long* way away from being able to compile the entire Debian repository.. So until then, I think it's pretty silly to be discussing it as a replacement for GCC. If GCC provides extensions / features that kernel developers want and LLVM/Clang doesn't, then LLVM/Clang is going to need to find a way to provide equivalent or better functionality.. Forcing the programmers to use assembly where they didn't before is not a solution. GCC will be around for a long time.

                  Comment


                  • #10
                    XorEaxEax: The essence of your posting is, that the gcc language set has to be treated like a language standard (which it is NOT; it might barely be an unofficial one). So every programmer that uses these extensions, forces the users to use that compiler too and depending on your definition of freedom, this makes the users less free than before (example: the BSD guys). This is equal to like using a non standard library in your program (think of early KDE days: KDE was free, Qt was not).

                    I claim that it might be very convenient for the programmer to choose such extensions, but as I said, there is a price.
                    If you stick to the standard, you don't pay the price and your users don't pay it either. I don't think, that there are really good technical reasons for using the gcc extensions, BSD obviously works without them and I bet their code and their performance did not get worse.

                    Btw, just for fun let's exaggerate your argument, that gcc is free and therefore implementing a dialect is ok:
                    What if I write 100 free programs and you want to use them all, but every program uses another, free language with it's own free compiler... it is nice to install 100 compilers to compile 100 programs, isn't it? If you had the choice, you would never use these programs of mine. Do you see the importance of standards? If you needed to prove the correctness of a program you would hate every single version of all compilers that differ from the standards in any way (like bugs or even convenient extensions, compare it with http://lwn.net/Articles/478657/; could be a bug or an extension or whatever... anyway, it breaks code as it is not standard, so it is good to use another compiler... oh wait).

                    So: if you want to justify excessive use of a language extension to me, create an official standard like GNU C first. Then your program uses GNU C which is not C and then I have no problem anymore, if clang cannot compile your code.

                    Comment


                    • #11
                      Originally posted by mark_ View Post
                      I claim that it might be very convenient for the programmer to choose such extensions, but as I said, there is a price. If you stick to the standard, you don't pay the price and your users don't pay it either.
                      Of course, but again it is a programmer's decision. I'd rather have a compiler giving me these features and only use them when I feel I need them, rather than not having them because someone like you decided it didn't fit their vision of 'what I need'.

                      Originally posted by mark_ View Post
                      I don't think, that there are really good technical reasons for using the gcc extensions, BSD obviously works without them and I bet their code and their performance did not get worse.
                      And I bet the kernel devs didn't request these extensions and then use them throughout the kernel without good reason, I know the Linux kernel code relies heavily on compiler extensions which allow it to have better control over branch prediction and cache lines which certainly has a great impact on performance.

                      Originally posted by mark_ View Post
                      Btw, just for fun let's exaggerate your argument, that gcc is free and therefore implementing a dialect is ok:
                      What if I write 100 free programs and you want to use them all...
                      That you would need to paint a gross exaggeration in order to make it into a problem only shows how little water your argument holds. If you want to adhere to standards YOU as a PROGRAMMER choose to do so, if you don't then the compiler allows YOU to make that choice and use compiler extensions.

                      Originally posted by mark_ View Post
                      So: if you want to justify excessive use of a language extension to me, create an official standard like GNU C first. Then your program uses GNU C which is not C and then I have no problem anymore, if clang cannot compile your code.
                      First off, in that case you must shun Clang/LLVM, not only does it have support for alot of GCC's extensions but it also has it's OWN EXCLUSIVE extensions which is not supported by any other compiler and thus 'forces' the you to compile it with Clang/LLVM, heck it's even mentioned in the very thread this 'article' points at. So with your arguments you are against BOTH GCC and Clang/LLVM, yet you only level criticism at GCC. Either you are just hypocritical or you simply lived in some fuzzy belief that Clang/LLVM only implemented 'standard' functionality.

                      Secondly by it's very nature and as made obvious by their name, extensions AREN'T standards, they are 'extensions' to existing standards, how can you fail to grasp that? And those who use these 'extensions' do so because they really feel they need what they offer, knowing full and well that there is no guaranteed compability across compiler toolchains given that they are NOT standards.

                      Also, you do realize that most of the features in later standards started as extensions and then elevated into standard functionality when they had proven their worth and stability?

                      In conclusion, both GCC, Clang/LLVM, Intel Compiler implements compiler _extensions_ which offer functionality beyond what the standards define. These _extensions_ are not supported across all compilers although some are, GCC has exclusively supported extensions, Clang/LLVM has exclusively supported extensions and same goes for ICC.

                      I find it hard to believe you are a programmer at all, you sound like a person who just compiles other people's code and throws a fit if it doesn't compile with *your* favourite compiler. And if you feel you have a legitimate reason to complain then you should take those complaints to the actual programmers who CHOSE to USE these extensions, not to the compiler vendors who make them available at the request of those same programmers. And you should certainly not single out GCC as some culprit, because all these compilers implement extensions and each with their own exclusive ones.

                      Comment


                      • #12
                        Originally posted by kraftman View Post
                        it can't compile many packages
                        That's the fault of the person coding the "package" not the compiler.

                        Comment


                        • #13
                          Originally posted by yogi_berra View Post
                          That's the fault of the person coding the "package" not the compiler.
                          I'd disagree there.. The reason GCC has those extensions is because the standard is inadequate and it's not GCC's problem that the standard is inadequate..

                          If you make a compiler that meets just the standards instead of making what people actually need, you've made something that's a whole heap of worthless.

                          The assumption that the standards are good enough is obviously incorrect as if that was true then there would be no need for extensions.
                          Last edited by Sidicas; 02-16-2012, 03:57 PM.

                          Comment


                          • #14
                            Originally posted by Sidicas View Post
                            I'd disagree there.. The reason GCC has those extensions is because the standard is inadequate and it's not GCC's problem that the standard is inadequate..

                            If you make a compiler that meets just the standards instead of making what people actually need, you've made something that's a whole heap of worthless.

                            The assumption that the standards are good enough is obviously incorrect as if that was true then there would be no need for extensions.
                            Further on, some of the things only supported by compilers later on becomes included as parts of the standard.

                            Comment


                            • #15
                              Originally posted by Sidicas View Post
                              I'd disagree there.. The reason GCC has those extensions is because the standard is inadequate and it's not GCC's problem that the standard is inadequate..

                              If you make a compiler that meets just the standards instead of making what people actually need, you've made something that's a whole heap of worthless.

                              The assumption that the standards are good enough is obviously incorrect as if that was true then there would be no need for extensions.
                              Hey, if you want to write platform specific code and recreate vendor lock-in on Linux, feel free. Just don't claim that your program is open, free, or portable.

                              Comment

                              Working...
                              X