40 lines · plain
1## In this case, we have a program header with a file size that2## overflows the binary size. Check llvm-objcopy doesn't crash3## and report this error properly.4 5# RUN: yaml2obj --docnum=1 %s -o %t1.o6# RUN: not llvm-objcopy %t1.o 2>&1 | FileCheck %s --check-prefix=ERR17# ERR1: error: program header with offset 0x78 and file size 0x100000 goes past the end of the file8 9--- !ELF10FileHeader:11 Class: ELFCLASS6412 Data: ELFDATA2LSB13 Type: ET_EXEC14 Machine: EM_X86_6415Sections:16 - Name: .foo17 Type: SHT_PROGBITS18ProgramHeaders:19 - Type: PT_LOAD20 FileSize: 0x10000021 FirstSec: .foo22 LastSec: .foo23 24## A similar case, but now the p_offset property of the program header is too large.25 26# RUN: yaml2obj --docnum=2 %s -o %t2.o27# RUN: not llvm-objcopy %t2.o 2>&1 | FileCheck %s --check-prefix=ERR228# ERR2: error: program header with offset 0x100000 and file size 0x1 goes past the end of the file29 30--- !ELF31FileHeader:32 Class: ELFCLASS6433 Data: ELFDATA2LSB34 Type: ET_EXEC35 Machine: EM_X86_6436ProgramHeaders:37 - Type: PT_LOAD38 Offset: 0x10000039 FileSize: 140