2013-12-29 00:31:44 +01:00
|
|
|
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/gold.exports)
|
|
|
|
|
2014-12-05 18:25:52 +01:00
|
|
|
if( LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR )
|
2011-03-11 16:44:24 +01:00
|
|
|
include_directories( ${LLVM_BINUTILS_INCDIR} )
|
|
|
|
|
2014-06-19 23:14:13 +02:00
|
|
|
set(LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_TARGETS_TO_BUILD}
|
2014-08-21 22:28:55 +02:00
|
|
|
Linker
|
[ThinLTO/gold] Handle bitcode archives
Summary:
Several changes were required for ThinLTO links involving bitcode
archive static libraries. With this patch clang/llvm bootstraps with
ThinLTO and gold.
The first is that the gold callbacks get_input_file and
release_input_file can normally be used to get file information for
each constituent bitcode file within an archive. However, these
interfaces lock the underlying file and can't be for each archive
constituent for ThinLTO backends where we get all the input files up
front and don't release any until after the backend threads complete.
However, it is sufficient to only get and release once per file, and
then each consituent bitcode file can be accessed via get_view. This
required saving some information to identify which file handle is the
"leader" for each claimed file sharing the same file descriptor, and
other information so that get_input_file isn't necessary later when
processing the backends.
Second, the module paths in the index need to distinguish between
different constituent bitcode files within the same archive file,
otherwise they will all end up with the same archive file path.
Do this by appending the offset within the archive for the start of the
bitcode file, returned by get_input_file when we claim each bitcode file,
and saving that along with the file handle.
Third, rather than have the function importer try to load a file based
on the module path identifier (which now contains a suffix to
distinguish different bitcode files within an archive), use a custom
module loader. This is the same approach taken in libLTO, and I am using
the support refactored into the new LTO.h header in r270509. The module
loader parses the bitcode files out of the memory buffers returned from
gold via the get_view callback and saved in a map. This also means that
we call the function importer directly, rather than add it to the pass
pipeline (which was in the plan to do already for other reasons).
Reviewers: pcc, joker.eph
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D20559
llvm-svn: 270814
2016-05-26 03:46:41 +02:00
|
|
|
LTO
|
2014-08-21 22:28:55 +02:00
|
|
|
BitWriter
|
|
|
|
IPO
|
2014-06-19 23:14:13 +02:00
|
|
|
)
|
2011-03-11 16:44:24 +01:00
|
|
|
|
2018-12-20 23:04:08 +01:00
|
|
|
add_llvm_library(LLVMgold MODULE
|
2011-03-11 16:44:24 +01:00
|
|
|
gold-plugin.cpp
|
|
|
|
)
|
2014-01-10 23:48:35 +01:00
|
|
|
|
2014-01-10 23:55:25 +01:00
|
|
|
endif()
|