brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 18db008 Raw
66 lines · plain
1## Check we are able to dump library soname properly.2 3## Test a valid object case first. We set 'FileSize' to 0x48, because this is a no-op,4## i.e. this value would be set if we had no 'FileSize' at all.5# RUN: yaml2obj -DDTSTRTABVAL=0x0 -DPHDRFILESIZE="0x48" %s -o %t.o6# RUN: llvm-readobj %t.o | FileCheck %s --check-prefix LLVM7# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix GNU8 9# LLVM:      Format: elf64-x86-6410# LLVM-NEXT: Arch: x86_6411# LLVM-NEXT: AddressSize: 64bit12# LLVM-NEXT: LoadName: test.so13 14# GNU:       Dynamic section at offset 0x80 contains 4 entries:15# GNU-NEXT:   Tag                Type     Name/Value16# GNU-NEXT:   0x0000000000000005 (STRTAB) 0x017# GNU-NEXT:   0x000000000000000a (STRSZ)  8 (bytes)18# GNU-NEXT:   0x000000000000000e (SONAME) Library soname: [test.so]19# GNU-NEXT:   0x0000000000000000 (NULL)   0x020 21!ELF22FileHeader:23  Class:   ELFCLASS6424  Data:    ELFDATA2LSB25  Type:    ET_EXEC26  Machine: EM_X86_6427Sections:28  - Name:  .dynstr29    Type:  SHT_STRTAB30    Flags: [ SHF_ALLOC ]31    Content: '746573742e736f00' ## "test.so"32  - Name:  .dynamic33    Type:  SHT_DYNAMIC34    Flags: [ SHF_ALLOC ]35    Link:  .dynstr36    Entries:37      - Tag:   DT_STRTAB38        Value: [[DTSTRTABVAL]]39      - Tag:   DT_STRSZ40        Value: 0x000000000000000841      - Tag:   DT_SONAME42        Value: 0x000000000000000043      - Tag:   DT_NULL44        Value: 0x000000000000000045ProgramHeaders:46  - Type:     PT_LOAD47    Flags:    [ PF_R ]48    VAddr:    0x000049    FileSize: [[PHDRFILESIZE]]50    FirstSec: .dynstr51    LastSec:  .dynamic52 53## Check we do not crash when an object contains a DT_STRTAB entry whose address54## is past the end of the object.55## Note that we have to set p_filesz for PT_LOAD larger than DT_STRTAB value56## to trigger this particular warning.57 58# RUN: yaml2obj -DDTSTRTABVAL=0xFFFE -DPHDRFILESIZE=0xFFFF %s -o %t.err.1.o59# RUN: llvm-readobj %t.err.1.o 2>&1 | FileCheck %s -DFILE=%t.err.1.o --check-prefixes=BROKEN-OFFSET,BROKEN-OFFSET-LLVM60# RUN: llvm-readelf --dynamic-table %t.err.1.o 2>&1 | FileCheck %s -DFILE=%t.err.1.o --check-prefixes=BROKEN-OFFSET,BROKEN-OFFSET-GNU61 62# BROKEN-OFFSET:      warning: '[[FILE]]': unable to parse DT_STRTAB: can't map virtual address 0xfffe to the segment with index 1: the segment ends at 0x10077, which is greater than the file size (0x228)63# BROKEN-OFFSET:      warning: '[[FILE]]': string table was not found64# BROKEN-OFFSET-LLVM: LoadName: <?>65# BROKEN-OFFSET-GNU:  0x000000000000000e (SONAME) Library soname: [<?>]66