• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as <%s >%t1
2; RUN: llvm-lto -exported-symbol=_uses_puts -exported-symbol=_uses_printf -o - %t1 | \
3; RUN: llvm-nm - | \
4; RUN: FileCheck %s
5; rdar://problem/16165191
6; runtime library implementations should not be renamed
7
8target triple = "x86_64-apple-darwin11"
9
10@str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
11
12; CHECK-NOT: U _puts
13; CHECK: T _uses_printf
14; CHECK: T _uses_puts
15define i32 @uses_puts(i32 %i) {
16entry:
17  %s = call i8* @foo(i32 %i)
18  %ret = call i32 @puts(i8* %s)
19  ret i32 %ret
20}
21define i32 @uses_printf(i32 %i) {
22entry:
23  %s = getelementptr [13 x i8], [13 x i8]* @str, i64 0, i64 0
24  call i32 (i8*, ...) @printf(i8* %s)
25  ret i32 0
26}
27
28define hidden i32 @printf(i8* readonly nocapture %fmt, ...) {
29entry:
30  %ret = call i32 @bar(i8* %fmt)
31  ret i32 %ret
32}
33define hidden i32 @puts(i8* %s) {
34entry:
35  %ret = call i32 @bar(i8* %s)
36  ret i32 %ret
37}
38
39declare i8* @foo(i32)
40declare i32 @bar(i8*)
41