llvm/test/MC/WebAssembly/external-data.ll
Sam Clegg c9c28d96fa [WebAssembly] Expose the offset of each data segment
Summary:
This allows tools like lld that process relocations
to apply data relocation correctly. This information
is required because relocation are stored as section
offset.

Subscribers: jfb, dschuff, jgravelle-google, aheejin

Differential Revision: https://reviews.llvm.org/D35234

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307741 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-12 00:24:54 +00:00

23 lines
779 B
LLVM

; RUN: llc -mtriple wasm32-unknown-unknown-wasm -filetype=obj %s -o - | obj2yaml | FileCheck %s
; Verify relocations are correctly generated for addresses of externals
; in the data section.
@myimport = external global i32, align 4
@foo = global i64 7, align 4
@bar = hidden global i32* @myimport, align 4
; CHECK: - Type: DATA
; CHECK: Relocations:
; CHECK: - Type: R_WEBASSEMBLY_GLOBAL_ADDR_I32
; CHECK: Index: 0
; CHECK: Offset: 0x0000000E
; CHECK: Segments:
; CHECK: - SectionOffset: 6
; CHECK: MemoryIndex: 0
; CHECK: Offset:
; CHECK: Opcode: I32_CONST
; CHECK: Value: 0
; CHECK: Content: 0700000000000000FFFFFFFF