llvm-6502/include/llvm-c
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
..
Transforms Add a Scalarizer pass. 2013-11-22 16:58:05 +00:00
Analysis.h
BitReader.h include/llvm-c: Whitespace. 2013-10-23 17:56:29 +00:00
BitWriter.h include/llvm-c: Whitespace. 2013-10-23 17:56:29 +00:00
Core.h Decouple dllexport/dllimport from linkage 2014-01-14 15:22:47 +00:00
Disassembler.h For the 'C' disassembler API, add a new ReferenceType for the 2014-01-06 22:08:08 +00:00
ExecutionEngine.h include/llvm-c: Whitespace. 2013-10-23 17:56:29 +00:00
Initialization.h Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation for refactoring the ARC Optimizer. 2013-01-28 01:35:51 +00:00
IRReader.h [llvm-c] Expose IRReader interface 2013-11-06 09:21:15 +00:00
Linker.h
LinkTimeOptimizer.h include/llvm-c: Whitespace. 2013-10-23 17:56:29 +00:00
lto.h Reapply "LTO: add API to set strategy for -internalize" 2014-01-14 18:52:17 +00:00
Object.h include/llvm-c: Whitespace. 2013-10-23 17:56:29 +00:00
Support.h Make sure LLVMLoadLibraryPermanently gets an extern "C" symbol. 2013-11-13 15:35:13 +00:00
Target.h [llvm-c] Remove dead typedef 2013-11-11 14:47:01 +00:00
TargetMachine.h Whitespace. 2014-01-10 11:12:01 +00:00