llvm/tools
Rafael Espindola 3fd7e37b34 Rewrite the gold plugin to fix pr19901.
There is a fundamental difference between how the gold API and lib/LTO view
the LTO process.

The gold API talks about a particular symbol in a particular file. The lib/LTO
API talks about a symbol in the merged module.

The merged module is then defined in terms of the IR semantics. In particular,
a linkonce_odr GV is only copied if it is used, since it is valid to drop
unused linkonce_odr GVs.

In the testcase in pr19901 both properties collide. What happens is that gold
asks us to keep a particular linkonce_odr symbol, but the IR linker doesn't
copy it to the merged module and we never have a chance to ask lib/LTO to keep
it.

This patch fixes it by having a more direct implementation of the gold API. If
it asks us to keep a symbol, we change the linkage so it is not linkonce. If it
says we can drop a symbol, we do so. All of this before we even send the module
to lib/Linker.

Since now we don't have to produce LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN,
during symbol resolution we can use a temporary LLVMContext and do lazy
module loading. This allows us to keep the minimum possible amount of
allocated memory around. This should also allow as much parallelism as
we want, since there is no shared context.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216215 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 20:28:55 +00:00
..
bugpoint Handle inlining in populateLTOPassManager like in populateModulePassManager. 2014-08-21 13:35:30 +00:00
bugpoint-passes [CMake] Add LLVM_LINK_COMPONENTS to loadable modules, LLVMHello and BugpointPasses, on Win32. 2014-07-13 13:36:48 +00:00
gold Rewrite the gold plugin to fix pr19901. 2014-08-21 20:28:55 +00:00
llc Remove the TargetMachine forwards for TargetSubtargetInfo based 2014-08-04 21:25:23 +00:00
lli Quick fix for an use after free. 2014-08-20 15:19:37 +00:00
llvm-ar Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-as Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
llvm-bcanalyzer Remove some calls to std::move. 2014-08-01 14:31:55 +00:00
llvm-c-test Convert getFileOffset to getOffset and move it to its only user. 2014-04-21 13:45:32 +00:00
llvm-config Change llvm-config --ldflags to report ${CMAKE_CXX_LINK_FLAGS} 2014-04-25 01:44:20 +00:00
llvm-cov llvm-cov: move the gcov code into a separate file. 2014-07-28 18:03:51 +00:00
llvm-diff Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
llvm-dis Remove 'using std::error_code' from tools. 2014-06-13 03:07:50 +00:00
llvm-dwarfdump Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-extract Use range loops. 2014-05-08 19:30:17 +00:00
llvm-jitlistener IntelJITEventListener updates to fix breaks by recent changes to EngineBuilder and DIContext. 2014-08-21 07:01:55 +00:00
llvm-link raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary. 2014-04-29 23:26:49 +00:00
llvm-lto Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt. 2014-07-15 11:37:03 +00:00
llvm-mc Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
llvm-mcmarkup Update the MemoryBuffer API to use ErrorOr. 2014-07-06 17:43:13 +00:00
llvm-nm Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-objdump Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-profdata Support: Fix option handling when using cl::Required with aliasopt 2014-07-14 20:53:57 +00:00
llvm-readobj Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-rtdyld Temporarily Revert "Nuke the old JIT." as it's not quite ready to 2014-08-07 22:02:54 +00:00
llvm-shlib Revert of 214418: 2014-08-01 06:16:03 +00:00
llvm-size Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-stress raw_ostream: Forward declare OpenFlags and include FileSystem.h only where necessary. 2014-04-29 23:26:49 +00:00
llvm-symbolizer Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
llvm-vtabledump Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
lto Remove lto_codegen_set_attr. 2014-08-01 14:57:05 +00:00
macho-dump Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
msbuild msbuild integration: remove duplicated lines and BOM from 2014 integration (PR20341) 2014-07-31 20:33:22 +00:00
obj2yaml Don't own the buffer in object::Binary. 2014-08-19 18:44:46 +00:00
opt Move some logic to populateLTOPassManager. 2014-08-21 20:03:44 +00:00
verify-uselistorder IR: Implement uselistorder assembly directives 2014-08-19 21:30:15 +00:00
yaml2obj Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
CMakeLists.txt Rename llvm-uselistorder => verify-uselistorder 2014-07-30 17:11:27 +00:00
LLVMBuild.txt Rename llvm-uselistorder => verify-uselistorder 2014-07-30 17:11:27 +00:00
Makefile Rename llvm-uselistorder => verify-uselistorder 2014-07-30 17:11:27 +00:00