brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · df3c2aa Raw
66 lines · plain
1REQUIRES: x862 3## Test that a DTLTO link assigns Module IDs to thin archive members as expected.4 5RUN: rm -rf %t && split-file %s %t && cd %t6 7RUN: sed 's/@t1/@t2/g' t1.ll > t2.ll8RUN: sed 's/@t1/@t3/g' t1.ll > t3.ll9 10RUN: opt -thinlto-bc t1.ll -o t1.bc11RUN: opt -thinlto-bc t2.ll -o t2.bc12RUN: opt -thinlto-bc t3.ll -o t3.bc13 14RUN: llvm-ar rcs t1.a t1.bc --thin15## Create this bitcode thin archive in a subdirectory to test the expansion of16## the path to a bitcode file that is referenced using "..", e.g., in this case17## "../t2.bc".18RUN: mkdir lib19RUN: llvm-ar rcs lib/t2.a t2.bc --thin20## Create this bitcode thin archive with an absolute path entry containing "..".21RUN: llvm-ar rcs t3.a %t/lib/../t3.bc --thin22 23## Link from a different directory to ensure that thin archive member paths are24## resolved correctly relative to the archive locations.25RUN: mkdir %t/out && cd %t/out26 27## Build a response file to share common linking arguments.28## Note: validate.py does not perform any compilation. Instead, it validates the29## received JSON, pretty-prints the JSON and the supplied arguments, and then30## exits with an error. This allows FileCheck directives to verify the31## distributor inputs.32RUN: echo "%t/t1.a %t/lib/t2.a ../t3.a \33RUN:   --thinlto-distributor=\"%python\" \34RUN:   --thinlto-distributor-arg=\"%llvm_src_root/utils/dtlto/validate.py\"" > rsp35 36## Link thin archives using -u/--undefined.37RUN: not ld.lld @rsp -u t1 -u t2 -u t3 2>&1 | FileCheck %s38 39## Link thin archives using --whole-archive.40RUN: not ld.lld --whole-archive @rsp 2>&1 | FileCheck %s41 42## Check the module IDs in the JSON jobs description.43CHECK: "jobs": [44CHECK: "inputs": [45CHECK-NEXT: "{{([a-zA-Z]:)|/}}46CHECK-SAME: {{/|\\\\}}archive-thin.test.tmp{{/|\\\\}}t1.bc"47 48CHECK: "inputs": [49CHECK-NEXT: "{{([a-zA-Z]\:)|/}}50CHECK-SAME: {{/|\\\\}}archive-thin.test.tmp{{/|\\\\}}t2.bc"51 52CHECK: "inputs": [53CHECK-NEXT: "{{([a-zA-Z]:)|/}}54CHECK-SAME: {{/|\\\\}}archive-thin.test.tmp{{/|\\\\}}t3.bc"55 56## Ensure backend compilation fails as expected (due to validate.py dummy behavior).57CHECK: error: DTLTO backend compilation: cannot open native object file:58 59#--- t1.ll60target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"61target triple = "x86_64-unknown-linux-gnu"62 63define void @t1() {64  ret void65}66