1

I found that llvm could only generate assembly code. If someone want generate and link assembly code to native executable code, they should use external tool(GNU as/ld, for example. Currently lld is not ready, and there no more information about llvm-mc).

This question's answer and other answers imply that Clang use Binutils(as and ld) to generate and link native code(I'm not quite sure about this). If so, how could Clang release under BSD like license? I can't find any license exception(like Bison Exception) about ld or as.

If I misunderstand some concepts, please forgive me! BTW, could we use GNU as and ld in programmatically way?

EDIT: Thanks for these answers. It seems that clang still not a standalone toolchain and have to use VS or GNU tools. Does it mean if someone write a compiler based on llvm. If users didn't install GNU or VS tools. The compiler is not a out-of-the-box compiler?

1
  • Could you ask your edit question as a new question? That said, consider that on a Mac (for example), the toolchain does not contain GNU software - its clang, llvm, and ld makes no mention GNU (BSD, Darwin, Mach - yes, but no GNU).
    – user40980
    Commented Nov 19, 2013 at 4:01

2 Answers 2

4

AFAIK (though I am not a lawyer), running a GPL'd application from the command line or similar does not count as derivative work. Aside from that, the LLD subproject is creating a similarly-licensed linker. Although I don't think it's used by Clang yet.

2
  • Yes, the focus of the free software movement's discussion on derivative works has always been on in-process static and dynamic linking, and of course code modifications. I don't recall ever hearing running an external process being considered to be making a derivative work. Commented Nov 16, 2013 at 20:38
  • @RobinGreen the bison exception kicks in because the product is a derivative work of the .y file that you wrote, and the parser generator that some human wrote that is copied wholesale into the output of bison.
    – user40980
    Commented Nov 17, 2013 at 2:24
1

I am not a lawyer. To get an authoritative answer on this, I would dig around FreeBSD.org to find the contact information for a lawyer for that project. All that follows is a layman's understanding of copyrights - in particular derivative works and the originality requirement.

In order for something to be copyrighted, it must show some amount of original material in it (wiki: threshold of originality, uslegal.com originality in copyright) . It cannot be a purely mechanical transformation.

Taking the assembly code produce by clang and linking it against existing libraries do not meet this threshold. This is no different really than a compiler taking the source (that you write - original, has a copyright) and mechanically translating it to assembly. There is no creativity in this process, the produced output of clang (or gcc, or ld) is not something that incorporates material that is under another license, there is no exception needed as part of the process to create code.

Just think for a moment the implications if this wasn't the case. Every program that was linked on a linux system (using ld from gnu bin tools) would need to be free (libre) under the gpl. You would be required to distribute the source of every program. This would cripple the possibility of commercial code development on linux, and well... you wouldn't have any games for Linux.

So, because the process of creating a linked executable from assembly (or assembly from some language) does not have any originality to it, the product isn't a derivative work of the program (or the author of the program - read more on this in that small text block up next), and the license of the original work does not change.


Tangentially related, music that is composed by a computer is an interesting area of law being settled currently. From Music Tracks to Google Maps: Who owns computer-generated works? and MIDI Files: Copyright Protection for Computer- Generated Works are likely good reads if you want to get into the level of being able to talk to lawyers directly about things.


This is where the bison exception gets into play (gnu.org FAQ Can I use GPL-covered editors such as GNU Emacs to develop non-free programs? Can I use GPL-covered tools such as GCC to compile them?, gnu.org Conditions for Using Bison). The code that bison generates, while being a transformation of the .y file that bison reads, the created code also includes a substantial part of material that is copyrightable and covered under the GPL. Thus, the final output would be considered a derivative work of the two (the .y file, and the parser generator that was written by some human and embedded in bison itself).

Since the code within bison is under the gpl, the impact of this without the bison exception would mean that every derivative work created (all of them) would also be under the gpl. The final generated code is still a derivative work, but it isn't required to be GPL'ed.

I would point out that the bison exception refers to the product of bison. If one was to take the raw code out of bison and use it in some other way that isn't a product of bison, it is still covered by the GPL.

Additional note, Free BSD still uses binutils 2.15 (from 2004) because of difficulties meshing gpl v3 with the BSD license (2.15 is under v2, there is work being done to get binutils 2.17 which is the last released version under gpl v2 - see FreeBSD wiki - Bintuils 2.17).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.