72 lines · plain
1# Regression test based on https://github.com/llvm/llvm-project/issues/543862# Test that that linker synthetic functions such as __wasm_tls_init and3# __wasm_apply_global_tls_relocs can be created successfully in programs4# that don't reference __tls_base or __wasm_tls_init. These function both5# reference __tls_base which need to be marks as alive if they are generated.6 7# This is very basic TLS-using program that doesn't reference any of the8# linker-generated symbols.9 10# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s11# RUN: wasm-ld -no-gc-sections --shared-memory -o %t.wasm %t.o12# RUN: obj2yaml %t.wasm | FileCheck %s13# RUN: llvm-objdump -d --no-show-raw-insn --no-leading-addr %t.wasm | FileCheck %s --check-prefixes DIS14 15.globl _start16_start:17 .functype _start () -> (i32)18 global.get tls_sym@GOT@TLS19 end_function20 21.section .tdata.tls_sym,"",@22.globl tls_sym23.p2align 224tls_sym:25 .int32 126 .size tls_sym, 427 28.section .custom_section.target_features,"",@29 .int8 230 .int8 4331 .int8 732 .ascii "atomics"33 .int8 4334 .int8 1135 .ascii "bulk-memory"36 37# CHECK: - Type: CUSTOM38# CHECK-NEXT: Name: name39# CHECK-NEXT: FunctionNames:40# CHECK-NEXT: - Index: 041# CHECK-NEXT: Name: __wasm_call_ctors42# CHECK-NEXT: - Index: 143# CHECK-NEXT: Name: __wasm_init_tls44# CHECK-NEXT: - Index: 245# CHECK-NEXT: Name: __wasm_init_memory46# CHECK-NEXT: - Index: 347# CHECK-NEXT: Name: __wasm_apply_global_tls_relocs48# CHECK-NEXT: - Index: 449# CHECK-NEXT: Name: _start50 51# DIS: <__wasm_init_tls>:52# DIS: local.get 053# DIS-NEXT: global.set 154# DIS-NEXT: local.get 055# DIS-NEXT: i32.const 056# DIS-NEXT: i32.const 457# DIS-NEXT: memory.init 0, 058# DIS-NEXT: call 359# DIS-NEXT: end60 61# DIS: <__wasm_apply_global_tls_relocs>:62# DIS: global.get 163# DIS-NEXT: i32.const 064# DIS-NEXT: i32.add65# DIS-NEXT: global.set 466# DIS-NEXT: end67 68# DIS: <_start>:69# DIS: global.get 470# DIS-NEXT: end71 72