diff options
| author | Fangrui Song <maskray@google.com> | 2019-10-29 10:17:22 -0700 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-10-30 09:22:48 -0700 |
| commit | db8dad20b37f4befe054e586b40f8dd1eaeda842 (patch) | |
| tree | 217b30ae525fab89dda76668017af1ac20716439 /lld/test/ELF/linkerscript | |
| parent | 14e289eb774ebbc2fc788bf23c17e2605c27ffb6 (diff) | |
| download | bcm5719-llvm-db8dad20b37f4befe054e586b40f8dd1eaeda842.tar.gz bcm5719-llvm-db8dad20b37f4befe054e586b40f8dd1eaeda842.zip | |
[ELF][test] Change references of %T to %t.dir
Test files in the same directory share the same %T. %T is easy to
misuse and cause race conditions (when running concurrently) so it has
been deprecated since D48842 (see docs/CommandGuide/lit.rst).
While here, add `rm -rf %t.dir` so that tests cannot depend on old files lying around.
Reviewed By: jhenderson, ruiu
Differential Revision: https://reviews.llvm.org/D69572
Diffstat (limited to 'lld/test/ELF/linkerscript')
| -rw-r--r-- | lld/test/ELF/linkerscript/filename-spec.s | 13 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/linker-script-in-search-path.s | 12 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/linkerscript.s | 5 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/memory-include.test | 7 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/output-section-include.test | 11 | ||||
| -rw-r--r-- | lld/test/ELF/linkerscript/section-include.test | 11 |
6 files changed, 32 insertions, 27 deletions
diff --git a/lld/test/ELF/linkerscript/filename-spec.s b/lld/test/ELF/linkerscript/filename-spec.s index b7b1134c47e..de9c7b6f835 100644 --- 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 index 8f1802299de..d411becb48f 100644 --- 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 index 5e1cf27f076..41140abe842 100644 --- 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 index 340328225bd..aa2f1f88647 100644 --- 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 index b18a7ee037a..9d0228fa6b7 100644 --- 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 @@ SECTIONS { .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 index 9b6dfa0dcc4..698d7597f76 100644 --- 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 @@ MEMORY { SECTIONS { .text : { *(.text*) } > ROM .data : { *(.data*) } > RAM - INCLUDE "section-include.test.tmp.inc" + INCLUDE "inc.script" .data3 : { QUAD(0) } > RAM } |

