[llvm-commits] PATCH: Inserting LLVM code inside compiler-rt libraries

Alexey Samsonov samsonov at google.com
Thu Aug 2 10:59:36 PDT 2012


Hi, llvm-commits

Here: http://codereview.appspot.com/6458066/ is the short experimental
FYI-patch that allows LLVM sources to be "compiled into" static compiler-rt
libraries in CMake build system.
(I'm not sure that is smart enough to capture all dependencies, though).
With something that simple we can:
1) directly use LLVM code from compiler-rt libraries.
2) workaround the unavailable compilation of llvm libraries for several
targets: each static compiler-rt lib will contain its own private copy of
LLVM libs, compiled for necessary target and with necessary compile flags.

And there are multiple drawbacks:
1) License issues (LLVM code has binary redistribution clause, right? So
everything built with "clang -faddress-sanitizer" would attribute LLVM
license, gr-r-r).
2) Static ASan runtime is now 10x larger (2,5M vs 250K), while most of its
functionality (various stuff from LLVMSupport) is not needed.
3) Symbol name clashes - suppose one want to build something with ASan and
link against "normal" version of LLVMSupport. (can compiling the code with
-fvisibility=hidden, as we currently do, help with this?)

Does this direction look promising to you? Maybe, we should turn to using
DSO instead? Citing Benjamin's suggestion from old thread:
"You want to create a new .so which links the .a files from LLVM and
doesn't export LLVM's symbols. This is another advantage of using .so over
.a, think of what will happen when you want to link LLVM trunk with asan
which is using a different version of LLVM. LLVM's symbols are not
versioned. With a DSO you can just hide all symbols except a couple of
entry points for your purposes and none of the symbols will collide."

Or can we try the following path:
1) fetch all the sources from LLVM libraries we're interested in (e.g, for
symbolization we need sources from DebugInfo and Support) as in the
provided patch.
2) write an interface file that would contain all entry points and describe
usage patterns of these libs.
3) compile these sources and interface with flags we want and for targets
we want, make a DSO, hide all non-interface symbols.
4) store this DSO next to static asan runtime, and link it on demand?

-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120802/94fb6eb3/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: issue6458066_1.diff
Type: application/octet-stream
Size: 2721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120802/94fb6eb3/attachment.obj>


More information about the llvm-commits mailing list