📜 ⬆️ ⬇️

Exception for GCC runtime libraries or why Clang still lacks OpenMP support

Using GCC in a closed source project? Do you use OpenMP? You know that the library libgomp, with which all OpenMP programs are linked, is distributed under the terms of GPLv3 ? Be so kind, open your source ...

Fortunately, you do not need to open anything, except that a can of beer. Indeed, the "kit" of GCC runtime, for example libstdc ++ or libgomp, has a GPL license, however there is a special exception for the GCC runtime libraries . It permits the use of the libraries listed in the FAQ in commercial applications with a small disclaimer: they should be compiled only by the GPL-compatible compiler (including GCC). In other words, building with libgomp when building with a proprietary compiler is a violation of the GPL.

The Clang / LLVM BSD-like license is compatible with the GPL, but the introduction of libgomp automatically enhances it to the GPL and prevents the creation of closed forks (for which big companies love this technology stack so much). It turns out that because of the caveat about the GPL , Clang still lacks OpenMP , because adding such support would mean creating a runtime from scratch. However, in this situation, Intel has jumped around in time to open the source code of its OpenMP implementation under the BSD license, compatible with the Clang license, and almost added support for OpenMP in LLVM . Unfortunately, all the same questions remain, for example, Intel OpenMP worked all his life under x86 (-64), and it is not clear how he is doing with ARM.

Also, due to the exception to the GCC libraries, Clang / LLVM had to write from scratch its libstdc ++ (aka libc ++) and libgcov (aka llvm-cov - a tool for analyzing code coverage with tests).
')
It is worth being mentally prepared for the abolition of this exception, albeit an unlikely one. GCC has once moved from GPLv2 to GPLv3, as a result of which Apple changed the official compiler to Clang and began to actively improve it, taking on the main developer Chris Luttner. The text of the exception itself says that this is a necessary measure, because “the ban would probably have negative consequences for ourselves, and because if small libraries were used to limit the use of GCC, it would look like a tail wagging the dog. " Perhaps, when all large companies, following Apple, exchange GCC for Clang, the consequences will no longer be so negative ...

Source: https://habr.com/ru/post/184096/


All Articles