108 lines · plain
1# REQUIRES: webassembly-registered-target2 3# Test that DWARF tombstones are correctly detected/respected in wasm4# 32 bit object files.5 6# The test case was produced by the following steps:7#8# // test-clang.cpp9# void foo() {10# }11#12# 1) clang --target=wasm32 -S -g test-clang.cpp13# -o Inputs/wasm-32bit-tombstone.s14#15# 2) Creating a single function, tombstoning it in the assembly, by16# manually changing the DW_AT_low_pc for the DW_TAG_subprogram:17# .Lfunc_begin0 to 0xffffffff to mark the function as dead code:18#19# .int8 2 # Abbrev [2] 0x26:0x1b DW_TAG_subprogram20# .int32 .Lfunc_begin0 # DW_AT_low_pc <---------21# .int32 .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc22 23# .int8 2 # Abbrev [2] 0x26:0x1b DW_TAG_subprogram24# .int32 0xffffffff # DW_AT_low_pc <---------25# .int32 .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc26 27# RUN: llvm-mc -arch=wasm32 -filetype=obj \28# RUN: %p/wasm-32bit-tombstone.s \29# RUN: -o %t.wasm-32bit-tombstone.wasm30 31# RUN: llvm-debuginfo-analyzer --select-elements=Discarded \32# RUN: --print=elements \33# RUN: %t.wasm-32bit-tombstone.wasm 2>&1 | \34# RUN: FileCheck --strict-whitespace -check-prefix=ONE %s35 36# ONE: Logical View:37# ONE-NEXT: {File} '{{.*}}wasm-32bit-tombstone.wasm'38# ONE-EMPTY:39# ONE-NEXT: {CompileUnit} 'test-clang.cpp'40# ONE-NEXT: {Function} not_inlined 'foo' -> 'void'41 42# RUN: llvm-dwarfdump --debug-info %t.wasm-32bit-tombstone.wasm | \43# RUN: FileCheck %s --check-prefix=TWO44 45# TWO: DW_TAG_subprogram46# TWO-NEXT: DW_AT_low_pc (dead code)47# TWO-NEXT: DW_AT_high_pc48# TWO-NEXT: DW_AT_name ("foo")49 50 .text51 .file "test-clang.cpp"52 .functype _Z3foov () -> ()53 .section .text._Z3foov,"",@54_Z3foov: # @_Z3foov55.Lfunc_begin0:56 .functype _Z3foov () -> ()57 return58 end_function59.Lfunc_end0:60 # -- End function61 .section .debug_abbrev,"",@62 .int8 1 # Abbreviation Code63 .int8 17 # DW_TAG_compile_unit64 .int8 1 # DW_CHILDREN_yes65 .int8 3 # DW_AT_name66 .int8 14 # DW_FORM_strp67 .int8 17 # DW_AT_low_pc68 .int8 1 # DW_FORM_addr69 .int8 18 # DW_AT_high_pc70 .int8 6 # DW_FORM_data471 .int8 0 # EOM(1)72 .int8 0 # EOM(2)73 .int8 2 # Abbreviation Code74 .int8 46 # DW_TAG_subprogram75 .int8 0 # DW_CHILDREN_no76 .int8 17 # DW_AT_low_pc77 .int8 1 # DW_FORM_addr78 .int8 18 # DW_AT_high_pc79 .int8 6 # DW_FORM_data480 .int8 3 # DW_AT_name81 .int8 14 # DW_FORM_strp82 .int8 0 # EOM(1)83 .int8 0 # EOM(2)84 .int8 0 # EOM(3)85 .section .debug_info,"",@86.Lcu_begin0:87 .int32 .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit88.Ldebug_info_start0:89 .int16 4 # DWARF version number90 .int32 .debug_abbrev0 # Offset Into Abbrev. Section91 .int8 4 # Address Size (in bytes)92 .int8 1 # Abbrev [1] 0xb:0x37 DW_TAG_compile_unit93 .int32 .Linfo_string1 # DW_AT_name94 .int32 .Lfunc_begin0 # DW_AT_low_pc95 .int32 .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc96 .int8 2 # Abbrev [2] 0x26:0x1b DW_TAG_subprogram97 .int32 0xffffffff # DW_AT_low_pc98 .int32 .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc99 .int32 .Linfo_string4 # DW_AT_name100 .int8 0 # End Of Children Mark101.Ldebug_info_end0:102 .section .debug_str,"S",@103.Linfo_string1:104 .asciz "test-clang.cpp" # string offset=176105.Linfo_string4:106 .asciz "foo" # string offset=241107 .ident "clang version 19.0.0"108