xref: /llvm-project/lld/test/wasm/lto/thinlto-prefix-replace.ll (revision b70eb8631386bbccca5a07bb0253aa738d4cda81)
1*b70eb863SSam Clegg; Copied from ELF/lto/thinlto-prefix-replace.ll
2*b70eb863SSam Clegg; Check that changing the output path via thinlto-prefix-replace works
3*b70eb863SSam Clegg; RUN: mkdir -p %t/oldpath
4*b70eb863SSam Clegg; RUN: opt -module-summary %s -o %t/oldpath/thinlto_prefix_replace.o
5*b70eb863SSam Clegg
6*b70eb863SSam Clegg; Ensure that there is no existing file at the new path, so we properly
7*b70eb863SSam Clegg; test the creation of the new file there.
8*b70eb863SSam Clegg; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
9*b70eb863SSam Clegg; RUN: wasm-ld --thinlto-index-only --thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
10*b70eb863SSam Clegg; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
11*b70eb863SSam Clegg
12*b70eb863SSam Clegg; Ensure that lld generates error if prefix replace option does not have 'old;new' format.
13*b70eb863SSam Clegg; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
14*b70eb863SSam Clegg; RUN: not wasm-ld --thinlto-index-only --thinlto-prefix-replace=abc:def -shared %t/oldpath/thinlto_prefix_replace.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
15*b70eb863SSam Clegg; ERR: --thinlto-prefix-replace= expects 'old;new' format, but got abc:def
16*b70eb863SSam Clegg
17*b70eb863SSam Cleggtarget datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
18*b70eb863SSam Cleggtarget triple = "wasm32-unknown-unknown"
19*b70eb863SSam Clegg
20*b70eb863SSam Cleggdefine void @f() {
21*b70eb863SSam Cleggentry:
22*b70eb863SSam Clegg  ret void
23*b70eb863SSam Clegg}
24