• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## This test shows that llvm-objcopy does not baulk at overlapping sections
2## where such sections are within segments.
3## These don't really make sense, but the tool should still handle invalid
4## inputs somehow.
5# RUN: yaml2obj %s -o %t.o
6
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=CONTENTS
9
10## Now check that the section contents are still correct after the copy and show that
11## llvm-objcopy hasn't "unoverlapped" these sections because they are in segments.
12# RUN: llvm-objcopy %t.o %t2.o
13# RUN: llvm-readobj --section-headers %t2.o | FileCheck %s
14# RUN: llvm-readobj -x .first -x .second %t2.o | FileCheck %s --check-prefix=CONTENTS
15
16# CHECK: Name: .first
17# CHECK: Offset: 0x1000
18# CHECK: Name: .second
19# CHECK: Offset: 0x1001
20
21# CONTENTS:      Hex dump of section '.first':
22# CONTENTS-NEXT: 0x00000000 01234567
23# CONTENTS-EMPTY:
24# CONTENTS-NEXT: Hex dump of section '.second':
25# CONTENTS-NEXT: 0x00000000 23456789
26
27--- !ELF
28FileHeader:
29  Class:   ELFCLASS64
30  Data:    ELFDATA2LSB
31  Type:    ET_EXEC
32  Machine: EM_X86_64
33Sections:
34  - Name: .first
35    Type: SHT_PROGBITS
36    Content: '01234567'
37    AddressAlign: 0x1000
38  - Name: .second
39    Type: SHT_PROGBITS
40    Content: '89abcdef'
41    ShOffset: 0x1001
42ProgramHeaders:
43  - Type:     PT_LOAD
44    FileSize: 5
45    Offset:   0x1000
46    Align:    0x1000
47