dynamic-no-pt-dynamic.test 1.11 KB
## Show that dumping occurs even if there is no PT_DYNAMIC header.
## This is inconsistent with the GNU behavior, but seems to be more reasonable.
# RUN: yaml2obj %s -o %t.no-phdr
# RUN: llvm-readobj --dynamic-table %t.no-phdr | FileCheck %s --check-prefix=LLVM
# RUN: llvm-readelf --dynamic-table %t.no-phdr | FileCheck %s --check-prefix=GNU

# LLVM:      File: {{.*}}.no-phdr
# LLVM-NEXT: Format: elf64-x86-64
# LLVM-NEXT: Arch: x86_64
# LLVM-NEXT: AddressSize: 64bit
# LLVM-NEXT: LoadName:{{ *}}
# LLVM-NEXT: DynamicSection [ (1 entries)
# LLVM-NEXT:   Tag                Type Name/Value
# LLVM-NEXT:   0x0000000000000000 NULL 0x0
# LLVM-NEXT: ]

# GNU:      Dynamic section at offset 0x78 contains 1 entries:
# GNU-NEXT: Tag                Type   Name/Value
# GNU-NEXT: 0x0000000000000000 (NULL) 0x0

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
Sections:
  - Name:    .dynamic
    Type:    SHT_DYNAMIC
    Address: 0x1000
    Entries:
      - Tag:   DT_NULL
        Value: 0
ProgramHeaders:
  - Type: PT_LOAD
    VAddr: 0x1000
    Sections:
      - Section: .dynamic