llvm/tools
Bill Wendling 97d9903236 The internalize pass can be dangerous for LTO.
Consider the following program:

$ cat main.c
void foo(void) { }

int main(int argc, char *argv[]) {
    foo();
    return 0;
}
$ cat bundle.c 
extern void foo(void);

void bar(void) {
     foo();
}
$ clang -o main main.c
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
$ nm -m bundle.so
0000000000000f40 (__TEXT,__text) external _bar
                 (undefined) external _foo (from executable)
                 (undefined) external dyld_stub_binder (from libSystem)
$ clang -o main main.c -O4
$ clang -o bundle.so bundle.c -bundle -bundle_loader ./main
Undefined symbols for architecture x86_64:
  "_foo", referenced from:
      _bar in bundle-elQN6d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The linker was told that the 'foo' in 'main' was 'internal' and had no uses, so
it was dead stripped.

Another situation is something like:

define void @foo() {
  ret void
}

define void @bar() {
  call asm volatile "call _foo" ...
  ret void
}

The only use of 'foo' is inside of an inline ASM call. Since we don't look
inside those for uses of functions, we don't specify this as a "use."

Get around this by not invoking the 'internalize' pass by default. This is an
admitted hack for LTO correctness.
<rdar://problem/11185386>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154124 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05 21:26:44 +00:00
..
bugpoint Remove the C backend. 2012-03-23 05:50:46 +00:00
bugpoint-passes build: Tidy up a bunch of tool Makefiles, and simplify where possible using the 2011-10-18 19:27:24 +00:00
gold drop unneeded config.h includes 2011-12-22 23:04:07 +00:00
llc RegAlloc superpass: includes phi elimination, coalescing, and scheduling. 2012-02-10 04:10:36 +00:00
lli Add profiling support for Intel Parallel Amplifier XE (VTune) for JITted code in LLVM. 2012-03-13 08:33:15 +00:00
llvm-ar LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-as LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-bcanalyzer fix PR12301 - llvm-bcanalyze should print to stdout, not stderr (except for errors). 2012-03-19 23:40:48 +00:00
llvm-config An easy case where GCC should really be able to work out that the value is only 2012-02-23 08:25:25 +00:00
llvm-cov LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-diff llvm::SwitchInst 2012-03-11 06:09:17 +00:00
llvm-dis Enable streaming of bitcode 2012-02-06 22:30:29 +00:00
llvm-dwarfdump LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-extract Remove extraneous ".get()->" which is just "->". No functionality change. 2011-12-30 19:17:23 +00:00
llvm-ld Remove dead code. Improve llvm_unreachable text. Simplify some control flow. 2012-02-19 11:37:01 +00:00
llvm-link LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-mc Make MCInstrInfo available to the MCInstPrinter. This will be used to remove getInstructionName and the static data it contains since the same tables are already in MCInstrInfo. 2012-04-02 06:09:36 +00:00
llvm-nm Fix uses of the C99 PRI format macros not to conflict with C++11 UDLs. 2012-03-10 02:04:38 +00:00
llvm-objdump Make MCInstrInfo available to the MCInstPrinter. This will be used to remove getInstructionName and the static data it contains since the same tables are already in MCInstrInfo. 2012-04-02 06:09:36 +00:00
llvm-prof LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-ranlib LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-readobj Fix uses of the C99 PRI format macros not to conflict with C++11 UDLs. 2012-03-10 02:04:38 +00:00
llvm-rtdyld Re-factored RuntimeDyLd: 2012-03-30 16:45:19 +00:00
llvm-shlib Set soname for FreeBSD as well. 2012-04-03 19:48:31 +00:00
llvm-size LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
llvm-stress Fix some stray semi-colons. 2012-02-29 00:20:33 +00:00
llvm-stub LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
lto The internalize pass can be dangerous for LTO. 2012-04-05 21:26:44 +00:00
macho-dump LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
opt Add a basic-block autovectorization pass. 2012-02-01 03:51:43 +00:00
CMakeLists.txt [Object] 2012-03-01 01:36:50 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile [Object] 2012-03-01 01:36:50 +00:00