llvm-project/llvm/lib
Duncan P. N. Exon Smith 43ea3478bf LTO: add API to set strategy for -internalize
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>

llvm-svn: 199191
2014-01-14 06:37:26 +00:00
..
Analysis [PM] Split DominatorTree into a concrete analysis result object which 2014-01-13 13:07:17 +00:00
AsmParser Move the LLVM IR asm writer header files into the IR directory, as they 2014-01-07 12:34:26 +00:00
Bitcode Update getLazyBitcodeModule to use ErrorOr for error handling. 2014-01-13 18:31:04 +00:00
CodeGen Always let value types influence register classes. 2014-01-14 06:18:38 +00:00
DebugInfo llvm-dwarfdump: type unit dwo support 2014-01-09 05:08:24 +00:00
ExecutionEngine Re-sort #include lines again, prior to moving headers around. 2014-01-13 08:04:33 +00:00
IR Fix llc to not reuse spill slots in functions that invoke setjmp() 2014-01-14 04:20:01 +00:00
IRReader Update getLazyBitcodeModule to use ErrorOr for error handling. 2014-01-13 18:31:04 +00:00
LTO LTO: add API to set strategy for -internalize 2014-01-14 06:37:26 +00:00
Linker Revert "Move copying of global initializers below the cloning of functions." 2013-11-09 00:43:18 +00:00
MC Replace .mips_hack_stocg with ".set micromips" and ".set nomicromips". 2014-01-14 04:25:13 +00:00
Object Re-sort all of the includes with ./utils/sort_includes.py so that 2014-01-07 11:48:04 +00:00
Option Avoid buffer copies when a Twine already is a StringRef. 2013-12-03 18:18:28 +00:00
Support raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would barf wide chars after llvm::errs(). 2014-01-12 16:14:24 +00:00
TableGen [TableGen] Correctly generate implicit anonymous prototype defs in multiclasses 2014-01-02 20:47:09 +00:00
Target Switch the NEON register class from QPR to DPair. 2014-01-14 06:18:34 +00:00
Transforms LTO: add API to set strategy for -internalize 2014-01-14 06:37:26 +00:00
CMakeLists.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
LLVMBuild.txt Move LTO support library to a component, allowing it to be tested 2013-09-24 23:52:22 +00:00
Makefile Reformat Makefile. No other changes. 2013-10-30 04:03:03 +00:00