76 lines · plain
1# Check we are able to dump the dynamic section without a DT_NULL entry correctly.2 3# RUN: yaml2obj --docnum=1 %s -o %t.o4# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL-LLVM5# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL-GNU6 7# NONULL-LLVM: DynamicSection [ (1 entries)8# NONULL-LLVM-NEXT: Tag Type Name/Value9# NONULL-LLVM-NEXT: 0x0000000000000015 DEBUG 0x010# NONULL-LLVM-NEXT: ]11 12# NONULL-GNU: Dynamic section at offset {{.*}} contains 1 entries:13# NONULL-GNU-NEXT: Tag Type Name/Value14# NONULL-GNU-NEXT: 0x0000000000000015 (DEBUG) 0x015 16--- !ELF17FileHeader:18 Class: ELFCLASS6419 Data: ELFDATA2LSB20 Type: ET_EXEC21Sections:22 - Name: .dynamic23 Type: SHT_DYNAMIC24 Entries:25 - Tag: DT_DEBUG26 Value: 0x000000000000000027ProgramHeaders:28 - Type: PT_LOAD29 FirstSec: .dynamic30 LastSec: .dynamic31 - Type: PT_DYNAMIC32 FirstSec: .dynamic33 LastSec: .dynamic34 35# Sometimes .dynamic section content length can be greater than the36# length of its entries. In this case, we should not try to dump anything37# past the DT_NULL entry, which works as a terminator.38 39# RUN: yaml2obj --docnum=2 %s -o %t.o40# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=LONG-LLVM41# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=LONG-GNU42 43# LONG-LLVM: DynamicSection [ (2 entries)44# LONG-LLVM-NEXT: Tag Type Name/Value45# LONG-LLVM-NEXT: 0x0000000000000015 DEBUG 0x046# LONG-LLVM-NEXT: 0x0000000000000000 NULL 0x047# LONG-LLVM-NEXT: ]48 49# LONG-GNU: Dynamic section at offset {{.*}} contains 2 entries:50# LONG-GNU-NEXT: Tag Type Name/Value51# LONG-GNU-NEXT: 0x0000000000000015 (DEBUG) 0x052# LONG-GNU-NEXT: 0x0000000000000000 (NULL) 0x053 54--- !ELF55FileHeader:56 Class: ELFCLASS6457 Data: ELFDATA2LSB58 Type: ET_EXEC59Sections:60 - Name: .dynamic61 Type: SHT_DYNAMIC62 Entries:63 - Tag: DT_DEBUG64 Value: 0x000000000000000065 - Tag: DT_NULL66 Value: 0x000000000000000067 - Tag: DT_NULL68 Value: 0x000000000000000069ProgramHeaders:70 - Type: PT_LOAD71 FirstSec: .dynamic72 LastSec: .dynamic73 - Type: PT_DYNAMIC74 FirstSec: .dynamic75 LastSec: .dynamic76