1# RUN: yaml2obj %s -o %t 2# RUN: llvm-objcopy %t %t2 3# RUN: llvm-readobj --sections %t2 | FileCheck %s 4 5## This checks that llvm-objcopy layouts sections in the order of their offsets 6## in the input file in spite of the order of section headers is different. 7 8# CHECK: Index: 1 9# CHECK-NEXT: Name: foo 10# CHECK-NEXT: Type: 11# CHECK-NEXT: Flags [ 12# CHECK-NEXT: SHF_ALLOC 13# CHECK-NEXT: ] 14# CHECK-NEXT: Address: 15# CHECK-NEXT: Offset: 0x50 16# CHECK: Index: 2 17# CHECK-NEXT: Name: bar 18# CHECK-NEXT: Type: SHT_PROGBITS 19# CHECK-NEXT: Flags [ 20# CHECK-NEXT: SHF_ALLOC 21# CHECK-NEXT: ] 22# CHECK-NEXT: Address: 23# CHECK-NEXT: Offset: 0x40 24# CHECK: Index: 3 25# CHECK-NEXT: Name: baz 26# CHECK-NEXT: Type: SHT_PROGBITS 27# CHECK-NEXT: Flags [ 28# CHECK-NEXT: SHF_ALLOC 29# CHECK-NEXT: ] 30# CHECK-NEXT: Address: 31# CHECK-NEXT: Offset: 0x48 32 33--- !ELF 34FileHeader: 35 Class: ELFCLASS64 36 Data: ELFDATA2LSB 37 Type: ET_REL 38 Machine: EM_X86_64 39Sections: 40 - Name: bar 41 Type: SHT_PROGBITS 42 Flags: [ SHF_ALLOC ] 43 AddressAlign: 0x4 44 Offset: 0x40 45 Content: 0000000000000000 46 - Name: baz 47 Type: SHT_PROGBITS 48 Flags: [ SHF_ALLOC ] 49 AddressAlign: 0x4 50 Offset: 0x48 51 Content: 0000000000000000 52 - Name: foo 53 Type: SHT_PROGBITS 54 Flags: [ SHF_ALLOC ] 55 AddressAlign: 0x4 56 Offset: 0x50 57 Content: 0000000000000000 58 - Type: SectionHeaderTable 59 Sections: 60## Note: the order of section headers differs from their layout. 61 - Name: foo 62 - Name: bar 63 - Name: baz 64 - Name: .shstrtab 65 - Name: .strtab 66