llvm-6502/tools
Duncan P. N. Exon Smith 3e4542b2ca Reapply "LTO: add API to set strategy for -internalize"
Reapply r199191, reverted in r199197 because it carelessly broke
Other/link-opts.ll.  The problem was that calling
createInternalizePass("main") would select
createInternalizePass(bool("main")) instead of
createInternalizePass(ArrayRef<const char *>("main")).  This commit
fixes the bug.

The original commit message follows.

Add API to LTOCodeGenerator to specify a strategy for the -internalize
pass.

This is a new attempt at Bill's change in r185882, which he reverted in
r188029 due to problems with the gold linker.  This puts the onus on the
linker to decide whether (and what) to internalize.

In particular, running internalize before outputting an object file may
change a 'weak' symbol into an internal one, even though that symbol
could be needed by an external object file --- e.g., with arclite.

This patch enables three strategies:

- LTO_INTERNALIZE_FULL: the default (and the old behaviour).
- LTO_INTERNALIZE_NONE: skip -internalize.
- LTO_INTERNALIZE_HIDDEN: only -internalize symbols with hidden
  visibility.

LTO_INTERNALIZE_FULL should be used when linking an executable.

Outputting an object file (e.g., via ld -r) is more complicated, and
depends on whether hidden symbols should be internalized.  E.g., for
ld -r, LTO_INTERNALIZE_NONE can be used when -keep_private_externs, and
LTO_INTERNALIZE_HIDDEN can be used otherwise.  However,
LTO_INTERNALIZE_FULL is inappropriate, since the output object file will
eventually need to link with others.

lto_codegen_set_internalize_strategy() sets the strategy for subsequent
calls to lto_codegen_write_merged_modules() and lto_codegen_compile*().

<rdar://problem/14334895>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199244 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-14 18:52:17 +00:00
..
bugpoint [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
bugpoint-passes Set LLVM_EXPORTED_SYMBOL_FILE in CMakeLists whose corresponding Makefiles do so. 2013-12-29 23:06:49 +00:00
gold Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
llc Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
lli Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
llvm-ar Handle UIDs and GIDs that don't fit in 6 decimal places. 2014-01-14 17:02:09 +00:00
llvm-as [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
llvm-bcanalyzer [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
llvm-c-test Use -std=gnu99 in tools/llvm-c-test/CMakeLists.txt 2014-01-08 11:48:19 +00:00
llvm-config llvm-config: Fix typo in help message introduced with r197664. 2013-12-25 02:24:32 +00:00
llvm-cov llvm-cov: Added -f option for function summaries. 2013-12-19 00:29:25 +00:00
llvm-diff [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-dis Move the LLVM IR asm writer header files into the IR directory, as they 2014-01-07 12:34:26 +00:00
llvm-dwarfdump llvm-dwarfdump: type unit dwo support 2014-01-09 05:08:24 +00:00
llvm-extract [PM] Wire up support for writing bitcode with new PM. 2014-01-13 07:38:24 +00:00
llvm-jitlistener Manually update the dependencies in the Makefiles. It turns out that all 2013-03-26 03:45:47 +00:00
llvm-link [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
llvm-lto Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
llvm-mc [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-mcmarkup MC: Simple example parser for MC assembly markup. 2012-10-31 23:24:13 +00:00
llvm-nm [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-objdump [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-readobj [cleanup] Add a missing include exposed by resorting other includes. 2014-01-13 08:09:47 +00:00
llvm-rtdyld [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-shlib Strip dead code when linking by default with BFD ld (linux, ...) and ld64 (os x). 2013-12-27 22:38:59 +00:00
llvm-size [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
llvm-stress [cleanup] Move the Dominators.h and Verifier.h headers into the IR 2014-01-13 09:26:24 +00:00
llvm-symbolizer Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
lto Reapply "LTO: add API to set strategy for -internalize" 2014-01-14 18:52:17 +00:00
macho-dump [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
msbuild VS integration: use the correct registry key after r195379 2013-11-22 18:25:43 +00:00
obj2yaml [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
opt [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
yaml2obj [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt. 2013-12-10 11:13:32 +00:00
CMakeLists.txt llvm/tools/llvm-c-test should be built also on msvc. 2013-10-23 17:56:59 +00:00
LLVMBuild.txt Remove the very substantial, largely unmaintained legacy PGO 2013-10-02 15:42:23 +00:00
Makefile Add llvm-c-test tool for testing llvm-c 2013-10-23 08:10:20 +00:00