125 lines · plain
1// RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o2// RUN: wasm-ld --no-entry -Bsymbolic %t.o -o %t.wasm 2>&1 | FileCheck -check-prefix=WARNING %s3// WARNING: warning: -Bsymbolic is only meaningful when combined with -shared4 5// RUN: wasm-ld --experimental-pic -shared %t.o -o %t0.so6// RUN: obj2yaml %t0.so | FileCheck -check-prefix=NOOPTION %s7 8// RUN: wasm-ld --experimental-pic -shared -Bsymbolic %t.o -o %t1.so9// RUN: obj2yaml %t1.so | FileCheck -check-prefix=SYMBOLIC %s10 11// NOOPTION: - Type: IMPORT12// NOOPTION-NEXT: Imports:13// NOOPTION-NEXT: - Module: env14// NOOPTION-NEXT: Field: memory15// NOOPTION-NEXT: Kind: MEMORY16// NOOPTION-NEXT: Memory:17// NOOPTION-NEXT: Minimum: 0x118// NOOPTION-NEXT: - Module: env19// NOOPTION-NEXT: Field: __memory_base20// NOOPTION-NEXT: Kind: GLOBAL21// NOOPTION-NEXT: GlobalType: I3222// NOOPTION-NEXT: GlobalMutable: false23// NOOPTION-NEXT: - Module: env24// NOOPTION-NEXT: Field: __table_base25// NOOPTION-NEXT: Kind: GLOBAL26// NOOPTION-NEXT: GlobalType: I3227// NOOPTION-NEXT: GlobalMutable: false28// NOOPTION-NEXT: - Module: GOT.func29// NOOPTION-NEXT: Field: foo30// NOOPTION-NEXT: Kind: GLOBAL31// NOOPTION-NEXT: GlobalType: I3232// NOOPTION-NEXT: GlobalMutable: true33// NOOPTION-NEXT: - Module: GOT.mem34// NOOPTION-NEXT: Field: bar35// NOOPTION-NEXT: Kind: GLOBAL36// NOOPTION-NEXT: GlobalType: I3237// NOOPTION-NEXT: GlobalMutable: true38// NOOPTION-NEXT: - Type: FUNCTION39 40// NOOPTION: - Type: GLOBAL41// NOOPTION-NEXT: Globals:42// NOOPTION-NEXT: - Index: 443// NOOPTION-NEXT: Type: I3244// NOOPTION-NEXT: Mutable: false45// NOOPTION-NEXT: InitExpr:46// NOOPTION-NEXT: Opcode: I32_CONST47// NOOPTION-NEXT: Value: 048// NOOPTION-NEXT: - Type: EXPORT49 50// SYMBOLIC-NOT: - Module: GOT.mem51// SYMBOLIC-NOT: - Module: GOT.func52 53// SYMBOLIC: - Type: IMPORT54// SYMBOLIC-NEXT: Imports:55// SYMBOLIC-NEXT: - Module: env56// SYMBOLIC-NEXT: Field: memory57// SYMBOLIC-NEXT: Kind: MEMORY58// SYMBOLIC-NEXT: Memory:59// SYMBOLIC-NEXT: Minimum: 0x160// SYMBOLIC-NEXT: - Module: env61// SYMBOLIC-NEXT: Field: __memory_base62// SYMBOLIC-NEXT: Kind: GLOBAL63// SYMBOLIC-NEXT: GlobalType: I3264// SYMBOLIC-NEXT: GlobalMutable: false65// SYMBOLIC-NEXT: - Module: env66// SYMBOLIC-NEXT: Field: __table_base67// SYMBOLIC-NEXT: Kind: GLOBAL68// SYMBOLIC-NEXT: GlobalType: I3269// SYMBOLIC-NEXT: GlobalMutable: false70// SYMBOLIC-NEXT: - Module: env71// SYMBOLIC-NEXT: Field: __indirect_function_table72// SYMBOLIC-NEXT: Kind: TABLE73// SYMBOLIC-NEXT: Table:74// SYMBOLIC-NEXT: Index: 075// SYMBOLIC-NEXT: ElemType: FUNCREF76// SYMBOLIC-NEXT: Limits:77// SYMBOLIC-NEXT: Minimum: 0x178// SYMBOLIC-NEXT: - Type: FUNCTION79 80// SYMBOLIC: - Type: GLOBAL81// SYMBOLIC-NEXT: Globals:82// SYMBOLIC-NEXT: - Index: 283// SYMBOLIC-NEXT: Type: I3284// SYMBOLIC-NEXT: Mutable: true85// SYMBOLIC-NEXT: InitExpr:86// SYMBOLIC-NEXT: Opcode: I32_CONST87// SYMBOLIC-NEXT: Value: 088// SYMBOLIC-NEXT: - Index: 389// SYMBOLIC-NEXT: Type: I3290// SYMBOLIC-NEXT: Mutable: true91// SYMBOLIC-NEXT: InitExpr:92// SYMBOLIC-NEXT: Opcode: I32_CONST93// SYMBOLIC-NEXT: Value: 094// SYMBOLIC-NEXT: - Index: 495// SYMBOLIC-NEXT: Type: I3296// SYMBOLIC-NEXT: Mutable: false97// SYMBOLIC-NEXT: InitExpr:98// SYMBOLIC-NEXT: Opcode: I32_CONST99// SYMBOLIC-NEXT: Value: 0100// SYMBOLIC-NEXT: - Type: EXPORT101 102.globl foo103 104foo:105 .functype foo () -> ()106 end_function107 108.globl get_foo_address109get_foo_address:110 .functype get_foo_address () -> (i32)111 global.get foo@GOT112 end_function113 114.globl get_bar_address115get_bar_address:116 .functype get_bar_address () -> (i32)117 global.get bar@GOT118 end_function119 120.globl bar121.section .data.bar,"",@122bar:123 .int 42124.size bar, 4125