2018-01-24 11:29:47 +08:00
|
|
|
; RUN: llc -filetype=obj %p/Inputs/hello.ll -o %t.hello.o
|
|
|
|
; RUN: llc -filetype=obj %s -o %t.o
|
|
|
|
|
2018-05-11 01:59:41 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2017-11-18 02:14:09 +08:00
|
|
|
|
|
|
|
@foo = hidden global i32 1, align 4
|
|
|
|
@aligned_bar = hidden global i32 3, align 16
|
|
|
|
|
|
|
|
@hello_str = external global i8*
|
|
|
|
@external_ref = global i8** @hello_str, align 8
|
|
|
|
|
2018-03-14 08:53:34 +08:00
|
|
|
%struct.s = type { i32, i32 }
|
|
|
|
@local_struct = hidden global %struct.s zeroinitializer, align 4
|
|
|
|
@local_struct_internal_ptr = hidden local_unnamed_addr global i32* getelementptr inbounds (%struct.s, %struct.s* @local_struct, i32 0, i32 1), align 4
|
|
|
|
|
2019-06-01 06:51:59 +08:00
|
|
|
; RUN: wasm-ld -no-gc-sections --export=__data_end --export=__heap_base --allow-undefined --no-entry -o %t.wasm %t.o %t.hello.o
|
2018-01-23 05:55:43 +08:00
|
|
|
; RUN: obj2yaml %t.wasm | FileCheck %s
|
|
|
|
|
2018-03-14 21:53:58 +08:00
|
|
|
; CHECK: - Type: MEMORY
|
|
|
|
; CHECK-NEXT: Memories:
|
|
|
|
; CHECK-NEXT: - Initial: 0x00000002
|
|
|
|
; CHECK-NEXT: - Type: GLOBAL
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Globals:
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 0
|
|
|
|
; CHECK-NEXT: Type: I32
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Mutable: true
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: InitExpr:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Value: 66624
|
2018-01-10 05:47:36 +08:00
|
|
|
; CHECK-NEXT: - Index: 1
|
|
|
|
; CHECK-NEXT: Type: I32
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Mutable: false
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: InitExpr:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Value: 1080
|
2019-06-01 06:51:59 +08:00
|
|
|
; CHECK-NEXT: - Index: 2
|
|
|
|
; CHECK-NEXT: Type: I32
|
|
|
|
; CHECK-NEXT: Mutable: false
|
|
|
|
; CHECK-NEXT: InitExpr:
|
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Value: 66624
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2019-06-01 06:51:59 +08:00
|
|
|
; CHECK: - Type: DATA
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Segments:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: - SectionOffset: 7
|
2019-02-20 06:56:19 +08:00
|
|
|
; CHECK-NEXT: InitFlags: 0
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Offset:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
|
|
|
; CHECK-NEXT: Value: 1024
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Content: 68656C6C6F0A00
|
|
|
|
; CHECK-NEXT: - SectionOffset: 20
|
2019-02-20 06:56:19 +08:00
|
|
|
; CHECK-NEXT: InitFlags: 0
|
2018-01-24 08:22:53 +08:00
|
|
|
; CHECK-NEXT: Offset:
|
2017-11-18 02:14:09 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Value: 1040
|
|
|
|
; CHECK-NEXT: Content: '0100000000000000000000000000000003000000000000000004000034040000'
|
|
|
|
; CHECK-NEXT: - SectionOffset: 58
|
2019-02-20 06:56:19 +08:00
|
|
|
; CHECK-NEXT: InitFlags: 0
|
|
|
|
; CHECK-NEXT: Offset:
|
2018-03-14 08:53:34 +08:00
|
|
|
; CHECK-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; CHECK-NEXT: Value: 1072
|
|
|
|
; CHECK-NEXT: Content: '0000000000000000'
|
2018-03-14 08:53:34 +08:00
|
|
|
; CHECK-NEXT: - Type: CUSTOM
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-01-23 05:55:43 +08:00
|
|
|
|
2018-05-15 07:01:16 +08:00
|
|
|
; RUN: wasm-ld -no-gc-sections --allow-undefined --no-entry \
|
2018-03-14 21:53:58 +08:00
|
|
|
; RUN: --initial-memory=131072 --max-memory=131072 -o %t_max.wasm %t.o \
|
|
|
|
; RUN: %t.hello.o
|
|
|
|
; RUN: obj2yaml %t_max.wasm | FileCheck %s -check-prefix=CHECK-MAX
|
|
|
|
|
|
|
|
; CHECK-MAX: - Type: MEMORY
|
|
|
|
; CHECK-MAX-NEXT: Memories:
|
|
|
|
; CHECK-MAX-NEXT: - Flags: [ HAS_MAX ]
|
|
|
|
; CHECK-MAX-NEXT: Initial: 0x00000002
|
|
|
|
; CHECK-MAX-NEXT: Maximum: 0x00000002
|
|
|
|
|
2018-11-07 01:59:32 +08:00
|
|
|
; RUN: wasm-ld -no-gc-sections --allow-undefined --no-entry --shared-memory \
|
2019-09-05 03:50:39 +08:00
|
|
|
; RUN: --features=atomics,bulk-memory --initial-memory=131072 \
|
|
|
|
; RUN: --max-memory=131072 -o %t_max.wasm %t.o %t.hello.o
|
2018-11-07 01:59:32 +08:00
|
|
|
; RUN: obj2yaml %t_max.wasm | FileCheck %s -check-prefix=CHECK-SHARED
|
|
|
|
|
|
|
|
; CHECK-SHARED: - Type: MEMORY
|
|
|
|
; CHECK-SHARED-NEXT: Memories:
|
|
|
|
; CHECK-SHARED-NEXT: - Flags: [ HAS_MAX, IS_SHARED ]
|
|
|
|
; CHECK-SHARED-NEXT: Initial: 0x00000002
|
|
|
|
; CHECK-SHARED-NEXT: Maximum: 0x00000002
|
2018-03-14 21:53:58 +08:00
|
|
|
|
2018-05-05 09:23:07 +08:00
|
|
|
; RUN: wasm-ld --relocatable -o %t_reloc.wasm %t.o %t.hello.o
|
2018-01-23 05:55:43 +08:00
|
|
|
; RUN: obj2yaml %t_reloc.wasm | FileCheck %s -check-prefix=RELOC
|
|
|
|
|
|
|
|
; RELOC: - Type: DATA
|
|
|
|
; RELOC-NEXT: Relocations:
|
2019-02-05 01:49:33 +08:00
|
|
|
; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
|
2019-01-31 02:55:15 +08:00
|
|
|
; RELOC-NEXT: Index: 3
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Offset: 0x00000024
|
2019-02-05 01:49:33 +08:00
|
|
|
; RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
|
2019-01-31 02:55:15 +08:00
|
|
|
; RELOC-NEXT: Index: 4
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Offset: 0x0000002D
|
2018-03-14 08:53:34 +08:00
|
|
|
; RELOC-NEXT: Addend: 4
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Segments:
|
|
|
|
; RELOC-NEXT: - SectionOffset: 6
|
2019-02-20 06:56:19 +08:00
|
|
|
; RELOC-NEXT: InitFlags: 0
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Offset:
|
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
|
|
|
; RELOC-NEXT: Value: 0
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Content: 68656C6C6F0A00
|
|
|
|
; RELOC-NEXT: - SectionOffset: 18
|
|
|
|
; RELOC-NEXT: InitFlags: 0
|
|
|
|
; RELOC-NEXT: Offset:
|
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
|
|
|
; RELOC-NEXT: Value: 8
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Content: '01000000'
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: - SectionOffset: 27
|
2019-02-20 06:56:19 +08:00
|
|
|
; RELOC-NEXT: InitFlags: 0
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Offset:
|
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
|
|
|
; RELOC-NEXT: Value: 16
|
|
|
|
; RELOC-NEXT: Content: '03000000'
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: - SectionOffset: 36
|
2019-02-20 06:56:19 +08:00
|
|
|
; RELOC-NEXT: InitFlags: 0
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Offset:
|
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
|
|
|
; RELOC-NEXT: Value: 24
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Content: '00000000'
|
|
|
|
; RELOC-NEXT: - SectionOffset: 45
|
2019-02-20 06:56:19 +08:00
|
|
|
; RELOC-NEXT: InitFlags: 0
|
|
|
|
; RELOC-NEXT: Offset:
|
2018-01-23 05:55:43 +08:00
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
|
|
|
; RELOC-NEXT: Value: 28
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Content: '24000000'
|
|
|
|
; RELOC-NEXT: - SectionOffset: 54
|
2019-02-20 06:56:19 +08:00
|
|
|
; RELOC-NEXT: InitFlags: 0
|
2018-03-14 08:53:34 +08:00
|
|
|
; RELOC-NEXT: Offset:
|
|
|
|
; RELOC-NEXT: Opcode: I32_CONST
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Value: 32
|
|
|
|
; RELOC-NEXT: Content: '0000000000000000'
|
2018-01-23 05:55:43 +08:00
|
|
|
|
2018-04-27 02:17:21 +08:00
|
|
|
; RELOC: SymbolTable:
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: - Index: 0
|
|
|
|
; RELOC-NEXT: Kind: DATA
|
|
|
|
; RELOC-NEXT: Name: foo
|
|
|
|
; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Segment: 1
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: Size: 4
|
|
|
|
; RELOC-NEXT: - Index: 1
|
|
|
|
; RELOC-NEXT: Kind: DATA
|
|
|
|
; RELOC-NEXT: Name: aligned_bar
|
|
|
|
; RELOC-NEXT: Flags: [ VISIBILITY_HIDDEN ]
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Segment: 2
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: Size: 4
|
|
|
|
; RELOC-NEXT: - Index: 2
|
|
|
|
; RELOC-NEXT: Kind: DATA
|
|
|
|
; RELOC-NEXT: Name: external_ref
|
|
|
|
; RELOC-NEXT: Flags: [ ]
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Segment: 3
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: Size: 4
|
2019-01-31 02:55:15 +08:00
|
|
|
; RELOC-NEXT: - Index: 3
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: Kind: DATA
|
|
|
|
; RELOC-NEXT: Name: hello_str
|
|
|
|
; RELOC-NEXT: Flags: [ ]
|
2019-09-19 09:14:59 +08:00
|
|
|
; RELOC-NEXT: Segment: 0
|
2018-02-23 13:08:53 +08:00
|
|
|
; RELOC-NEXT: Size: 7
|