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