47 lines · plain
1## This test shows that llvm-objcopy does not baulk at overlapping sections2## where such sections are within segments.3## These don't really make sense, but the tool should still handle invalid4## inputs somehow.5# RUN: yaml2obj %s -o %t.o6 7## Check that the contents are as expected before the copy.8# RUN: llvm-readobj -x .first -x .second %t.o | FileCheck %s --check-prefix=CONTENTS9 10## Now check that the section contents are still correct after the copy and show that11## llvm-objcopy hasn't "unoverlapped" these sections because they are in segments.12# RUN: llvm-objcopy %t.o %t2.o13# RUN: llvm-readobj --section-headers %t2.o | FileCheck %s14# RUN: llvm-readobj -x .first -x .second %t2.o | FileCheck %s --check-prefix=CONTENTS15 16# CHECK: Name: .first17# CHECK: Offset: 0x100018# CHECK: Name: .second19# CHECK: Offset: 0x100120 21# CONTENTS: Hex dump of section '.first':22# CONTENTS-NEXT: 0x00000000 0123456723# CONTENTS-EMPTY:24# CONTENTS-NEXT: Hex dump of section '.second':25# CONTENTS-NEXT: 0x00000000 2345678926 27--- !ELF28FileHeader:29 Class: ELFCLASS6430 Data: ELFDATA2LSB31 Type: ET_EXEC32 Machine: EM_X86_6433Sections:34 - Name: .first35 Type: SHT_PROGBITS36 Content: '01234567'37 AddressAlign: 0x100038 - Name: .second39 Type: SHT_PROGBITS40 Content: '89abcdef'41 ShOffset: 0x100142ProgramHeaders:43 - Type: PT_LOAD44 FileSize: 545 Offset: 0x100046 Align: 0x100047