2019-05-01 13:27:20 +08:00
|
|
|
; RUN: llc -O0 -filetype=obj %s -o - | llvm-readobj -r --expand-relocs | FileCheck %s
|
2018-01-24 07:03:47 +08:00
|
|
|
|
2018-05-11 01:49:11 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2017-04-29 05:22:38 +08:00
|
|
|
|
|
|
|
; foo and bar are external and internal symbols. a and b are pointers
|
|
|
|
; initialized to these locations offset by 2 and -2 elements respecitively.
|
2018-01-24 07:03:47 +08:00
|
|
|
|
2017-04-29 05:22:38 +08:00
|
|
|
@foo = external global i32, align 4
|
|
|
|
@bar = global i64 7, align 4
|
|
|
|
@a = global i32* getelementptr (i32, i32* @foo, i32 2), align 8
|
|
|
|
@b = global i64* getelementptr (i64, i64* @bar, i64 -2), align 8
|
2017-09-15 07:07:53 +08:00
|
|
|
@c = global [3 x i32*] [i32* @foo, i32* @foo, i32* @foo], align 16
|
2017-04-29 05:22:38 +08:00
|
|
|
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK: Format: WASM
|
|
|
|
; CHECK: Relocations [
|
2019-04-13 06:27:48 +08:00
|
|
|
; CHECK-NEXT: Section (3) DATA {
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Relocation {
|
2019-02-05 01:28:46 +08:00
|
|
|
; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Offset: 0x13
|
2018-05-02 00:35:16 +08:00
|
|
|
; CHECK-NEXT: Symbol: foo
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Addend: 8
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: Relocation {
|
2019-02-05 01:28:46 +08:00
|
|
|
; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Offset: 0x1C
|
2018-05-02 00:35:16 +08:00
|
|
|
; CHECK-NEXT: Symbol: bar
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Addend: -16
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: Relocation {
|
2019-02-05 01:28:46 +08:00
|
|
|
; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Offset: 0x25
|
2018-05-02 00:35:16 +08:00
|
|
|
; CHECK-NEXT: Symbol: foo
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Addend: 0
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: Relocation {
|
2019-02-05 01:28:46 +08:00
|
|
|
; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Offset: 0x29
|
2018-05-02 00:35:16 +08:00
|
|
|
; CHECK-NEXT: Symbol: foo
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Addend: 0
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: Relocation {
|
2019-02-05 01:28:46 +08:00
|
|
|
; CHECK-NEXT: Type: R_WASM_MEMORY_ADDR_I32 (5)
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Offset: 0x2D
|
2018-05-02 00:35:16 +08:00
|
|
|
; CHECK-NEXT: Symbol: foo
|
2017-09-15 07:07:53 +08:00
|
|
|
; CHECK-NEXT: Addend: 0
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: }
|
|
|
|
; CHECK-NEXT: ]
|