brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · eabdf75 Raw
60 lines · plain
1# REQUIRES: x862 3# RUN: split-file %s %t4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o5 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 their8## input sections are empty. Althoung, the linker must generate a warning for the9## first ".nonalloc" section and the second .dat, as expected.10 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:12 13# WARN: warning: ignoring memory region assignment for non-allocatable section '.nonalloc'14# WARN: warning: ignoring memory region assignment for non-allocatable section '.dat'15 16## The output file must include all sections.17# RUN: llvm-readelf -S %t/a.elf | FileCheck %s18 19# CHECK:      There are 12 section headers, starting at offset 0x2138:20# CHECK:      [Nr] Name         Type      Address          Off    Size   ES Flg Lk Inf Al21# CHECK-NEXT: [ 0]              NULL      0000000000000000 000000 000000 00     0  0   022# CHECK-NEXT: [ 1] .nonalloc    PROGBITS  0000000000000000 001064 001000 00 W   0  0   123# CHECK-NEXT: [ 2] .dat         PROGBITS  0000000000000000 002064 000004 00 W   0  0   124# CHECK-NEXT: [ 3] .intvec0_out PROGBITS  0000000000000000 002068 000000 00 W   0  0   125# CHECK-NEXT: [ 4] .intvec1_out PROGBITS  0000000000000000 002068 000000 00 W   0  0   126# CHECK-NEXT: [ 5] .intvec2_out PROGBITS  0000000000000000 002068 000000 00 W   0  0   127# CHECK-NEXT: [ 6] .intvec3_out PROGBITS  00000000803fe060 001060 000004 00 AX  0  0   128# CHECK-NEXT: [ 7] .text        PROGBITS  00000000803fe064 001064 000000 00 AX  0  0   429# CHECK-NEXT: [ 8] .comment     PROGBITS  0000000000000000 {{.*}} {{.*}} 01 MS  0  0   130# CHECK-NEXT: [ 9] .symtab      SYMTAB    0000000000000000 {{.*}} {{.*}} 18     11 1   831# CHECK-NEXT: [10] .shstrtab    STRTAB    0000000000000000 {{.*}} {{.*}} 00     0  0   132# CHECK-NEXT: [11] .strtab      STRTAB    0000000000000000 {{.*}} {{.*}} 00     0  0   133 34 35#--- a.s36.global _start37.text38_start:39.section .nonalloc,"w"40.zero 0x100041.section .intvec3,"ax",@progbits42.long 143 44#--- a.lds45MEMORY {46  MEM1 : ORIGIN = 0x10000000, LENGTH = 1M47  MEM2 (rx) : ORIGIN = 0x80000000, LENGTH = 4M48}49 50VEC_START = 0x803FE000;51 52SECTIONS {53 .nonalloc : { *(.nonalloc) } > MEM54 .dat : { LONG(0); } > MEM155 .intvec0_out (VEC_START + 0x0000) : {KEEP (*(.intvec1)) } > MEM256 .intvec1_out (VEC_START + 0x0020) : {KEEP (*(.intvec1)) } > MEM257 .intvec2_out (VEC_START + 0x0040) : {KEEP (*(.intvec2)) } > MEM258 .intvec3_out (VEC_START + 0x0060) : {KEEP (*(.intvec3)) } > MEM259}60