[PATCH] LTO: add API to set strategy for -internalize

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Jan 10 13:29:33 PST 2014


Hi Bill,

This patch adds API to LTOCodeGenerator to specify a strategy for the
-internalize pass.

This is a new attempt at your change in r185882, which you 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_NOWEAK: skip weak symbols in -internalize.
- LTO_INTERNALIZE_NONE: skip -internalize entirely.

They are exposed to the LTO C-API through a new method,
lto_codegen_set_internalize_strategy().  It affects the behaviour of
lto_codegen_write_merged_modules() and lto_codegen_compile*().

<rdar://problem/14334895>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lto-internalize-noweak.patch
Type: application/octet-stream
Size: 19542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140110/7c5bc6ad/attachment.obj>


More information about the llvm-commits mailing list