1# RUN: yaml2obj %s -o %t1.o
2
3# RUN: wasm-ld --no-entry --features=foo,bar,baz -o %t.specified.wasm %t1.o
4# RUN: obj2yaml %t.specified.wasm | FileCheck %s --check-prefix SPECIFIED
5
6# RUN: wasm-ld --no-entry --features=bar,baz,quux -o %t.unspecified.wasm %t1.o
7# RUN: obj2yaml %t.unspecified.wasm | FileCheck %s --check-prefix UNSPECIFIED
8
9# RUN: yaml2obj %S/Inputs/disallow-feature-foo.yaml -o %t.disallowed.o
10# RUN: wasm-ld --no-entry -o - %t1.o %t.disallowed.o | obj2yaml | FileCheck %s --check-prefix DISALLOWED
11
12# RUN: yaml2obj %S/Inputs/no-feature-foo.yaml -o %t.none.o
13# RUN: wasm-ld --no-entry -o - %t1.o %t.none.o | obj2yaml | FileCheck %s --check-prefix NONE
14
15# Check that the following combinations of feature linkage policies
16# give the expected results:
17#
18#     DISALLOWED x DISALLOWED => NONE
19#     DISALLOWED x NONE => NONE
20
21--- !WASM
22FileHeader:
23  Version:         0x00000001
24Sections:
25  - Type:            CUSTOM
26    Name:            linking
27    Version:         2
28  - Type:            CUSTOM
29    Name:            target_features
30    Features:
31      - Prefix:        DISALLOWED
32        Name:          "foo"
33        # included so output has target features section
34      - Prefix:        USED
35        Name:          "bar"
36...
37
38# SPECIFIED:        - Type:            CUSTOM
39# SPECIFIED:          Name:            target_features
40# SPECIFIED-NEXT:     Features:
41# SPECIFIED-NEXT:       - Prefix:          USED
42# SPECIFIED-NEXT:         Name:            bar
43# SPECIFIED-NEXT:       - Prefix:          USED
44# SPECIFIED-NEXT:         Name:            baz
45# SPECIFIED-NEXT:       - Prefix:          USED
46# SPECIFIED-NEXT:         Name:            foo
47# SPECIFIED-NEXT: ...
48
49# UNSPECIFIED:        - Type:            CUSTOM
50# UNSPECIFIED:          Name:            target_features
51# UNSPECIFIED-NEXT:     Features:
52# UNSPECIFIED-NEXT:       - Prefix:          USED
53# UNSPECIFIED-NEXT:         Name:            bar
54# UNSPECIFIED-NEXT:       - Prefix:          USED
55# UNSPECIFIED-NEXT:         Name:            baz
56# UNSPECIFIED-NEXT:       - Prefix:          USED
57# UNSPECIFIED-NEXT:         Name:            quux
58# UNSPECIFIED-NEXT: ...
59
60# DISALLOWED:        - Type:            CUSTOM
61# DISALLOWED:          Name:            target_features
62# DISALLOWED-NEXT:     Features:
63# DISALLOWED-NEXT:       - Prefix:          USED
64# DISALLOWED-NEXT:         Name:            bar
65# DISALLOWED-NEXT: ...
66
67# NONE:        - Type:            CUSTOM
68# NONE:          Name:            target_features
69# NONE-NEXT:     Features:
70# NONE-NEXT:       - Prefix:          USED
71# NONE-NEXT:         Name:            bar
72# NONE-NEXT: ...
73