[Clang] Fix crash due to invalid source location in __is_trivially_equality_comparabl...
[llvm-project.git] / lld / test / ELF / linkerscript / default-script.s
blobbb716a5fe0cddf44e5792462a67e78aa732d0e76
1 # REQUIRES: x86
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
7 # CHECK: Name
8 # CHECK: .foo2
9 # CHECK-NEXT: .foo0
10 # CHECK-NEXT: .foo1
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
14 # CHECK-EMPTY:
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
26 # CHECK1: Name
27 # CHECK1: .foo2
28 # CHECK1-NEXT: .foo1
29 # CHECK1-NEXT: .foo0
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
33 # CHECK1-EMPTY:
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
38 #--- a.s
39 .globl _start
40 _start:
42 .section .foo0,"a"; .long 0
43 .section .foo1,"a"; .long 0
44 .section .foo2,"a"; .long 0
46 #--- a.t
47 a = 42;
48 SECTIONS {
49 .foo2 : {}
50 .foo0 : {}
51 .foo1 : {}
54 #--- b.t
55 b = 42;
57 #--- def.t
58 def = 42;
59 SECTIONS {
60 .foo2 : {}
61 .foo1 : {}
62 .foo0 : {}