3 # RUN: split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o
6 ## Check if the linker can generate the final file, containing all non-empty sections,
7 ## without warnings for .intvec0_out, .intvec1_out1, .intvec2_out, because their
8 ## input sections are empty. Althoung, the linker must generate a warning for the
9 ## first ".nonalloc" section and the second .dat, as expected.
11 # RUN: ld.lld %t/a.o -T %t/a.lds -o %t/a.elf 2>&1 | FileCheck %s --check-prefix=WARN --implicit-check-not=warning:
13 # WARN: warning: ignoring memory region assignment for non-allocatable section '.nonalloc'
14 # WARN: warning: ignoring memory region assignment for non-allocatable section '.dat'
16 ## The output file must include all sections.
17 # RUN: llvm-readelf -S %t/a.elf | FileCheck %s
19 # CHECK: There are 12 section headers, starting at offset 0x2138:
20 # CHECK: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
21 # CHECK-NEXT: [ 0] NULL 0000000000000000 000000 000000 00 0 0 0
22 # CHECK-NEXT: [ 1] .nonalloc PROGBITS 0000000000000000 001064 001000 00 W 0 0 1
23 # CHECK-NEXT: [ 2] .dat PROGBITS 0000000000000000 002064 000004 00 W 0 0 1
24 # CHECK-NEXT: [ 3] .intvec0_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
25 # CHECK-NEXT: [ 4] .intvec1_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
26 # CHECK-NEXT: [ 5] .intvec2_out PROGBITS 0000000000000000 002068 000000 00 W 0 0 1
27 # CHECK-NEXT: [ 6] .intvec3_out PROGBITS 00000000803fe060 001060 000004 00 AX 0 0 1
28 # CHECK-NEXT: [ 7] .text PROGBITS 00000000803fe064 001064 000000 00 AX 0 0 4
29 # CHECK-NEXT: [ 8] .comment PROGBITS 0000000000000000 {{.*}} {{.*}} 01 MS 0 0 1
30 # CHECK-NEXT: [ 9] .symtab SYMTAB 0000000000000000 {{.*}} {{.*}} 18 11 1 8
31 # CHECK-NEXT: [10] .shstrtab STRTAB 0000000000000000 {{.*}} {{.*}} 00 0 0 1
32 # CHECK-NEXT: [11] .strtab STRTAB 0000000000000000 {{.*}} {{.*}} 00 0 0 1
39 .section .nonalloc,"w"
41 .section .intvec3,"ax",@progbits
46 MEM1 : ORIGIN = 0x10000000, LENGTH = 1M
47 MEM2 (rx) : ORIGIN = 0x80000000, LENGTH = 4M
50 VEC_START = 0x803FE000;
53 .nonalloc : { *(.nonalloc) } > MEM
54 .dat : { LONG(0); } > MEM1
55 .intvec0_out (VEC_START + 0x0000) : {KEEP (*(.intvec1)) } > MEM2
56 .intvec1_out (VEC_START + 0x0020) : {KEEP (*(.intvec1)) } > MEM2
57 .intvec2_out (VEC_START + 0x0040) : {KEEP (*(.intvec2)) } > MEM2
58 .intvec3_out (VEC_START + 0x0060) : {KEEP (*(.intvec3)) } > MEM2