xref: /llvm-project/lld/test/ELF/lto/thinlto-prefix-replace.ll (revision aa0883b59ae17e5465906dad51b5561b5292a28d)
1; REQUIRES: x86
2; Check that changing the output path via thinlto-prefix-replace works
3; RUN: mkdir -p %t/oldpath
4; RUN: opt -module-summary %s -o %t/oldpath/thinlto_prefix_replace.o
5
6; Ensure that there is no existing file at the new path, so we properly
7; test the creation of the new file there.
8; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
9; RUN: ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
10; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
11
12; Check that this also works without the --plugin-opt= prefix.
13; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
14; RUN: ld.lld --thinlto-index-only --thinlto-prefix-replace="%t/oldpath/;%t/newpath/" -shared %t/oldpath/thinlto_prefix_replace.o -o %t/thinlto_prefix_replace
15; RUN: ls %t/newpath/thinlto_prefix_replace.o.thinlto.bc
16
17; Ensure that lld generates error if prefix replace option does not have 'old;new' format.
18; RUN: rm -f %t/newpath/thinlto_prefix_replace.o.thinlto.bc
19; RUN: not ld.lld --plugin-opt=thinlto-index-only --plugin-opt=thinlto-prefix-replace=abc:def -shared %t/oldpath/thinlto_prefix_replace.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR
20; ERR: --plugin-opt=thinlto-prefix-replace= expects 'old;new' format, but got abc:def
21
22target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
23target triple = "x86_64-unknown-linux-gnu"
24
25define void @f() {
26entry:
27  ret void
28}
29