Derek Schuff 35a5df2de6
[WebAssembly][Object] Record section start offsets at start of payload (#76188)
LLVM ObjectFile currently records the start offsets of sections as the
start of the section header, whereas most other tools (WABT, emscripten,
wasm-tools) record it as the start of the section content, after the
header. This affects binutils tools such as objdump and nm, but not
compilation/assembly (since that is driven by symbols and assembler
labels which already have their values inside the section payload rather
in the header. This patch updates LLVM to match the other tools.
2023-12-21 14:16:37 -08:00

33 lines
759 B
Plaintext

# RUN: yaml2obj %s | llvm-readobj --sections - | FileCheck %s
# Test use of global.get in initializer expressions.
--- !WASM
FileHeader:
Version: 0x00000001
Sections:
- Type: DATA
Segments:
- SectionOffset: 6
InitFlags: 0
Offset:
Opcode: GLOBAL_GET
Index: 1
Content: '64'
...
# CHECK: Section {
# CHECK-NEXT: Type: DATA (0xB)
# CHECK-NEXT: Size: 7
# CHECK-NEXT: Offset: 14
# CHECK-NEXT: Segments [
# CHECK-NEXT: Segment {
# CHECK-NEXT: Size: 1
# CHECK-NEXT: Offset [
# CHECK-NEXT: Global: 1
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: ]