xref: /llvm-project-15.0.7/llvm/test/MC/WebAssembly/comdat-sections.s (revision 8d396aca)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llvm-mc -triple=wasm32 -filetype=obj %s -o - | obj2yaml | FileCheck %s
2
3        .section .text.foo,"G",@,abc123,comdat
4        .globl foo
5        .type foo,@function
6foo:
7        .functype foo () -> ()
8        return
9        end_function
10
11        .globl bar
12bar:
13        .functype bar () -> ()
14        return
15        end_function
16
17        .section .debug_foo,"G",@,abc123,comdat
18        .int32 42
19        .section .debug_foo,"G",@,duplicate,comdat
20        .int64 234
21
22# Check that there are 2 identically-named custom sections, with the desired
23# contents
24# CHECK:  - Type:            CUSTOM
25# CHECK-NEXT:    Name:            .debug_foo
26# CHECK-NEXT:    Payload:         2A000000
27# CHECK-NEXT:  - Type:            CUSTOM
28# CHECK-NEXT:    Name:            .debug_foo
29# CHECK-NEXT:    Payload:         EA00000000000000
30
31# And check that they are in 2 different comdat groups
32# CHECK-NEXT:- Type:            CUSTOM
33# CHECK-NEXT:    Name:            linking
34# CHECK-NEXT:    Version:         2
35# CHECK:    Comdats:
36# CHECK-NEXT:      - Name:            abc123
37# CHECK-NEXT:        Entries:
38# CHECK-NEXT:          - Kind:            FUNCTION
39# CHECK-NEXT:            Index:           0
40
41# If the user forgets to create a new section for a function, one is created for
42# them by the assembler. Check that it is also in the same group.
43# CHECK-NEXT:          - Kind:            FUNCTION
44# CHECK-NEXT:            Index:           1
45# CHECK-NEXT:          - Kind:            SECTION
46# CHECK-NEXT:            Index:           4
47# CHECK-NEXT:      - Name:            duplicate
48# CHECK-NEXT:        Entries:
49# CHECK-NEXT:          - Kind:            SECTION
50# CHECK-NEXT:            Index:           5
51

served by {OpenGrok

Last Index Update: Fri May 15 20:09:11 GMT 2026