78 lines · plain
1## Adapted from test/llvm-readobj/ELF/verdef-invalid.test2## Check that we report a warning when a SHT_GNU_verdef section contains a version definition3## that refers to an auxiliary entry that goes past the end of the section.4 5# RUN: yaml2obj %s -o %t6# RUN: llvm-objdump -p %t 2>&1 | FileCheck %s --check-prefix=AUX-PAST-END -DFILE=%t7 8# AUX-PAST-END: warning: '[[FILE]]': invalid SHT_GNU_verdef section with index 1: version definition 1 refers to an auxiliary entry that goes past the end of the section9 10--- !ELF11FileHeader:12 Class: ELFCLASS6413 Data: ELFDATA2LSB14 Type: ET_DYN15Sections:16 - Name: .gnu.version_d17 Type: SHT_GNU_verdef18 Entries:19 - Names:20 - FOO21 ## The correct sh_size is 28.22 ShSize: 2723DynamicSymbols:24 - Name: foo25 26## Check we report a warning when a version definition is not correctly aligned in memory.27 28# RUN: yaml2obj %s --docnum=2 -o %t229# RUN: llvm-objdump -p %t2 2>&1 | FileCheck %s --check-prefix=MISALIGNED-DEF -DFILE=%t230 31# MISALIGNED-DEF: warning: '[[FILE]]': invalid SHT_GNU_verdef section with index 1: found a misaligned version definition entry at offset 0x032 33--- !ELF34FileHeader:35 Class: ELFCLASS6436 Data: ELFDATA2LSB37 Type: ET_DYN38Sections:39 - Type: Fill40 Size: 0x141 - Name: .gnu.version_d42 Type: SHT_GNU_verdef43 Link: .dynstr44 Info: 0x145 Entries:46 - Names:47 - FOO48DynamicSymbols:49 - Name: foo50 51## Check we report "invalid vda_name" when vda_name = size(.dynstr)52 53# RUN: yaml2obj %s --docnum=3 -o %t354# RUN: llvm-objdump -p %t3 2>&1 | FileCheck %s --check-prefix=VDANAME-PAST-END --implicit-check-not=warning:55 56# VDANAME-PAST-END: Version definitions:57# VDANAME-PAST-END-NEXT: 0 0x00 0x00000000 V058# VDANAME-PAST-END-NEXT: <invalid vda_name: 7>59 60--- !ELF61FileHeader:62 Class: ELFCLASS6463 Data: ELFDATA2LSB64 Type: ET_DYN65Sections:66 - Name: .gnu.version_d67 Type: SHT_GNU_verdef68 Flags: [ SHF_ALLOC ]69 Link: .dynstr70 Info: 0x171## The byte offset to the auxiliary entry is 0x13, i.e. it is not correctly aligned in memory.72 Content: "010000000000020000000000140000000000000004000000080000000700000000000000"73DynamicSymbols:74 - Name: V175 Binding: STB_GLOBAL76 - Name: V077 Binding: STB_GLOBAL78