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 a.o -T a.lds -o a
5 # RUN: llvm-readelf -Ss a | FileCheck %s
7 # CHECK: .text PROGBITS 0000000000001000 001000
8 # CHECK-NEXT: .foo-1 PROGBITS 0000000000001001 001001
9 # CHECK-NEXT: .foo-2 PROGBITS 0000000000001101 001101
10 # CHECK-NEXT: .foo-3 PROGBITS 0000000000001102 001102
12 # CHECK: 0000000000001001 0 NOTYPE GLOBAL DEFAULT 1 x1
13 # CHECK-NEXT: 0000000000001001 0 NOTYPE GLOBAL DEFAULT 1 x2
14 # CHECK-NEXT: 0000000000001000 0 NOTYPE GLOBAL DEFAULT 1 x3
16 # RUN: not ld.lld a.o -T absent.lds 2>&1 | FileCheck %s --check-prefix=ABSENT --implicit-check-not=error:
17 # ABSENT: error: absent.lds:3: undefined section .aaa
19 # RUN: not ld.lld a.o -T absolute.lds 2>&1 | FileCheck %s --check-prefix=ABSOLUTE --implicit-check-not=error:
20 # ABSOLUTE: error: absolute.lds:2: at least one side of the expression must be absolute
26 .section .foo-1,"a"; .byte 1
27 .section .foo-2,"a"; .byte 2
28 .section .foo-3,"a"; .byte 3
35 x1 = ADDR(.text) + 1; x2 = 1 + ADDR(.text);
36 x3 = ADDR(.text) & 0xffff;
38 .foo-1 : { *(.foo-1) }
39 .foo-2 ADDR(.foo-1) + 0x100 : { *(.foo-2) }
40 .foo-3 : { *(.foo-3) }
51 foo = ADDR(.text) + ADDR(.text);