xref: /llvm-project/llvm/test/MC/WebAssembly/comdat-sections.ll (revision b00e2f2a5f3e48fbbe2324b0b371e5657ccd969c)
1; RUN: llc -dwarf-version=4 -generate-type-units \
2; RUN:     -filetype=obj -O0 -mtriple=wasm32-unknown-unknown < %s \
3; RUN:     | obj2yaml | FileCheck --check-prefix=OBJ %s
4
5; RUN: llc -dwarf-version=4 -generate-type-units \
6; RUN:     -filetype=asm -O0 -mtriple=wasm32-unknown-unknown < %s \
7; RUN:      | FileCheck --check-prefix=ASM %s
8
9
10; OBJ:     Comdats:
11; OBJ-NEXT:      - Name:            '4721183873463917179'
12; OBJ-NEXT:        Entries:
13; OBJ-NEXT:          - Kind:            SECTION
14; OBJ-NEXT:            Index:           3
15
16
17; ASM: .section .debug_types,"G",@,4721183873463917179,comdat
18; Here we are not trying to verify all of the debug info; just enough  to ensure
19; that the section contains a type unit for a type with matching signature
20; ASM-NEXT: .Ltu_begin0:
21; ASM-NEXT:	.int32	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
22; ASM-NEXT: .Ldebug_info_start0:
23; ASM-NEXT:	.int16	4                               # DWARF version number
24; ASM-NEXT:	.int32	.debug_abbrev0                  # Offset Into Abbrev. Section
25; ASM-NEXT:	.int8	4                               # Address Size (in bytes)
26; ASM-NEXT:	.int64	4721183873463917179             # Type Signature
27
28; ModuleID = 't.cpp'
29source_filename = "t.cpp"
30target triple = "wasm32-unknown-unknown-wasm"
31
32%struct.S = type { i32 }
33
34@s = global %struct.S zeroinitializer, align 4, !dbg !0
35
36!llvm.dbg.cu = !{!2}
37!llvm.module.flags = !{!10, !11}
38!llvm.ident = !{!12}
39
40!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
41!1 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 5, type: !6, isLocal: false, isDefinition: true)
42!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 5.0.0 (trunk 295942)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
43!3 = !DIFile(filename: "t.cpp", directory: "/home/probinson/projects/scratch")
44!4 = !{}
45!5 = !{!0}
46!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 1, size: 32, elements: !7, identifier: "_ZTS1S")
47!7 = !{!8}
48!8 = !DIDerivedType(tag: DW_TAG_member, name: "s1", scope: !6, file: !3, line: 2, baseType: !9, size: 32)
49!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
50!10 = !{i32 2, !"Dwarf Version", i32 4}
51!11 = !{i32 2, !"Debug Info Version", i32 3}
52!12 = !{!"clang version 5.0.0 (trunk 295942)"}
53