102 lines · plain
1// RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o2// RUN: wasm-ld -O1 %t.o -o %t.wasm --no-gc-sections --no-entry3// RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=COMMON,MERGE4 5// Check that the default is the same as -O1 (since we default to -O1)6// RUN: wasm-ld %t.o -o %t.wasm --no-gc-sections --no-entry7// RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=COMMON,MERGE8 9// Check that -O0 disables merging10// RUN: wasm-ld -O0 %t.o -o %t2.wasm --no-gc-sections --no-entry11// RUN: obj2yaml %t2.wasm | FileCheck --check-prefixes=COMMON,NOMERGE %s12 13// Check relocatable14// RUN: wasm-ld -r %t.o -o %t2.o15// RUN: obj2yaml %t2.o | FileCheck --check-prefixes=RELOC %s16 17 .section .rodata1,"S",@18 .asciz "abc"19foo:20 .ascii "a"21 .size foo, 122bar:23 .asciz "bc"24 .asciz "bc"25 .size bar, 626 27 .section .rodata_relocs,"",@28negative_addend:29 .int32 foo-1030 .size negative_addend, 431 32.globl foo33.globl bar34.export_name foo, foo35.export_name bar, bar36 37// COMMON: - Type: GLOBAL38// COMMON-NEXT: Globals:39// COMMON-NEXT: - Index: 040// COMMON-NEXT: Type: I3241// COMMON-NEXT: Mutable: true42// COMMON-NEXT: InitExpr:43// COMMON-NEXT: Opcode: I32_CONST44// COMMON-NEXT: Value: 6553645// COMMON-NEXT: - Index: 146// COMMON-NEXT: Type: I3247// COMMON-NEXT: Mutable: false48// COMMON-NEXT: InitExpr:49// COMMON-NEXT: Opcode: I32_CONST50// MERGE-NEXT: Value: 6553651// NOMERGE-NEXT: Value: 6554052// COMMON-NEXT: - Index: 253// COMMON-NEXT: Type: I3254// COMMON-NEXT: Mutable: false55// COMMON-NEXT: InitExpr:56// COMMON-NEXT: Opcode: I32_CONST57// MERGE-NEXT: Value: 6553758// NOMERGE-NEXT: Value: 6554159// COMMON-NEXT: - Type: EXPORT60// COMMON-NEXT: Exports:61// COMMON-NEXT: - Name: memory62// COMMON-NEXT: Kind: MEMORY63// COMMON-NEXT: Index: 064// COMMON-NEXT: - Name: foo65// COMMON-NEXT: Kind: GLOBAL66// COMMON-NEXT: Index: 167// COMMON-NEXT: - Name: bar68// COMMON-NEXT: Kind: GLOBAL69// COMMON-NEXT: Index: 270 71//72// COMMON: - Type: DATA73// COMMON-NEXT: Segments:74// COMMON-NEXT: - SectionOffset: 875// COMMON-NEXT: InitFlags: 076// COMMON-NEXT: Offset:77// COMMON-NEXT: Opcode: I32_CONST78// COMMON-NEXT: Value: 6553679// MERGE-NEXT: Content: '61626300'80// NOMERGE-NEXT: Content: '6162630061626300626300'81 82 83// RELOC: - Type: DATA84// RELOC-NEXT: Relocations:85// RELOC-NEXT: - Type: R_WASM_MEMORY_ADDR_I3286// RELOC-NEXT: Index: 087// RELOC-NEXT: Offset: 0xF88// RELOC-NEXT: Addend: -1089// RELOC-NEXT: Segments:90// RELOC-NEXT: - SectionOffset: 691// RELOC-NEXT: InitFlags: 092// RELOC-NEXT: Offset:93// RELOC-NEXT: Opcode: I32_CONST94// RELOC-NEXT: Value: 095// RELOC-NEXT: Content: '61626300'96// RELOC-NEXT: - SectionOffset: 1597// RELOC-NEXT: InitFlags: 098// RELOC-NEXT: Offset:99// RELOC-NEXT: Opcode: I32_CONST100// RELOC-NEXT: Value: 4101// RELOC-NEXT: Content: F6FFFFFF102