brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · f19ded3 Raw
45 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o3 4################################################################################5## Test that non-alloc section .foo can be assigned to a segment. Check that6## the values of the offset and file size of this segment's PHDR are correct.7##8## This functionality allows non-alloc metadata, which is not required at9## run-time, to be added to a custom segment in a file. This metadata may be10## read/edited by tools/loader using the values of the offset and file size from11## the custom segment's PHDR. This is particularly important if section headers12## have been stripped.13# RUN: echo "PHDRS {text PT_LOAD; foo 0x12345678;} \14# RUN:       SECTIONS { \15# RUN:           .text : {*(.text .text*)} :text \16# RUN:           .foo : {*(.foo)} :foo \17# RUN:       }" > %t.script18# RUN: ld.lld -o %t --script %t.script %t.o19# RUN: llvm-readelf -S -l %t | FileCheck %s20# RUN: llvm-readobj -l %t | FileCheck --check-prefix=PHDR %s21 22# CHECK: Program Headers:23# CHECK-NEXT:  Type24# CHECK-NEXT:  LOAD25# CHECK-NEXT:  <unknown>: 0x1234567826 27# CHECK:      Section to Segment mapping:28# CHECK-NEXT:  Segment Sections...29# CHECK-NEXT:   00     .text30# CHECK-NEXT:   01     .foo31 32# PHDR:      Type: Unknown (0x12345678)33# PHDR-NEXT: Offset: 0x100434# PHDR-NEXT: VirtualAddress35# PHDR-NEXT: PhysicalAddress36# PHDR-NEXT: FileSize: 437 38.global _start39_start:40 nop41 42.section .foo43 .align 444 .long 045