94 lines · yaml
1## This test verifies that loading an ELF file that has no section headers can2## find the contents on the .dynamic section and the strings associated with3## the .dynamic seciton.4## - Loading the .dynamic section from the PT_DYNAMIC5## This test will make a simple executable that links against libc.so and we6## verify that we can find the DT_NEEDED entry with the shared library found7## in the .dynamic dump from "image dump objfile"8 9# RUN: yaml2obj %s -o %t10 11# RUN: %lldb -b \12# RUN: -o "target create -d '%t'" \13# RUN: -o "image dump objfile" \14# RUN: | FileCheck %s --dump-input=always15# CHECK: (lldb) image dump objfile16# CHECK: Dumping headers for 1 module(s).17# CHECK: ObjectFileELF, file =18# CHECK: ELF Header19# Make sure there are no section headers20# CHECK: e_shnum = 0x0000000021 22# Make sure we find the program headers and see a PT_DYNAMIC entry.23# CHECK: Program Headers24# CHECK: IDX p_type p_offset p_vaddr p_paddr p_filesz p_memsz p_flags p_align25# CHECK: ==== --------------- -------- -------- -------- -------- -------- ------------------------- --------26# CHECK: [ 0] PT_LOAD 000000b0 00000000 00000000 00000170 00000170 00000000 ( ) 0000000127# CHECK: [ 1] PT_DYNAMIC 000001b0 00000100 00000100 00000070 00000070 00000000 ( ) 0000000828 29# CHECK: Dependent Modules:30# CHECK: ccc31# CHECK: aaa32# CHECK: bbb33 34# Make sure we see some sections created from the program headers35# MAIN: SectID36# MAIN: PT_LOAD[0]37 38# CHECK: .dynamic:39# CHECK: IDX d_tag d_val/d_ptr40# CHECK: ==== ---------------- ------------------41# CHECK: [ 0] STRTAB 0x000000000000000042# CHECK: [ 1] NEEDED 0x0000000000000009 "ccc"43# CHECK: [ 2] NEEDED 0x0000000000000001 "aaa"44# CHECK: [ 3] NEEDED 0x0000000000000005 "bbb"45# CHECK: [ 4] STRSZ 0x000000000000010046# CHECK: [ 5] DEBUG 0x00000000deadbeef47# CHECK: [ 6] NULL 0x000000000000000048 49# Make sure the ObjectFileELF::GetImageInfoAddress() works.50# CHECK: image_info_address = 0x000000000000015851 52--- !ELF53FileHeader:54 Class: ELFCLASS6455 Data: ELFDATA2LSB56 Type: ET_EXEC57 Machine: EM_X86_6458Sections:59 - Type: SectionHeaderTable60 NoHeaders: true61 - Name: .dynstr62 Type: SHT_STRTAB63 Flags: [ SHF_ALLOC ]64 Content: '00616161006262620063636300' ## 0,a,a,a,0,b,b,b,0,c,c,c,065 Size: 0x10066 - Name: .dynamic67 Type: SHT_DYNAMIC68 Address: 0x10069 Entries:70 - Tag: DT_STRTAB71 Value: 0x000000000000000072 - Tag: DT_NEEDED73 Value: 974 - Tag: DT_NEEDED75 Value: 176 - Tag: DT_NEEDED77 Value: 578 - Tag: DT_STRSZ79 Value: 0x10080 - Tag: DT_DEBUG81 Value: 0xdeadbeef82 - Tag: DT_NULL83 Value: 0x084ProgramHeaders:85 - Type: PT_LOAD86 VAddr: 0x087 FirstSec: .dynstr88 LastSec: .dynamic89 - Type: PT_DYNAMIC90 FirstSec: .dynamic91 LastSec: .dynamic92 VAddr: 0x10093 Align: 0x894