Index: llvm/test/Object/obj2yaml.test =================================================================== --- llvm/test/Object/obj2yaml.test +++ llvm/test/Object/obj2yaml.test @@ -357,11 +357,13 @@ # ELF-MIPSEL-NEXT: Type: SHT_PROGBITS # ELF-MIPSEL-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] # ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004 +# ELF-MIPSEL-NEXT: Offset: 0x0000000000000034 # ELF-MIPSEL-NEXT: Content: 0000023C00004224E8FFBD271400BFAF1000B0AF218059000000018E000024240000198E09F8200321E000020000198E09F8200321E00002000002241000B08F1400BF8F0800E0031800BD27 # ELF-MIPSEL-NEXT: - Name: .rel.text # ELF-MIPSEL-NEXT: Type: SHT_REL # ELF-MIPSEL-NEXT: Link: .symtab # ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004 +# ELF-MIPSEL-NEXT: Offset: 0x0000000000000434 # ELF-MIPSEL-NEXT: Info: .text # ELF-MIPSEL-NEXT: Relocations: # ELF-MIPSEL-NEXT: - Symbol: _gp_disp @@ -385,6 +387,7 @@ # ELF-MIPSEL-NEXT: Type: SHT_PROGBITS # ELF-MIPSEL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] # ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004 +# ELF-MIPSEL-NEXT: Offset: 0x0000000000000080 # ELF-MIPSEL-NEXT: - Name: .bss # ELF-MIPSEL-NEXT: Type: SHT_NOBITS # ELF-MIPSEL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -393,6 +396,7 @@ # ELF-MIPSEL-NEXT: - Name: .mdebug.abi32 # ELF-MIPSEL-NEXT: Type: SHT_PROGBITS # ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000001 +# ELF-MIPSEL-NEXT: Offset: 0x0000000000000080 # ELF-MIPSEL-NEXT: - Name: .rodata.str1.1 # ELF-MIPSEL-NEXT: Type: SHT_PROGBITS # ELF-MIPSEL-NEXT: Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ] @@ -473,6 +477,7 @@ # ELF-MIPS64EL-NEXT: Type: SHT_PROGBITS # ELF-MIPS64EL-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] # ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000010 +# ELF-MIPS64EL-NEXT: Offset: 0x0000000000000040 # ELF-MIPS64EL-NEXT: - Name: .data # ELF-MIPS64EL-NEXT: Type: SHT_PROGBITS # ELF-MIPS64EL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -482,6 +487,7 @@ # ELF-MIPS64EL-NEXT: Type: SHT_RELA # ELF-MIPS64EL-NEXT: Link: .symtab # ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000008 +# ELF-MIPS64EL-NEXT: Offset: 0x0000000000000410 # ELF-MIPS64EL-NEXT: Info: .data # ELF-MIPS64EL-NEXT: Relocations: # ELF-MIPS64EL-NEXT: - Symbol: zed @@ -490,6 +496,7 @@ # ELF-MIPS64EL-NEXT: Type: SHT_NOBITS # ELF-MIPS64EL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] # ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000010 +# ELF-MIPS64EL-NEXT: Offset: 0x0000000000000050 # ELF-MIPS64EL-NEXT: - Name: .MIPS.options # ELF-MIPS64EL-NEXT: Type: SHT_MIPS_OPTIONS # ELF-MIPS64EL-NEXT: Flags: [ SHF_ALLOC, SHF_MIPS_NOSTRIP ] @@ -534,6 +541,7 @@ # ELF-X86-64-NEXT: Type: SHT_PROGBITS # ELF-X86-64-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] # ELF-X86-64-NEXT: AddressAlign: 0x0000000000000010 +# ELF-X86-64-NEXT: Offset: 0x0000000000000040 # ELF-X86-64-NEXT: Content: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3 # ELF-X86-64-NEXT: - Name: .rodata.str1.1 # ELF-X86-64-NEXT: Type: SHT_PROGBITS @@ -676,6 +684,7 @@ # ELF-AVR-NEXT: Type: SHT_PROGBITS # ELF-AVR-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] # ELF-AVR-NEXT: AddressAlign: 0x0000000000000002 +# ELF-AVR-NEXT: Offset: 0x0000000000000074 # ELF-AVR-NEXT: Content: C20E0895 # ELF-AVR-NEXT: - Name: .data # ELF-AVR-NEXT: Type: SHT_PROGBITS Index: llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml +++ llvm/test/tools/obj2yaml/ELF/DWARF/debug-addr.yaml @@ -143,6 +143,7 @@ # ADDR-NEXT: Address: 0x0000000000002020 # ADDRALIGN-NEXT: AddressAlign: 0x0000000000000003 # ENTSIZE-NEXT: EntSize: 0x0000000000000003 +# COMMON-NEXT: Offset: 0x{{.*}} # INFO-NEXT: Info: 0x0000000000000003 # COMMON-NEXT: - Name: .sec # COMMON-NEXT: Type: SHT_PROGBITS @@ -190,6 +191,7 @@ # RAW-NEXT: - Name: .debug_addr # RAW-NEXT: Type: SHT_PROGBITS # RAW-NEXT: AddressAlign: 0x0000000000000001 +# RAW-NEXT: Offset: 0x0000000000000040 # RAW-NEXT: Content: AABBCC # RAW-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/DWARF/debug-aranges.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/DWARF/debug-aranges.yaml +++ llvm/test/tools/obj2yaml/ELF/DWARF/debug-aranges.yaml @@ -83,10 +83,11 @@ # SHDR-NEXT: Type: SHT_[[TYPE]] # FLAGS-NEXT: Flags: [ SHF_ALLOC ] # LINK-NEXT: Link: .sec +# ADDRESS-NEXT: Address: 0x0000000000002020 +# ADDRALIGN-NEXT: AddressAlign: 0x0000000000000003 # ENTSIZE-NEXT: EntSize: 0x0000000000000003 +# SHDR: Offset: 0x{{.*}} # INFO-NEXT: Info: 0x0000000000000003 -# ADDRALIGN-NEXT: AddressAlign: 0x0000000000000003 -# ADDRESS-NEXT: Address: 0x0000000000002020 # ARANGE: DWARF: # ARANGE-NEXT: debug_aranges: @@ -161,6 +162,7 @@ # RAW-CONTENT-NEXT: - Name: .debug_aranges # RAW-CONTENT-NEXT: Type: SHT_PROGBITS # RAW-CONTENT-NEXT: AddressAlign: 0x0000000000000001 +# RAW-CONTENT-NEXT: Offset: 0x0000000000000040 # RAW-CONTENT-NEXT: Content: '3412000002003412000008000000000000000000000000000000000000000000' # RAW-CONTENT-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml +++ llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml @@ -123,6 +123,7 @@ # RAW: - Name: .debug_ranges # RAW-NEXT: Type: SHT_PROGBITS # RAW-NEXT: AddressAlign: 0x0000000000000001 +# RAW-NEXT: Offset: 0x0000000000000040 # RAW-NEXT: Content: '1000000000000000 ## ^--------------- LowOffset # RAW-SAME: {{^}}2000000000000000 @@ -195,10 +196,12 @@ # COMMON-NEXT: Type: SHT_[[TYPE]] # FLAGS-NEXT: Flags: [ SHF_ALLOC ] # LINK-NEXT: Link: .sec +# ADDRESS-NEXT: Address: 0x0000000000002020 +# ADDRALIGN-NEXT: AddressAlign: 0x0000000000000003 # ENTSIZE-NEXT: EntSize: 0x0000000000000003 +# COMMON: Offset: 0x{{.*}} # INFO-NEXT: Info: 0x0000000000000003 -# ADDRALIGN-NEXT: AddressAlign: 0x0000000000000003 -# ADDRESS-NEXT: Address: 0x0000000000002020 + # COMMON: debug_ranges: # COMMON-NEXT: - Offset: 0x0000000000000000 Index: llvm/test/tools/obj2yaml/ELF/DWARF/debug-str.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/DWARF/debug-str.yaml +++ llvm/test/tools/obj2yaml/ELF/DWARF/debug-str.yaml @@ -76,7 +76,9 @@ # ADDRESS-NEXT: Address: 0x[[#%.16x,ADDRESS]] # COMMON-NEXT: AddressAlign: 0x[[#%.16x,ADDRALIGN]] # ENTSIZE-NEXT: EntSize: 0x[[#%.16x,ENTSIZE]] +# COMMON: Offset: 0x{{.*}} # INFO-NEXT: Info: 0x[[#%.16x,INFO]] + # BASIC: DWARF: # BASIC-NEXT: debug_str: # BASIC-NEXT: - a @@ -111,6 +113,7 @@ # NO-TERMINATOR-NEXT: - Name: .debug_str # NO-TERMINATOR-NEXT: Type: SHT_PROGBITS # NO-TERMINATOR-NEXT: Flags: [ SHF_MERGE, SHF_STRINGS ] +# NO-TERMINATOR-NEXT: Offset: 0x0000000000000040 # NO-TERMINATOR-NEXT: Content: '61626300616263' # NO-TERMINATOR-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml +++ llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml @@ -5,6 +5,7 @@ # CHECK: Sections: # CHECK-NEXT: - Name: .debug_foo # CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Content: '01020304' # CHECK-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/arm-exidx-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/arm-exidx-section.yaml +++ llvm/test/tools/obj2yaml/ELF/arm-exidx-section.yaml @@ -9,8 +9,9 @@ # RUN: yaml2obj --docnum=1 -DENCODE=MSB %s -o %t.be.so # RUN: obj2yaml %t.be.so | FileCheck %s --check-prefix=BE -# LE: - Name: .ARM.exidx -# LE-NEXT: Type: SHT_ARM_EXIDX +# LE: - Name: .ARM.exidx +# LE-NEXT: Type: SHT_ARM_EXIDX +# LE-NEXT: Offset: 0x0000000000000040 # LE-NEXT: Entries: # LE-NEXT: - Offset: 0xDDCCBBAA # LE-NEXT: Value: 0x01000000 @@ -18,8 +19,9 @@ # LE-NEXT: Value: EXIDX_CANTUNWIND # LE-NEXT: ... -# BE: - Name: .ARM.exidx -# BE-NEXT: Type: SHT_ARM_EXIDX +# BE: - Name: .ARM.exidx +# BE-NEXT: Type: SHT_ARM_EXIDX +# BE-NEXT: Offset: 0x0000000000000040 # BE-NEXT: Entries: # BE-NEXT: - Offset: 0xAABBCCDD # BE-NEXT: Value: EXIDX_CANTUNWIND @@ -48,6 +50,7 @@ # INVALID-SIZE: - Name: .ARM.exidx # INVALID-SIZE-NEXT: Type: SHT_ARM_EXIDX +# INVALID-SIZE-NEXT: Offset: 0x0000000000000040 # INVALID-SIZE-NEXT: Content: AABBCCDD00000001EEFF88990100000000 # INVALID-SIZE-NEXT: ... @@ -57,6 +60,7 @@ # EMPTY: - Name: .ARM.exidx # EMPTY-NEXT: Type: SHT_ARM_EXIDX +# EMPTY-NEXT: Offset: 0x0000000000000040 # EMPTY-NEXT: Entries: [] # EMPTY-NEXT: ... @@ -83,11 +87,13 @@ # NOT-ARM: Sections: # NOT-ARM-NEXT: - Name: .ARM.exidx # NOT-ARM-NEXT: Type: 0x70000001 +# NOT-ARM-NEXT: Offset: 0x0000000000000040 # NOT-ARM-NEXT: Content: AABBCCDD11223344 # NOT-ARM-NEXT: ... -# ARM: - Name: .ARM.exidx -# ARM-NEXT: Type: SHT_ARM_EXIDX +# ARM: - Name: .ARM.exidx +# ARM-NEXT: Type: SHT_ARM_EXIDX +# ARM-NEXT: Offset: 0x0000000000000040 # ARM-NEXT: Entries: # ARM-NEXT: - Offset: 0xDDCCBBAA # ARM-NEXT: Value: 0x44332211 Index: llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml +++ llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml @@ -11,8 +11,9 @@ # VALID-NEXT: Data: ELFDATA2LSB # VALID-NEXT: Type: ET_EXEC # VALID-NEXT: Sections: -# VALID-NEXT: - Name: .llvm_bb_addr_map -# VALID-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# VALID-NEXT: - Name: .llvm_bb_addr_map +# VALID-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# VALID-NEXT: Offset: 0x0000000000000040 # VALID-NEXT: Entries: ## The 'Address' field is omitted when it's zero. # VALID-NEXT: BBEntries: @@ -70,8 +71,9 @@ # INVALID-NEXT: Data: ELFDATA2LSB # INVALID-NEXT: Type: ET_EXEC # INVALID-NEXT: Sections: -# INVALID-NEXT: - Name: .llvm_bb_addr_map -# INVALID-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# INVALID-NEXT: - Name: .llvm_bb_addr_map +# INVALID-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# INVALID-NEXT: Offset: 0x0000000000000040 # INVALID-NEXT: Content: '10000000000000' --- !ELF @@ -120,8 +122,9 @@ # MULTI-NEXT: Data: ELFDATA2LSB # MULTI-NEXT: Type: ET_EXEC # MULTI-NEXT: Sections: -# MULTI-NEXT: - Name: .llvm_bb_addr_map -# MULTI-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# MULTI-NEXT: - Name: .llvm_bb_addr_map +# MULTI-NEXT: Type: SHT_LLVM_BB_ADDR_MAP +# MULTI-NEXT: Offset: 0x0000000000000040 # MULTI-NEXT: Entries: ## The 'Address' field is omitted when it's zero. # MULTI-NEXT: - BBEntries: Index: llvm/test/tools/obj2yaml/ELF/call-graph-profile-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/call-graph-profile-section.yaml +++ llvm/test/tools/obj2yaml/ELF/call-graph-profile-section.yaml @@ -16,6 +16,7 @@ # BASIC-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE # BASIC-NEXT: Link: .symtab # BASIC-NEXT: EntSize: 0x0000000000000010 +# BASIC-NEXT: Offset: 0x{{.*}} # BASIC-NEXT: Entries: # BASIC-NEXT: - From: foo # BASIC-NEXT: To: bar @@ -59,6 +60,7 @@ # INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE # INVALID-NEXT: Link: .symtab # INVALID-NEXT: EntSize: 0x0000000000000010 +# INVALID-NEXT: Offset: 0x0000000000000034 # INVALID-NEXT: - Name: .multiple.16.valid # INVALID-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE # INVALID-NEXT: Link: .symtab Index: llvm/test/tools/obj2yaml/ELF/duplicate-symbol-and-section-names.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/duplicate-symbol-and-section-names.yaml +++ llvm/test/tools/obj2yaml/ELF/duplicate-symbol-and-section-names.yaml @@ -28,8 +28,9 @@ # CASE1-NEXT: Data: ELFDATA2LSB # CASE1-NEXT: Type: ET_REL # CASE1-NEXT: Sections: -# CASE1-NEXT: - Name: .foo -# CASE1-NEXT: Type: SHT_PROGBITS +# CASE1-NEXT: - Name: .foo +# CASE1-NEXT: Type: SHT_PROGBITS +# CASE1-NEXT: Offset: 0x0000000000000040 # CASE1-NEXT: - Name: '.foo (1)' # CASE1-NEXT: Type: SHT_PROGBITS # CASE1-NEXT: - Name: '.foo (2)' Index: llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml +++ llvm/test/tools/obj2yaml/ELF/dynamic-section.yaml @@ -10,6 +10,7 @@ # CHECK-NEXT: Type: SHT_DYNAMIC # CHECK-NEXT: Address: 0x0000000000001000 # CHECK-NEXT: AddressAlign: 0x0000000000002000 +# CHECK-NEXT: Offset: 0x0000000000002000 # CHECK-NEXT: Entries: # CHECK-NEXT: - Tag: DT_NULL # CHECK-NEXT: Value: 0x0000000000000000 Index: llvm/test/tools/obj2yaml/ELF/gnu-hash-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/gnu-hash-section.yaml +++ llvm/test/tools/obj2yaml/ELF/gnu-hash-section.yaml @@ -9,6 +9,7 @@ # FIELDS: - Name: .gnu.hash # FIELDS-NEXT: Type: SHT_GNU_HASH # FIELDS-NEXT: Flags: [ SHF_ALLOC ] +# FIELDS-NEXT: Offset: 0x0000000000000034 # FIELDS-NEXT: Header: # FIELDS-NEXT: SymNdx: 0x00000001 # FIELDS-NEXT: Shift2: 0x00000002 @@ -40,6 +41,7 @@ # INVALID: - Name: .gnu.hash.tooshort # INVALID-NEXT: Type: SHT_GNU_HASH # INVALID-NEXT: Flags: [ SHF_ALLOC ] +# INVALID-NEXT: Offset: 0x0000000000000034 # INVALID-NEXT: Content: 112233445566778899AABBCCDDEEFF # INVALID-NEXT: - Name: .gnu.hash.empty # INVALID-NEXT: Type: SHT_GNU_HASH Index: llvm/test/tools/obj2yaml/ELF/hash-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/hash-section.yaml +++ llvm/test/tools/obj2yaml/ELF/hash-section.yaml @@ -9,6 +9,7 @@ # CHAIN-BUCKET: - Name: .hash1 # CHAIN-BUCKET-NEXT: Type: SHT_HASH +# CHAIN-BUCKET-NEXT: Offset: 0x0000000000000034 # CHAIN-BUCKET-NEXT: Bucket: [ 3 ] # CHAIN-BUCKET-NEXT: Chain: [ 4, 5 ] # CHAIN-BUCKET: - Name: .hash2 @@ -39,6 +40,7 @@ # CONTENT: - Name: .empty_hash # CONTENT-NEXT: Type: SHT_HASH +# CONTENT-NEXT: Offset: 0x0000000000000034 # CONTENT-NEXT: Content: '' # CONTENT-NEXT: - Name: .invalid_header # CONTENT-NEXT: Type: SHT_HASH @@ -84,6 +86,7 @@ # ENT-SIZE: - Name: .hash.entsize.0 # ENT-SIZE-NEXT: Type: SHT_HASH # ENT-SIZE-NEXT: EntSize: 0x0000000000000000 +# ENT-SIZE-NEXT: Offset: 0x0000000000000034 # ENT-SIZE-NEXT: Content: '' # ENT-SIZE-NEXT: - Name: .hash.entsize.4.default # ENT-SIZE-NEXT: Type: SHT_HASH Index: llvm/test/tools/obj2yaml/ELF/implicit-sections-order.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/implicit-sections-order.yaml +++ llvm/test/tools/obj2yaml/ELF/implicit-sections-order.yaml @@ -38,8 +38,9 @@ # OUTPUT-NEXT: Data: ELFDATA2LSB # OUTPUT-NEXT: Type: ET_DYN # OUTPUT-NEXT: Sections: -# OUTPUT-NEXT: - Name: .foo.1 -# OUTPUT-NEXT: Type: SHT_PROGBITS +# OUTPUT-NEXT: - Name: .foo.1 +# OUTPUT-NEXT: Type: SHT_PROGBITS +# OUTPUT-NEXT: Offset: 0x0000000000000040 # OUTPUT-NEXT: - Name: .dynsym # OUTPUT-NEXT: Type: SHT_DYNSYM # OUTPUT-NEXT: Flags: [ SHF_ALLOC ] @@ -127,8 +128,9 @@ # OUTPUT2-NEXT: Data: ELFDATA2LSB # OUTPUT2-NEXT: Type: ET_DYN # OUTPUT2-NEXT: Sections: -# OUTPUT2-NEXT: - Name: .foo.1 -# OUTPUT2-NEXT: Type: SHT_PROGBITS +# OUTPUT2-NEXT: - Name: .foo.1 +# OUTPUT2-NEXT: Type: SHT_PROGBITS +# OUTPUT2-NEXT: Offset: 0x0000000000000040 # OUTPUT2-NEXT: - Name: .foo.2 # OUTPUT2-NEXT: Type: SHT_PROGBITS # OUTPUT2-NEXT: - Name: .foo.3 Index: llvm/test/tools/obj2yaml/ELF/invalid-section-name.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/invalid-section-name.yaml +++ llvm/test/tools/obj2yaml/ELF/invalid-section-name.yaml @@ -12,8 +12,9 @@ # CHECK-NEXT: Data: ELFDATA2LSB # CHECK-NEXT: Type: ET_REL # CHECK-NEXT: Sections: -# CHECK-NEXT: - Name: "{{.*}}" -# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: - Name: "{{.*}}" +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: ... --- !ELF Index: llvm/test/tools/obj2yaml/ELF/linker-options.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/linker-options.yaml +++ llvm/test/tools/obj2yaml/ELF/linker-options.yaml @@ -5,8 +5,9 @@ # RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=VALID -# VALID: - Name: .linker-options-valid1 -# VALID-NEXT: Type: SHT_LLVM_LINKER_OPTIONS +# VALID: - Name: .linker-options-valid1 +# VALID-NEXT: Type: SHT_LLVM_LINKER_OPTIONS +# VALID-NEXT: Offset: 0x0000000000000040 # VALID-NEXT: Options: # VALID-NEXT: - Name: a # VALID-NEXT: Value: b @@ -38,6 +39,7 @@ # CORRUPT: - Name: .linker-options-empty # CORRUPT-NEXT: Type: SHT_LLVM_LINKER_OPTIONS +# CORRUPT-NEXT: Offset: 0x0000000000000040 # CORRUPT-NEXT: Content: '' # CORRUPT-NEXT: - Name: .linker-options-no-null # CORRUPT-NEXT: Type: SHT_LLVM_LINKER_OPTIONS Index: llvm/test/tools/obj2yaml/ELF/llvm-addrsig-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/llvm-addrsig-section.yaml +++ llvm/test/tools/obj2yaml/ELF/llvm-addrsig-section.yaml @@ -10,6 +10,7 @@ # NAME: - Name: .llvm_addrsig # NAME-NEXT: Type: SHT_LLVM_ADDRSIG # NAME-NEXT: Link: .symtab +# NAME-NEXT: Offset: 0x0000000000000040 # NAME-NEXT: Symbols: [ foo, bar, '3', '4294967295' ] # NAME: - Name: .llvm_addrsig_unlinked # NAME-NEXT: Type: SHT_LLVM_ADDRSIG @@ -45,6 +46,7 @@ # INVALID-ENTRY: - Name: .llvm_addrsig # INVALID-ENTRY-NEXT: Type: SHT_LLVM_ADDRSIG +# INVALID-ENTRY-NEXT: Offset: 0x0000000000000040 # INVALID-ENTRY-NEXT: Content: FFFFFFFFFF --- !ELF @@ -64,6 +66,7 @@ # EMPTY: - Name: .llvm_addrsig # EMPTY-NEXT: Type: SHT_LLVM_ADDRSIG +# EMPTY-NEXT: Offset: 0x0000000000000040 # EMPTY-NEXT: Symbols: [ ] --- !ELF Index: llvm/test/tools/obj2yaml/ELF/llvm-deplibs-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/llvm-deplibs-section.yaml +++ llvm/test/tools/obj2yaml/ELF/llvm-deplibs-section.yaml @@ -6,6 +6,7 @@ # CHECK: Sections: # CHECK-NEXT: - Name: .deplibs.single # CHECK-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Libraries: [ foo ] # CHECK-NEXT: - Name: .deplibs.multiple # CHECK-NEXT: Type: SHT_LLVM_DEPENDENT_LIBRARIES Index: llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml +++ llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml @@ -8,6 +8,7 @@ # CHECK-NEXT: Type: SHT_MIPS_ABIFLAGS # CHECK-NEXT: AddressAlign: 0x0000000000000008 # CHECK-NEXT: EntSize: 0x0000000000000018 +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: ISA: MIPS64 # CHECK-NEXT: ISARevision: 0x05 # CHECK-NEXT: ISAExtension: EXT_OCTEON3 @@ -50,13 +51,15 @@ # RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_MIPS -o %t2.mips # RUN: obj2yaml %t2.mips | FileCheck %s --check-prefix=MIPS -# MIPS: - Name: .MIPS.abiflags -# MIPS-NEXT: Type: SHT_MIPS_ABIFLAGS -# MIPS-NEXT: ISA: 0x00000000 +# MIPS: - Name: .MIPS.abiflags +# MIPS-NEXT: Type: SHT_MIPS_ABIFLAGS +# MIPS-NEXT: Offset: 0x0000000000000040 +# MIPS-NEXT: ISA: 0x00000000 # MIPS-NEXT: ... # NOT-MIPS: - Name: .MIPS.abiflags # NOT-MIPS-NEXT: Type: 0x7000002A +# NOT-MIPS-NEXT: Offset: 0x0000000000000040 # NOT-MIPS-NEXT: Content: '000000000000000000000000000000000000000000000000' # NOT-MIPS-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/no-symbol-reloc.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/no-symbol-reloc.yaml +++ llvm/test/tools/obj2yaml/ELF/no-symbol-reloc.yaml @@ -14,6 +14,7 @@ # CHECK-NEXT: - Name: .text # CHECK-NEXT: Type: SHT_PROGBITS # CHECK-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: - Name: .rela.text # CHECK-NEXT: Type: SHT_RELA # CHECK-NEXT: Info: .text Index: llvm/test/tools/obj2yaml/ELF/note-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/note-section.yaml +++ llvm/test/tools/obj2yaml/ELF/note-section.yaml @@ -5,8 +5,9 @@ # RUN: yaml2obj --docnum=1 %s -o %t1 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=VALID -# VALID: - Name: .note.foo -# VALID-NEXT: Type: SHT_NOTE +# VALID: - Name: .note.foo +# VALID-NEXT: Type: SHT_NOTE +# VALID-NEXT: Offset: 0x0000000000000040 # VALID-NEXT: Notes: # VALID-NEXT: - Name: '' # VALID-NEXT: Desc: '' @@ -41,6 +42,7 @@ # INVALID: - Name: .note.tooShortNote # INVALID-NEXT: Type: SHT_NOTE +# INVALID-NEXT: Offset: 0x0000000000000040 # INVALID-NEXT: Content: '0000000000000000000000' # INVALID-NEXT: - Name: .note.tooLongNameSize # INVALID-NEXT: Type: SHT_NOTE Index: llvm/test/tools/obj2yaml/ELF/null-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/null-section.yaml +++ llvm/test/tools/obj2yaml/ELF/null-section.yaml @@ -20,6 +20,7 @@ # FIRST-SEC-NEXT: Info: 0x0000000000000002 # FIRST-SEC-NEXT: - Name: .foo # FIRST-SEC-NEXT: Type: SHT_PROGBITS +# FIRST-SEC-NEXT: Offset: 0x0000000000000040 # FIRST-SEC-NEXT: ... --- !ELF @@ -53,6 +54,7 @@ # SECOND-SEC-NEXT: Sections: # SECOND-SEC-NEXT: - Name: .foo # SECOND-SEC-NEXT: Type: SHT_PROGBITS +# SECOND-SEC-NEXT: Offset: 0x0000000000000040 # SECOND-SEC-NEXT: - Type: SHT_NULL # SECOND-SEC-NEXT: Flags: [ SHF_ALLOC ] # SECOND-SEC-NEXT: Address: 0x0000000000000006 @@ -93,8 +95,9 @@ # NULL-SEC-NEXT: Data: ELFDATA2LSB # NULL-SEC-NEXT: Type: ET_REL # NULL-SEC-NEXT: Sections: -# NULL-SEC-NEXT: - Name: .foo -# NULL-SEC-NEXT: Type: SHT_PROGBITS +# NULL-SEC-NEXT: - Name: .foo +# NULL-SEC-NEXT: Type: SHT_PROGBITS +# NULL-SEC-NEXT: Offset: 0x0000000000000040 # NULL-SEC-NEXT: ... --- !ELF @@ -119,8 +122,9 @@ # NULL-SEC-MIDDLE-NEXT: Data: ELFDATA2LSB # NULL-SEC-MIDDLE-NEXT: Type: ET_REL # NULL-SEC-MIDDLE-NEXT: Sections: -# NULL-SEC-MIDDLE-NEXT: - Name: .foo -# NULL-SEC-MIDDLE-NEXT: Type: SHT_PROGBITS +# NULL-SEC-MIDDLE-NEXT: - Name: .foo +# NULL-SEC-MIDDLE-NEXT: Type: SHT_PROGBITS +# NULL-SEC-MIDDLE-NEXT: Offset: 0x0000000000000040 # NULL-SEC-MIDDLE-NEXT: - Type: SHT_NULL # NULL-SEC-MIDDLE-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/offset.yaml =================================================================== --- /dev/null +++ llvm/test/tools/obj2yaml/ELF/offset.yaml @@ -0,0 +1,79 @@ +## Check how the "Offset" field is dumped by obj2yaml. + +# RUN: yaml2obj %s -o %t.o +# RUN: obj2yaml %t.o | FileCheck %s -DFILE=%t.o + +# CHECK: --- !ELF +# CHECK-NEXT: FileHeader: +# CHECK-NEXT: Class: ELFCLASS64 +# CHECK-NEXT: Data: ELFDATA2LSB +# CHECK-NEXT: Type: ET_REL +# CHECK-NEXT: Sections: +# CHECK-NEXT: - Name: .foo1 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000040 +# CHECK-NEXT: Content: '00' +# CHECK-NEXT: - Name: .foo2 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Content: '00' +# CHECK-NEXT: - Name: .foo3 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Content: '00' +# CHECK-NEXT: - Name: .bar1 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000100 +# CHECK-NEXT: Content: '00' +# CHECK-NEXT: - Name: .bar2 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: AddressAlign: 0x0000000000000010 +# CHECK-NEXT: Content: '00' +# CHECK-NEXT: - Name: .bar3 +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: AddressAlign: 0x0000000000000010 +# CHECK-NEXT: Offset: 0x0000000000000200 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_REL +Sections: +## Used to show that we always dump the "Offset" of the first section. +## sh_offset of .foo1 is 0x40. + - Name: .foo1 + Type: SHT_PROGBITS + Size: 1 +## Offset of .foo2 == offset of .foo1 + size of .foo1. +## We don't dump the "Offset" key in this case. +## sh_offset of .foo2 is 0x41. + - Name: .foo2 + Type: SHT_PROGBITS + Size: 1 +## Offset of .foo3 == offset of .foo2 + size of .foo2, +## We don't dump the "Offset" key in this case. +## sh_offset of .foo3 is 0x42. + - Name: .foo3 + Type: SHT_PROGBITS + Size: 1 +## Offset of .bar1 != offset of .foo3 + size of .foo3. +## We dump the "Offset" key in this case. +## sh_offset of .bar1 is 0x100. + - Name: .bar1 + Type: SHT_PROGBITS + Offset: 0x100 + Size: 1 +## [Offset of .bar1 + size of .bar1] aligned by 0x10 is equal to the offset +## of .bar2. We don't dump the "Offset" key in this case. +## sh_offset of .bar2 is 0x110. + - Name: .bar2 + Type: SHT_PROGBITS + AddressAlign: 0x10 + Offset: 0x110 + Size: 1 +## [Offset of .bar2 + size of .bar2] aligned by 0x10 is not equal to the offset +## of .bar3. We dump the "Offset" key in this case. +## sh_offset of .bar3 is 0x200. + - Name: .bar3 + Type: SHT_PROGBITS + AddressAlign: 0x10 + Offset: 0x200 Index: llvm/test/tools/obj2yaml/ELF/ppc64-relocations.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/ppc64-relocations.yaml +++ llvm/test/tools/obj2yaml/ELF/ppc64-relocations.yaml @@ -10,8 +10,9 @@ # CHECK-NEXT: Type: ET_REL # CHECK-NEXT: Machine: EM_PPC64 # CHECK-NEXT: Sections: -# CHECK-NEXT: - Name: .rela.text -# CHECK-NEXT: Type: SHT_RELA +# CHECK-NEXT: - Name: .rela.text +# CHECK-NEXT: Type: SHT_RELA +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Relocations: # CHECK-NEXT: - Type: R_PPC64_NONE # CHECK-NEXT: - Type: R_PPC64_ADDR32 Index: llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml +++ llvm/test/tools/obj2yaml/ELF/rel-rela-section.yaml @@ -9,6 +9,7 @@ ## Previously we printed a broken Info field in this case. # YAML: - Name: .rela.dyn # YAML-NEXT: Type: SHT_RELA +# YAML-NEXT: Offset: 0x0000000000000040 # YAML-NEXT: - Name: .rel.dyn # YAML-NEXT: Type: SHT_REL # YAML-NEXT: - Name Index: llvm/test/tools/obj2yaml/ELF/reladyn-section-shinfo.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/reladyn-section-shinfo.yaml +++ llvm/test/tools/obj2yaml/ELF/reladyn-section-shinfo.yaml @@ -19,10 +19,11 @@ # CHECK-NEXT: AddressAlignment: # CHECK-NEXT: EntrySize: -# YAML: - Name: .rela.dyn -# YAML-NEXT: Type: SHT_RELA -# YAML-NEXT: Flags: [ SHF_ALLOC ] -# YAML-NEXT: Link: .dynsym +# YAML: - Name: .rela.dyn +# YAML-NEXT: Type: SHT_RELA +# YAML-NEXT: Flags: [ SHF_ALLOC ] +# YAML-NEXT: Link: .dynsym +# YAML-NEXT: Offset: 0x0000000000000040 # YAML-NEXT: - Name: --- !ELF Index: llvm/test/tools/obj2yaml/ELF/relocation-type.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/relocation-type.yaml +++ llvm/test/tools/obj2yaml/ELF/relocation-type.yaml @@ -13,6 +13,7 @@ # CHECK-NEXT: Sections: # CHECK-NEXT: - Name: .rela.text # CHECK-NEXT: Type: SHT_RELA +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Relocations: # CHECK-NEXT: - Offset: 0x0000000000000009 # CHECK-NEXT: Type: [[FIRST]] Index: llvm/test/tools/obj2yaml/ELF/relr-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/relr-section.yaml +++ llvm/test/tools/obj2yaml/ELF/relr-section.yaml @@ -16,21 +16,25 @@ # ELF64LE: Sections: # ELF64LE-NEXT: - Name: .relr.dyn # ELF64LE-NEXT: Type: SHT_RELR +# ELF64LE-NEXT: Offset: 0x0000000000000040 # ELF64LE-NEXT: Entries: [ 0x8877665544332211 ] # ELF32LE: Sections: # ELF32LE-NEXT: - Name: .relr.dyn # ELF32LE-NEXT: Type: SHT_RELR +# ELF32LE-NEXT: Offset: 0x0000000000000034 # ELF32LE-NEXT: Entries: [ 0x0000000044332211, 0x0000000088776655 ] # ELF64BE: Sections: # ELF64BE-NEXT: - Name: .relr.dyn # ELF64BE-NEXT: Type: SHT_RELR +# ELF64BE-NEXT: Offset: 0x0000000000000040 # ELF64BE-NEXT: Entries: [ 0x1122334455667788 ] # ELF32BE: Sections: # ELF32BE-NEXT: - Name: .relr.dyn # ELF32BE-NEXT: Type: SHT_RELR +# ELF32BE-NEXT: Offset: 0x0000000000000034 # ELF32BE-NEXT: Entries: [ 0x0000000011223344, 0x0000000055667788 ] --- !ELF @@ -50,6 +54,7 @@ # CONTENT: - Name: .relr.dyn # CONTENT-NEXT: Type: SHT_RELR +# CONTENT-NEXT: Offset: 0x0000000000000040 # CONTENT-NEXT: Content: '11223344556677' --- !ELF @@ -70,7 +75,8 @@ # ENTSIZE: - Name: .relr.dyn # ENTSIZE-NEXT: Type: SHT_RELR -# ENTSIZE-NEXT: EntSize: 0x00000000000000FE +# ENTSIZE-NEXT: EntSize: 0x00000000000000FE +# ENTSIZE-NEXT: Offset: 0x0000000000000040 # ENTSIZE-NEXT: Content: '1122334455667788' # ENTSIZE-NEXT: ... Index: llvm/test/tools/obj2yaml/ELF/sections-info.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/sections-info.yaml +++ llvm/test/tools/obj2yaml/ELF/sections-info.yaml @@ -5,8 +5,9 @@ # RUN: obj2yaml %t | FileCheck %s # CHECK: Sections: -# CHECK-NEXT: - Name: .foo -# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: - Name: .foo +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: - Name: .bar # CHECK-NEXT: Type: SHT_PROGBITS # CHECK-NEXT: Info: 0x0000000000000001 Index: llvm/test/tools/obj2yaml/ELF/shinfo.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/shinfo.yaml +++ llvm/test/tools/obj2yaml/ELF/shinfo.yaml @@ -3,9 +3,10 @@ ## Check obj2yaml is able to dump sh_info field of a section. -# CHECK: - Name: .test -# CHECK-NEXT: Type: SHT_PROGBITS -# CHECK-NEXT: Info: 0x000000000000002A +# CHECK: - Name: .test +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Offset: 0x0000000000000040 +# CHECK-NEXT: Info: 0x000000000000002A --- !ELF FileHeader: Index: llvm/test/tools/obj2yaml/ELF/sht-symtab-shndx.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/sht-symtab-shndx.yaml +++ llvm/test/tools/obj2yaml/ELF/sht-symtab-shndx.yaml @@ -13,6 +13,7 @@ # CASE1-NEXT: Sections: # CASE1-NEXT: - Name: bar # CASE1-NEXT: Type: SHT_PROGBITS +# CASE1-NEXT: Offset: 0x0000000000000040 # CASE1-NEXT: - Name: .symtab_shndx # CASE1-NEXT: Type: SHT_SYMTAB_SHNDX # CASE1-NEXT: Link: .symtab Index: llvm/test/tools/obj2yaml/ELF/stack-sizes.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/stack-sizes.yaml +++ llvm/test/tools/obj2yaml/ELF/stack-sizes.yaml @@ -12,8 +12,9 @@ # VALID-NEXT: Data: ELFDATA2LSB # VALID-NEXT: Type: ET_EXEC # VALID-NEXT: Sections: -# VALID-NEXT: - Name: .stack_sizes -# VALID-NEXT: Type: SHT_PROGBITS +# VALID-NEXT: - Name: .stack_sizes +# VALID-NEXT: Type: SHT_PROGBITS +# VALID-NEXT: Offset: 0x0000000000000040 # VALID-NEXT: Entries: # VALID-NEXT: - Address: 0x0000000000000010 # VALID-NEXT: Size: 0x0000000000000020 @@ -44,6 +45,7 @@ # INVALID-NEXT: Sections: # INVALID-NEXT: - Name: .stack_sizes # INVALID-NEXT: Type: SHT_PROGBITS +# INVALID-NEXT: Offset: 0x0000000000000040 # INVALID-NEXT: Content: '1000000000000000203000000000000000' --- !ELF @@ -69,6 +71,7 @@ # EMPTY-NEXT: Sections: # EMPTY-NEXT: - Name: .stack_sizes # EMPTY-NEXT: Type: SHT_PROGBITS +# EMPTY-NEXT: Offset: 0x0000000000000040 # EMPTY-NEXT: Content: '' --- !ELF @@ -94,6 +97,7 @@ # MULTI-NEXT: Sections: # MULTI-NEXT: - Name: .stack_sizes # MULTI-NEXT: Type: SHT_PROGBITS +# MULTI-NEXT: Offset: 0x0000000000000040 # MULTI-NEXT: Entries: # MULTI-NEXT: - Address: 0x0000000000000010 # MULTI-NEXT: Size: 0x0000000000000020 Index: llvm/test/tools/obj2yaml/ELF/verdef-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/verdef-section.yaml +++ llvm/test/tools/obj2yaml/ELF/verdef-section.yaml @@ -9,6 +9,7 @@ # CHECK-NEXT: Address: 0x0000000000000230 # CHECK-NEXT: Link: .dynstr # CHECK-NEXT: AddressAlign: 0x0000000000000004 +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Info: 0x0000000000000004 # CHECK-NEXT: Entries: # CHECK-NEXT: - Version: 1 Index: llvm/test/tools/obj2yaml/ELF/verneed-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/verneed-section.yaml +++ llvm/test/tools/obj2yaml/ELF/verneed-section.yaml @@ -9,6 +9,7 @@ # CHECK-NEXT: Address: 0x0000000000200250 # CHECK-NEXT: Link: .dynstr # CHECK-NEXT: AddressAlign: 0x0000000000000004 +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Info: 0x0000000000000002 # CHECK-NEXT: Dependencies: # CHECK-NEXT: - Version: 1 Index: llvm/test/tools/obj2yaml/ELF/versym-section.yaml =================================================================== --- llvm/test/tools/obj2yaml/ELF/versym-section.yaml +++ llvm/test/tools/obj2yaml/ELF/versym-section.yaml @@ -17,6 +17,7 @@ # CHECK-NEXT: Link: .dynsym # CHECK-NEXT: AddressAlign: 0x0000000000000002 # CHECK-NEXT: EntSize: 0x0000000000000002 +# CHECK-NEXT: Offset: 0x0000000000000040 # CHECK-NEXT: Entries: [ 0, 3, 4 ] # CHECK-NEXT: - Name: # CHECK: DynamicSymbols: Index: llvm/tools/obj2yaml/elf2yaml.cpp =================================================================== --- llvm/tools/obj2yaml/elf2yaml.cpp +++ llvm/tools/obj2yaml/elf2yaml.cpp @@ -453,6 +453,26 @@ return S.release(); } +template +static void setOffsets(std::vector> &V, + ArrayRef S) { + for (size_t I = 0, E = V.size(); I < E; ++I) { + if (I == 0) + continue; + + const typename ELFT::Shdr &PrevSec = S[I - 1]; + const typename ELFT::Shdr &Sec = S[I]; + + // We only set the "Offset" field when it can't be naturally derived + // from the offset and size of the previous section. This reduces + // the noise in the YAML output. + uint64_t ExpectedOffset = alignTo(PrevSec.sh_offset + PrevSec.sh_size, + Sec.sh_addralign ? Sec.sh_addralign : 1); + if (Sec.sh_offset != ExpectedOffset) + cast(V[I].get())->Offset = (yaml::Hex64)Sec.sh_offset; + } +} + template Expected>> ELFDumper::dumpSections() { @@ -551,6 +571,7 @@ return std::move(E); } + setOffsets(Ret, Sections); return std::move(Ret); }