1; REQUIRES: x86-registered-target 2; Compile with thinlto indices, to enable thinlto. 3; RUN: opt -module-summary %s -o %t1.bc 4 5; Test old lto interface with thinlto. 6; RUN: llvm-lto -exported-symbol=main -thinlto-action=run %t1.bc 7; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=CHECK-NM 8 9; Test new lto interface with thinlto. 10; RUN: llvm-lto2 run %t1.bc -o %t.out -save-temps \ 11; RUN: -r %t1.bc,bar,pl \ 12; RUN: -r %t1.bc,__stack_chk_guard,pl \ 13; RUN: -r %t1.bc,__stack_chk_fail,pl \ 14; RUN: -r %t1.bc,calloc,pl 15; RUN: llvm-nm %t.out.1 | FileCheck %s --check-prefix=CHECK-NM 16 17; Re-compile, this time without the thinlto indices. 18; RUN: opt %s -o %t4.bc 19 20; Test the new lto interface without thinlto. 21; RUN: llvm-lto2 run %t4.bc -o %t5.out -save-temps \ 22; RUN: -r %t4.bc,bar,pl \ 23; RUN: -r %t4.bc,__stack_chk_guard,pl \ 24; RUN: -r %t4.bc,__stack_chk_fail,pl \ 25; RUN: -r %t4.bc,calloc,pl 26; RUN: llvm-nm %t5.out.0 | FileCheck %s --check-prefix=CHECK-NM 27 28; Test the old lto interface without thinlto. 29; RUN: llvm-lto -exported-symbol=main %t4.bc -o %t6 30; RUN: llvm-nm %t6 | FileCheck %s --check-prefix=CHECK-NM 31 32; CHECK-NM-NOT: bar 33; CHECK-NM: T __stack_chk_fail 34; CHECK-NM: D __stack_chk_guard 35; Allow calloc to be internalized so --gc-sections can 36; still eliminate it if it's not really used anywhere. 37; CHECK-NM: {{[Tt]}} calloc 38; CHECK-NM-NOT: bar 39 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 41target triple = "x86_64-unknown-linux-gnu" 42 43define void @bar() { 44 ret void 45} 46 47@__stack_chk_guard = dso_local global i64 1, align 8 48 49define void @__stack_chk_fail() { 50 ret void 51} 52 53define ptr @calloc(i64, i64) { 54 ret ptr null 55} 56