diff --git a/lld/test/ELF/linkerscript/filename-spec.s b/lld/test/ELF/linkerscript/filename-spec.s --- a/lld/test/ELF/linkerscript/filename-spec.s +++ b/lld/test/ELF/linkerscript/filename-spec.s @@ -25,18 +25,19 @@ # RUN: ld.lld -o %t4 --script %t4.script %tx.o %ty.o # RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SECONDFIRST %s -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %T/filename-spec1.o +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.dir/filename-spec1.o # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \ -# RUN: %p/Inputs/filename-spec.s -o %T/filename-spec2.o +# RUN: %p/Inputs/filename-spec.s -o %t.dir/filename-spec2.o -# RUN: echo "SECTIONS{.foo :{ %/T/filename-spec2.o(.foo) %/T/filename-spec1.o(.foo) }}" > %t5.script +# RUN: echo "SECTIONS{.foo :{ %/t.dir/filename-spec2.o(.foo) %/t.dir/filename-spec1.o(.foo) }}" > %t5.script # RUN: ld.lld -o %t5 --script %t5.script \ -# RUN: %/T/filename-spec1.o %/T/filename-spec2.o +# RUN: %/t.dir/filename-spec1.o %/t.dir/filename-spec2.o # RUN: llvm-objdump -s %t5 | FileCheck --check-prefix=SECONDFIRST %s -# RUN: echo "SECTIONS{.foo :{ %/T/filename-spec1.o(.foo) %/T/filename-spec2.o(.foo) }}" > %t6.script +# RUN: echo "SECTIONS{.foo :{ %/t.dir/filename-spec1.o(.foo) %/t.dir/filename-spec2.o(.foo) }}" > %t6.script # RUN: ld.lld -o %t6 --script %t6.script \ -# RUN: %/T/filename-spec1.o %/T/filename-spec2.o +# RUN: %/t.dir/filename-spec1.o %/t.dir/filename-spec2.o # RUN: llvm-objdump -s %t6 | FileCheck --check-prefix=FIRSTY %s # RUN: mkdir -p %t.testdir1 %t.testdir2 diff --git a/lld/test/ELF/linkerscript/linker-script-in-search-path.s b/lld/test/ELF/linkerscript/linker-script-in-search-path.s --- a/lld/test/ELF/linkerscript/linker-script-in-search-path.s +++ b/lld/test/ELF/linkerscript/linker-script-in-search-path.s @@ -3,17 +3,17 @@ # This behaviour matches ld.bfd and various projects appear to rely on this # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -# RUN: mkdir -p %T/searchpath -# RUN: echo 'OUTPUT("%t.out")' > %T/searchpath/%basename_t.script -# RUN: ld.lld -T%T/searchpath/%basename_t.script %t.o +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: echo 'OUTPUT("%t.out")' > %t.dir/script +# RUN: ld.lld -T%t.dir/script %t.o # RUN: llvm-readobj %t.out | FileCheck %s # CHECK: Format: ELF64-x86-64 # If the linker script specified with -T is missing we should emit an error -# RUN: not ld.lld -T%basename_t.script %t.o 2>&1 | FileCheck %s -check-prefix ERROR -# ERROR: error: cannot find linker script {{.*}}.script +# RUN: not ld.lld -Tscript %t.o 2>&1 | FileCheck %s -check-prefix ERROR +# ERROR: error: cannot find linker script {{.*}}script # But if it exists in the search path we should fall back to that instead: # RUN: rm %t.out -# RUN: ld.lld -L %T/searchpath -T%basename_t.script %t.o +# RUN: ld.lld -L %t.dir -Tscript %t.o # RUN: llvm-readobj %t.out | FileCheck %s diff --git a/lld/test/ELF/linkerscript/linkerscript.s b/lld/test/ELF/linkerscript/linkerscript.s --- a/lld/test/ELF/linkerscript/linkerscript.s +++ b/lld/test/ELF/linkerscript/linkerscript.s @@ -33,13 +33,14 @@ # RUN: ld.lld %t.script1 -o %t.out # RUN: llvm-readobj %t2 > /dev/null +# RUN: rm -rf %t.dir && mkdir -p %t.dir # RUN: echo "INCLUDE \"foo.script\"" > %t.script -# RUN: echo "OUTPUT(\"%t.out\")" > %T/foo.script +# RUN: echo "OUTPUT(\"%t.out\")" > %t.dir/foo.script # RUN: not ld.lld %t.script -o %t.out > %t.log 2>&1 # RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log # INCLUDE_ERR: error: {{.+}}.script:1: cannot find linker script foo.script # INCLUDE_ERR-NEXT: INCLUDE "foo.script" -# RUN: ld.lld -L %T %t.script %t +# RUN: ld.lld -L %t.dir %t.script %t # RUN: echo "FOO(BAR)" > %t.script # RUN: not ld.lld -o %t.out %t.script > %t.log 2>&1 diff --git a/lld/test/ELF/linkerscript/memory-include.test b/lld/test/ELF/linkerscript/memory-include.test --- a/lld/test/ELF/linkerscript/memory-include.test +++ b/lld/test/ELF/linkerscript/memory-include.test @@ -4,8 +4,9 @@ # RUN: echo '.section .data,"aw"; .quad 0' >> %t.s # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o -# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.inc -# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: echo "RAM2 (rwx): ORIGIN = 0x3000, LENGTH = 0x100" > %t.dir/inc.script +# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir # RUN: llvm-objdump -section-headers %t.elf | FileCheck %s # CHECK: .data 00000008 0000000000002000 DATA # CHECK: .data2 00000008 0000000000003000 DATA @@ -13,7 +14,7 @@ MEMORY { ROM (rwx): ORIGIN = 0x1000, LENGTH = 0x100 RAM (rwx): ORIGIN = 0x2000, LENGTH = 0x100 - INCLUDE "memory-include.test.tmp.inc" + INCLUDE "inc.script" } SECTIONS { diff --git a/lld/test/ELF/linkerscript/output-section-include.test b/lld/test/ELF/linkerscript/output-section-include.test --- a/lld/test/ELF/linkerscript/output-section-include.test +++ b/lld/test/ELF/linkerscript/output-section-include.test @@ -5,14 +5,15 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o ## Empty include file. -# RUN: echo "" > %t.inc -# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: echo "" > %t.dir/inc.script +# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir # RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1 # CHECK1: .data 00000008 0000000000002000 DATA ## Non-empty include file. -# RUN: echo "QUAD(0)" > %t.inc -# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: echo "QUAD(0)" > %t.dir/inc.script +# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir # RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2 # CHECK2: .data 00000010 0000000000002000 DATA @@ -25,6 +26,6 @@ .text : { *(.text*) } > ROM .data : { *(.data*) - INCLUDE "output-section-include.test.tmp.inc" + INCLUDE "inc.script" } > RAM } diff --git a/lld/test/ELF/linkerscript/section-include.test b/lld/test/ELF/linkerscript/section-include.test --- a/lld/test/ELF/linkerscript/section-include.test +++ b/lld/test/ELF/linkerscript/section-include.test @@ -5,15 +5,16 @@ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t.o ## Empty include file. -# RUN: echo "" > %t.inc -# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: echo "" > %t.dir/inc.script +# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir # RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK1 # CHECK1: .data 00000008 0000000000002000 DATA # CHECK1-NEXT: .data3 00000008 0000000000002008 DATA ## Non-empty include file. -# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.inc -# RUN: ld.lld -o %t.elf --script %s %t.o -L %T +# RUN: echo ".data2 : { QUAD(0) } > RAM" > %t.dir/inc.script +# RUN: ld.lld -o %t.elf --script %s %t.o -L %t.dir # RUN: llvm-objdump -section-headers %t.elf | FileCheck %s --check-prefix=CHECK2 # CHECK2: .data 00000008 0000000000002000 DATA # CHECK2-NEXT: .data2 00000008 0000000000002008 DATA @@ -27,6 +28,6 @@ SECTIONS { .text : { *(.text*) } > ROM .data : { *(.data*) } > RAM - INCLUDE "section-include.test.tmp.inc" + INCLUDE "inc.script" .data3 : { QUAD(0) } > RAM } diff --git a/lld/test/ELF/lto/save-temps.ll b/lld/test/ELF/lto/save-temps.ll --- a/lld/test/ELF/lto/save-temps.ll +++ b/lld/test/ELF/lto/save-temps.ll @@ -1,16 +1,17 @@ ; REQUIRES: x86 -; RUN: cd %T +; RUN: rm -rf %t.dir && mkdir -p %t.dir +; RUN: cd %t.dir ; RUN: rm -f a.out a.out.lto.bc a.out.lto.o -; RUN: llvm-as %s -o %t.o -; RUN: llvm-as %p/Inputs/save-temps.ll -o %t2.o -; RUN: ld.lld -shared %t.o %t2.o -save-temps +; RUN: llvm-as %s -o t.o +; RUN: llvm-as %p/Inputs/save-temps.ll -o t2.o +; RUN: ld.lld -shared t.o t2.o -save-temps ; RUN: llvm-nm a.out | FileCheck %s ; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s ; RUN: llvm-nm a.out.lto.o | FileCheck %s ; RUN: llvm-dis a.out.0.0.preopt.bc ; RUN: rm -f a.out a.out.lto.bc a.out.lto.o -; RUN: ld.lld -shared -m elf_x86_64 %t.o %t2.o --plugin-opt=save-temps +; RUN: ld.lld -shared -m elf_x86_64 t.o t2.o --plugin-opt=save-temps ; RUN: llvm-nm a.out | FileCheck %s ; RUN: llvm-nm a.out.0.0.preopt.bc | FileCheck %s ; RUN: llvm-nm a.out.lto.o | FileCheck %s diff --git a/lld/test/ELF/lto/thinlto-debug-fission.ll b/lld/test/ELF/lto/thinlto-debug-fission.ll --- a/lld/test/ELF/lto/thinlto-debug-fission.ll +++ b/lld/test/ELF/lto/thinlto-debug-fission.ll @@ -1,11 +1,11 @@ ; REQUIRES: x86 ; RUN: opt %s -o %t1.o -; RUN: rm -rf %T/dwo +; RUN: rm -rf %t.dir ; Test to ensure that --plugin-opt=dwo_dir=$DIR creates .dwo files under $DIR -; RUN: ld.lld --plugin-opt=dwo_dir=%T/dwo -shared %t1.o -o /dev/null -; RUN: llvm-readobj -h %T/dwo/0.dwo | FileCheck %s +; RUN: ld.lld --plugin-opt=dwo_dir=%t.dir -shared %t1.o -o /dev/null +; RUN: llvm-readobj -h %t.dir/0.dwo | FileCheck %s ; CHECK: Format: ELF64-x86-64 diff --git a/lld/test/ELF/no-soname.s b/lld/test/ELF/no-soname.s --- a/lld/test/ELF/no-soname.s +++ b/lld/test/ELF/no-soname.s @@ -1,28 +1,28 @@ // REQUIRES: x86 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -// RUN: mkdir -p %T/no-soname -// RUN: ld.lld %t.o -shared -o %T/no-soname/libfoo.so +// RUN: rm -rf %t.dir && mkdir -p %t.dir/no-soname +// RUN: ld.lld %t.o -shared -o %t.dir/no-soname/libfoo.so -// RUN: ld.lld %t.o %T/no-soname/libfoo.so -o %t +// RUN: ld.lld %t.o %t.dir/no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s // CHECK: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/libfoo.so] // CHECK-NOT: NEEDED -// RUN: ld.lld %t.o %T/no-soname/../no-soname/libfoo.so -o %t +// RUN: ld.lld %t.o %t.dir/no-soname/../no-soname/libfoo.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK2 // CHECK2: 0x0000000000000001 NEEDED Shared library: [{{.*}}/no-soname/../no-soname/libfoo.so] // CHECK2-NOT: NEEDED -// RUN: ld.lld %t.o -L%T/no-soname/../no-soname -lfoo -o %t +// RUN: ld.lld %t.o -L%t.dir/no-soname/../no-soname -lfoo -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK3 // CHECK3: 0x0000000000000001 NEEDED Shared library: [libfoo.so] // CHECK3-NOT: NEEDED -// RUN: ld.lld %t.o -shared -soname libbar.so -o %T/no-soname/libbar.so -// RUN: ld.lld %t.o %T/no-soname/libbar.so -o %t +// RUN: ld.lld %t.o -shared -soname libbar.so -o %t.dir/no-soname/libbar.so +// RUN: ld.lld %t.o %t.dir/no-soname/libbar.so -o %t // RUN: llvm-readobj --dynamic-table %t | FileCheck %s --check-prefix=CHECK4 // CHECK4: 0x0000000000000001 NEEDED Shared library: [libbar.so] diff --git a/lld/test/ELF/reproduce-backslash.s b/lld/test/ELF/reproduce-backslash.s --- a/lld/test/ELF/reproduce-backslash.s +++ b/lld/test/ELF/reproduce-backslash.s @@ -1,9 +1,10 @@ -# REQUIRES: x86, shell +# REQUIRES: x86, system-linux # Test that we don't erroneously replace \ with / on UNIX, as it's # legal for a filename to contain backslashes. -# RUN: llvm-mc %s -o %T/foo\\.o -filetype=obj -triple=x86_64-pc-linux -# RUN: ld.lld %T/foo\\.o --reproduce %T/repro.tar -o /dev/null -# RUN: tar tf %T/repro.tar | FileCheck %s +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: llvm-mc %s -o %t.dir/foo\\.o -filetype=obj -triple=x86_64-pc-linux +# RUN: ld.lld %t.dir/foo\\.o --reproduce %t.dir/repro.tar -o /dev/null +# RUN: tar tf %t.dir/repro.tar | FileCheck %s # CHECK: repro/{{.*}}/foo\{{[\]?}}.o diff --git a/lld/test/ELF/version-script-in-search-path.s b/lld/test/ELF/version-script-in-search-path.s --- a/lld/test/ELF/version-script-in-search-path.s +++ b/lld/test/ELF/version-script-in-search-path.s @@ -3,8 +3,8 @@ # This behaviour matches ld.bfd. # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o -# RUN: mkdir -p %T/searchpath -# RUN: echo '{};' > %T/searchpath/%basename_t.script -# RUN: ld.lld -L%T/searchpath --version-script=%basename_t.script %t.o -o /dev/null -# RUN: not ld.lld --version-script=%basename_t.script %t.o 2>&1 | FileCheck -check-prefix ERROR %s +# RUN: rm -rf %t.dir && mkdir -p %t.dir +# RUN: echo '{};' > %t.dir/script +# RUN: ld.lld -L%t.dir --version-script=script %t.o -o /dev/null +# RUN: not ld.lld --version-script=script %t.o 2>&1 | FileCheck -check-prefix ERROR %s # ERROR: error: cannot find version script