brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 7ec094d Raw
117 lines · plain
1;; Basic FatLTO tests.2; REQUIRES: x863 4; RUN: rm -rf %t && split-file %s %t && cd %t5 6;; Ensure that input files contain .llvm.lto section.7; RUN: llc a-LTO.ll --filetype=obj -o a-fatLTO.o --relocation-model=pic8; RUN: opt < a-LTO.ll --module-summary -o a-fatLTO.bc9; RUN: llvm-objcopy --add-section=.llvm.lto=a-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c a-fatLTO.o10 11; RUN: llc main-LTO.ll --filetype=obj -o main-fatLTO.o --relocation-model=pic12; RUN: opt < main-LTO.ll --module-summary -o main-fatLTO.bc13; RUN: llvm-objcopy --add-section=.llvm.lto=main-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c main-fatLTO.o14 15; RUN: llvm-readelf -S a-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s16; RUN: llvm-readelf -S main-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s17 18;; Make sure that the section flags are set correctly19; HAS_LLVM_LTO: Name Type Address Off Size ES Flg Lk Inf Al20; HAS_LLVM_LTO: .llvm.lto LLVM_LTO {{.*}} 00  WE  0   0  121 22;; Final executable should not have .llvm.lto section no matter what the target is.23; RUN: ld.lld -o foo-fatLTO a-fatLTO.o main-fatLTO.o --fat-lto-objects24; RUN: llvm-readelf -S foo-fatLTO | FileCheck --check-prefix=CHECK-LTO-TARGET %s25 26;; Check that fat objects work w/ --start-lib.27; RUN: ld.lld -o foo-fatLTO.start_lib --start-lib a-fatLTO.o main-fatLTO.o --fat-lto-objects28; RUN: llvm-readelf -S foo-fatLTO.start_lib | FileCheck --check-prefix=CHECK-LTO-TARGET %s29 30;; Check if .llvm.lto section gets aggregated in LTO target.31; CHECK-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al32; CHECK-LTO-TARGET-NOT: .llvm.lto33 34;; Final executable should not have .llvm.lto section no matter what the target is.35; RUN: ld.lld -o foo-fatNoLTO a-fatLTO.o %/t/main-fatLTO.o36; RUN: llvm-readelf -S foo-fatNoLTO | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s37 38;; Check if .llvm.lto section gets aggregated in non-LTO target.39; CHECK-NON-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al40; CHECK-NON-LTO-TARGET-NOT: .llvm.lto41 42;; Check if the LTO target executable produced from FatLTO object file is43;; identical to the one produced from LTO modules.44; RUN: opt < a-LTO.ll --module-summary -o a-LTO.bc45; RUN: opt < main-LTO.ll --module-summary -o main-LTO.bc46; RUN: ld.lld -o foo-LTO a-LTO.bc main-LTO.bc47; RUN: cmp foo-fatLTO foo-LTO48 49;; Check if the no-LTO target executable produced from FatLTO object file is50;; identical to the one produced from regular object files.51; RUN: llc a-LTO.ll --filetype=obj -o a.o52; RUN: llc main-LTO.ll --filetype=obj -o main.o53; RUN: ld.lld -o foo-noLTO a.o main.o54; RUN: cmp foo-fatNoLTO foo-noLTO55 56;; Check archive support.57; RUN: llvm-ar rcs a.a a-fatLTO.o 58; RUN: ld.lld -o foo-fatLTO.archive a.a main-LTO.bc --fat-lto-objects59; RUN: cmp foo-fatLTO.archive foo-LTO60 61;; Test FatLTO works with relocatable links using PIC objects, and that62;; SHT_LLVM_LTO sections are discarded.63; RUN: llvm-ar rcs fatLTO-pic.a a-fatLTO.o main-fatLTO.o64; RUN: llvm-readelf -S fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s65 66; RUN: ld.lld --whole-archive fatLTO-pic.a -r -o fatLTO-pic-relocatable.o67; RUN: llvm-readelf -S fatLTO-pic-relocatable.o | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s68 69;--- a-LTO.ll70target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"71target triple = "x86_64-unknown-linux-gnu"72 73; Function Attrs: noinline nounwind uwtable74define dso_local i32 @_start() #0 {75entry:76  ret i32 077}78 79attributes #0 = { noinline nounwind uwtable }80 81!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6}82 83!0 = !{i32 1, !"wchar_size", i32 4}84!1 = !{i32 7, !"PIC Level", i32 2}85!2 = !{i32 7, !"PIE Level", i32 2}86!3 = !{i32 7, !"uwtable", i32 2}87!4 = !{i32 7, !"frame-pointer", i32 2}88!5 = !{i32 1, !"ThinLTO", i32 0}89!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}90 91;--- main-LTO.ll92target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"93target triple = "x86_64-unknown-linux-gnu"94 95; Function Attrs: noinline nounwind uwtable96define dso_local i32 @main() #0 {97entry:98  %retval = alloca i32, align 499  store i32 0, ptr %retval, align 4100  %call = call i32 (...) @_start()101  ret i32 %call102}103 104declare i32 @_start(...)105 106attributes #0 = { noinline nounwind uwtable }107 108!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6}109 110!0 = !{i32 1, !"wchar_size", i32 4}111!1 = !{i32 7, !"PIC Level", i32 2}112!2 = !{i32 7, !"PIE Level", i32 2}113!3 = !{i32 7, !"uwtable", i32 2}114!4 = !{i32 7, !"frame-pointer", i32 2}115!5 = !{i32 1, !"ThinLTO", i32 0}116!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}117