brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 36a7368 Raw
76 lines · c
1// REQUIRES: x86-registered-target2 3// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -emit-llvm < %s  | FileCheck %s --check-prefixes=FULL,SPLIT4// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -emit-llvm < %s  | FileCheck %s --check-prefixes=FULL,SPLIT5 6// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -fsplit-lto-unit -ffat-lto-objects -emit-llvm < %s  | FileCheck %s --check-prefixes=THIN,SPLIT7// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -ffat-lto-objects -emit-llvm < %s  | FileCheck %s --check-prefixes=THIN,NOSPLIT8 9// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -emit-obj < %s -o %t.full.split.o10// RUN: llvm-readelf -S %t.full.split.o | FileCheck %s --check-prefixes=ELF11// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.full.split.bc %t.full.split.o12// RUN: llvm-dis %t.full.split.bc -o - | FileCheck %s --check-prefixes=FULL,SPLIT,NOUNIFIED13 14/// Full LTO always sets EnableSplitLTOUnit when the summary is used.15// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -emit-obj < %s -o %t.full.nosplit.o16// RUN: llvm-readelf -S %t.full.nosplit.o | FileCheck %s --check-prefixes=ELF17// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.full.nosplit.bc %t.full.nosplit.o18// RUN: llvm-dis %t.full.nosplit.bc -o - | FileCheck %s --check-prefixes=FULL,SPLIT,NOUNIFIED19 20// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -fsplit-lto-unit -ffat-lto-objects -emit-obj < %s -o %t.thin.split.o21// RUN: llvm-readelf -S %t.thin.split.o | FileCheck %s --check-prefixes=ELF22// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.thin.split.bc %t.thin.split.o23// RUN: llvm-dis %t.thin.split.bc -o - | FileCheck %s --check-prefixes=THIN,SPLIT,NOUNIFIED24 25// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -ffat-lto-objects -emit-obj < %s -o %t.thin.nosplit.o26// RUN: llvm-readelf -S %t.thin.nosplit.o | FileCheck %s --check-prefixes=ELF27// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.thin.nosplit.bc %t.thin.nosplit.o28// RUN: llvm-dis %t.thin.nosplit.bc -o -  | FileCheck %s --check-prefixes=THIN,NOSPLIT,NOUNIFIED29 30// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=thin -funified-lto -ffat-lto-objects -emit-obj < %s -o %t.unified.o31// RUN: llvm-readelf -S %t.unified.o | FileCheck %s --check-prefixes=ELF32// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.unified.bc %t.unified.o33// RUN: llvm-dis %t.unified.bc -o - | FileCheck %s --check-prefixes=THIN,NOSPLIT,UNIFIED34 35// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -flto=full -ffat-lto-objects -fsplit-lto-unit -S < %s -o - \36// RUN: | FileCheck %s --check-prefixes=ASM37 38/// Make sure that FatLTO generates .llvm.lto sections that are the same as the output from normal LTO compilations39// RUN: %clang -O2 --target=x86_64-unknown-linux-gnu -fPIE -flto=full -ffat-lto-objects -c %s -o %t.fatlto.full.o40// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.fatlto.full.bc %t.fatlto.full.o41// RUN: llvm-dis < %t.fatlto.full.bc -o %t.fatlto.full.ll42// RUN: %clang -O2 --target=x86_64-unknown-linux-gnu -fPIE -flto=full -c %s -o %t.nofat.full.bc43// RUN: llvm-dis < %t.nofat.full.bc -o %t.nofat.full.ll44// RUN: diff %t.fatlto.full.ll %t.nofat.full.ll45 46// RUN: %clang -O2 --target=x86_64-unknown-linux-gnu -fPIE -flto=thin -ffat-lto-objects -c %s -o %t.fatlto.thin.o47// RUN: llvm-objcopy --dump-section=.llvm.lto=%t.fatlto.thin.bc %t.fatlto.thin.o48// RUN: llvm-dis < %t.fatlto.thin.bc -o %t.fatlto.thin.ll49// RUN: %clang -O2 --target=x86_64-unknown-linux-gnu -fPIE -flto=thin -c %s -o %t.nofat.thin.bc50// RUN: llvm-dis < %t.nofat.thin.bc -o %t.nofat.thin.ll51// RUN: diff %t.fatlto.thin.ll %t.nofat.thin.ll52 53/// Be sure we enable split LTO units correctly under -ffat-lto-objects.54//   SPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 1}55// NOSPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 0}56 57// FULL-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}58// THIN-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}59 60// UNIFIED: ![[#]] = !{i32 1, !"UnifiedLTO", i32 1}61// NOUNIFIED-NOT: ![[#]] = !{i32 1, !"UnifiedLTO", i32 1}62 63// ELF: .llvm.lto64 65//      ASM: .section        .llvm.lto,"e",@llvm_lto66// ASM-NEXT: .Lllvm.embedded.object:67// ASM-NEXT:        .asciz  "BC68// ASM-NEXT: .size   .Lllvm.embedded.object69 70const char* foo = "foo";71 72int test(void) {73  const char* bar = "bar";74  return 0xabcd;75}76