56 lines · plain
1; REQUIRES: x86-registered-target2; Compile with thinlto indices, to enable thinlto.3; RUN: opt -module-summary %s -o %t1.bc4 5; Test old lto interface with thinlto.6; RUN: llvm-lto -exported-symbol=main -thinlto-action=run %t1.bc7; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=CHECK-NM8 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,pl15; RUN: llvm-nm %t.out.1 | FileCheck %s --check-prefix=CHECK-NM16 17; Re-compile, this time without the thinlto indices.18; RUN: opt %s -o %t4.bc19 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,pl26; RUN: llvm-nm %t5.out.0 | FileCheck %s --check-prefix=CHECK-NM27 28; Test the old lto interface without thinlto.29; RUN: llvm-lto -exported-symbol=main %t4.bc -o %t630; RUN: llvm-nm %t6 | FileCheck %s --check-prefix=CHECK-NM31 32; CHECK-NM-NOT: bar33; CHECK-NM: T __stack_chk_fail34; CHECK-NM: D __stack_chk_guard35; Allow calloc to be internalized so --gc-sections can36; still eliminate it if it's not really used anywhere.37; CHECK-NM: {{[Tt]}} calloc38; CHECK-NM-NOT: bar39 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 void45}46 47@__stack_chk_guard = dso_local global i64 1, align 848 49define void @__stack_chk_fail() {50 ret void51}52 53define ptr @calloc(i64, i64) {54 ret ptr null55}56