brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 37f1b3b Raw
130 lines · plain
1# RUN: llvm-mc -mattr=+reference-types,+exception-handling -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o2# RUN: wasm-ld --export-dynamic -o %t.wasm %t.o3# RUN: llvm-objdump -d %t.wasm | FileCheck %s4# RUN: wasm-ld --export-dynamic -O2 -o %t-opt.wasm %t.o5# RUN: llvm-objdump -d %t-opt.wasm | FileCheck %s6# RUN: not wasm-ld --compress-relocations -o %t-compressed.wasm %t.o 2>&1 | FileCheck %s -check-prefix=ERROR7# RUN: wasm-ld --export-dynamic --strip-debug --compress-relocations -o %t-compressed.wasm %t.o8# RUN: llvm-objdump -d %t-compressed.wasm | FileCheck %s -check-prefix=COMPRESS9 10  .globl _start11_start:12  .functype _start () -> ()13  end_function14 15  .globl func_ret_i6416func_ret_i64:17  .functype func_ret_i64 () -> (i64)18  i64.const 119  end_function20 21  .globl func_ret_i3222func_ret_i32:23  .functype func_ret_i32 () -> (i32)24  i32.const 225  end_function26 27i32_global:28  .globaltype i32_global, i3229 30i32_tag:31  .tagtype i32_tag i3232 33  .globl test_memory_and_indirect_call_relocs34test_memory_and_indirect_call_relocs:35  .functype test_memory_and_indirect_call_relocs () -> ()36  i32.const indirect_func_ret_i64 # R_WASM_MEMORY_ADDR_SLEB37  i32.load  038  call_indirect () -> (i64)       # R_WASM_TYPE_INDEX_LEB, R_WASM_TABLE_NUMBER_LEB39  drop40  i32.const 041  i32.load  indirect_func_ret_i32 # R_WASM_MEMORY_ADDR_LEB42  call_indirect () -> (i32)43  drop44  i32.const func_ret_i64          # R_WASM_TABLE_INDEX_SLEB45  call_indirect () -> (i64)46  drop47  end_function48 49# CHECK:    test_memory_and_indirect_call_relocs50# CHECK:      41 90 80 84 80 00                 i32.const      6555251# CHECK:      11 80 80 80 80 00 80 80 80 80 00  call_indirect  052# CHECK:      28 02 94 80 84 80 00              i32.load       6555653# CHECK:      11 81 80 80 80 00 80 80 80 80 00  call_indirect  154# CHECK:      41 81 80 80 80 00                 i32.const      155# CHECK:      11 80 80 80 80 00 80 80 80 80 00  call_indirect  056# COMPRESS: test_memory_and_indirect_call_relocs57# COMPRESS:   41 90 80 04                       i32.const      6555258# COMPRESS:   11 00 00                          call_indirect  059# COMPRESS:   28 02 94 80 04                    i32.load       6555660# COMPRESS:   11 01 00                          call_indirect  161# COMPRESS:   41 01                             i32.const      162# COMPRESS:   11 00 00                          call_indirect  063 64  .globl test_simple_index_relocs65test_simple_index_relocs:66  .functype test_simple_index_relocs () -> ()67  call       func_ret_i32 # R_WASM_FUNCTION_INDEX_LEB68  global.set i32_global   # R_WASM_GLOBAL_INDEX_LEB69  i32.const  070  throw      i32_tag      # R_WASM_TAG_INDEX_LEB71  end_function72 73# CHECK:    test_simple_index_relocs74# CHECK:      10 82 80 80 80 00  call        275# CHECK:      24 81 80 80 80 00  global.set  176# CHECK:      08 80 80 80 80 00  throw       077# COMPRESS: test_simple_index_relocs78# COMPRESS:   10 02              call        279# COMPRESS:   24 01              global.set  180# COMPRESS:   08 00              throw       081 82  .globl test_relative_relocs83test_relative_relocs:84  .functype test_relative_relocs () -> ()85  i32.const indirect_func_ret_i64@MBREL # R_WASM_MEMORY_ADDR_REL_SLEB86  drop87  i32.const func_ret_i32@TBREL          # R_WASM_TABLE_INDEX_REL_SLEB88  drop89  i32.const i32_tls_data@TLSREL         # R_WASM_MEMORY_ADDR_TLS_SLEB90  drop91  end_function92 93# CHECK:    test_relative_relocs94# CHECK:      41 90 80 84 80 00  i32.const  6555295# CHECK:      41 81 80 80 80 00  i32.const  196# CHECK:      41 83 80 80 80 00  i32.const  397# COMPRESS: test_relative_relocs98# COMPRESS:   41 90 80 04        i32.const  6555299# COMPRESS:   41 01              i32.const  1100# COMPRESS:   41 03              i32.const  3101 102# ERROR: wasm-ld: error: --compress-relocations is incompatible with output debug information. Please pass --strip-debug or --strip-all103 104  .section .tdata,"T",@105  .int8 0106  .int8 0107  .int8 0108i32_tls_data:109  .int32 65110  .size  i32_tls_data, 4111 112  .section .data,"",@113  .p2align 4114indirect_func_ret_i64:115  .int32 func_ret_i64116  .size  indirect_func_ret_i64, 4117 118indirect_func_ret_i32:119  .int32 func_ret_i32120  .size  indirect_func_ret_i32, 4121 122.section .custom_section.target_features,"",@123  .int8 2124  .int8 43125  .int8 7126  .ascii  "atomics"127  .int8 43128  .int8 11129  .ascii  "bulk-memory"130