xref: /llvm-project/lld/test/wasm/merge-string-debug.s (revision 356b85edd78311ae7376f4b271c48b9f0156aeea)
1# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %s -o %t.o
2# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown %p/Inputs/merge-string-debug2.s -o %t2.o
3
4# RUN: wasm-ld %t.o %t2.o -o %t.wasm --no-entry
5# RUN: llvm-readobj -x .debug_str %t.wasm | FileCheck %s --check-prefixes CHECK,CHECK-O1
6
7# Check that we -r/--reclocatable can handle string merging too
8# RUN: wasm-ld --relocatable %t.o %t2.o -o %t3.o
9# RUN: wasm-ld -O1 %t3.o -o %t.wasm --no-entry
10# RUN: llvm-readobj -x .debug_str %t.wasm | FileCheck %s --check-prefixes CHECK,CHECK-O1
11
12# RUN: wasm-ld -O0 %t.o %t2.o -o %tO0.wasm --no-entry
13# RUN: llvm-readobj -x .debug_str %tO0.wasm | FileCheck %s --check-prefixes CHECK,CHECK-O0
14
15.section .debug_str,"S",@
16.Linfo_string0:
17  .asciz "clang version 13.0.0"
18.Linfo_string1:
19  .asciz "foobar"
20
21.section .debug_other,"",@
22  .int32 .Linfo_string0
23
24# CHECK: Hex dump of section '.debug_str':
25
26# CHECK-O0: 0x00000000 636c616e 67207665 7273696f 6e203133 clang version 13
27# CHECK-O0: 0x00000010 2e302e30 00666f6f 62617200 636c616e .0.0.foobar.clan
28# CHECK-O0: 0x00000020 67207665 7273696f 6e203133 2e302e30 g version 13.0.0
29# CHECK-O0: 0x00000030 00626172 00666f6f 00                .bar.foo.
30
31# CHECK-O1: 0x00000000 666f6f62 61720066 6f6f0063 6c616e67 foobar.foo.clang
32# CHECK-O1: 0x00000010 20766572 73696f6e 2031332e 302e3000  version 13.0.0.
33