2 # RUN: rm -rf %t && split-file %s %t && cd %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
4 # RUN: ld.lld --default-script=def.t b.t -T a.t a.o -o out
5 # RUN: llvm-readelf -Ss out | FileCheck %s
11 # CHECK: 1: 000000000000000c 0 NOTYPE GLOBAL DEFAULT 4 _start
12 # CHECK-NEXT: 2: 000000000000002a 0 NOTYPE GLOBAL DEFAULT ABS b
13 # CHECK-NEXT: 3: 000000000000002a 0 NOTYPE GLOBAL DEFAULT ABS a
16 ## In the absence of --script options, the default linker script is read.
17 # RUN: ld.lld --default-script def.t b.t a.o -o out1
18 # RUN: llvm-readelf -Ss out1 | FileCheck %s --check-prefix=CHECK1
19 # RUN: ld.lld -dT def.t b.t a.o -o out1a && cmp out1 out1a
20 ## If multiple -dT options are specified, the last -dT wins.
21 # RUN: ld.lld -dT a.t -dT def.t b.t a.o -o out1a && cmp out1 out1a
23 # RUN: mkdir d && cp def.t d/default.t
24 # RUN: ld.lld -L d -dT default.t b.t a.o -o out1a && cmp out1 out1a
30 # CHECK1: 1: 000000000000000c 0 NOTYPE GLOBAL DEFAULT 4 _start
31 # CHECK1-NEXT: 2: 000000000000002a 0 NOTYPE GLOBAL DEFAULT ABS b
32 # CHECK1-NEXT: 3: 000000000000002a 0 NOTYPE GLOBAL DEFAULT ABS def
35 # RUN: not ld.lld --default-script not-exist.t b.t -T a.t a.o 2>&1 | FileCheck %s --check-prefix=ERR
36 # ERR: error: cannot find linker script not-exist.t
42 .section .foo0,"a"; .long 0
43 .section .foo1,"a"; .long 0
44 .section .foo2,"a"; .long 0