1# RUN: yaml2obj %s -o %t1.o
2
3# RUN: wasm-ld --no-entry --features=foo,bar,baz -o - %t1.o | obj2yaml | FileCheck %s --check-prefix SPECIFIED
4
5# RUN: not wasm-ld --no-entry --features=bar,baz,quux -o /dev/null %t1.o 2>&1 | FileCheck %s --check-prefix UNSPECIFIED
6
7# RUN: wasm-ld --no-entry --no-check-features --features=bar,baz,quux -o - %t1.o | obj2yaml | FileCheck %s --check-prefix UNSPECIFIED-NOCHECK
8
9# RUN: yaml2obj %S/Inputs/use-feature-foo.yaml -o %t.used.o
10# RUN: wasm-ld --no-entry -o - %t1.o %t.used.o | obj2yaml | FileCheck %s --check-prefix USED
11
12# RUN: yaml2obj %S/Inputs/require-feature-foo.yaml -o %t.required.o
13# RUN: wasm-ld --no-entry -o - %t1.o %t.required.o | obj2yaml | FileCheck %s --check-prefix REQUIRED
14
15# RUN: yaml2obj %S/Inputs/disallow-feature-foo.yaml -o %t.disallowed.o
16# RUN: not wasm-ld --no-entry -o /dev/null %t1.o %t.disallowed.o 2>&1 | FileCheck %s --check-prefix DISALLOWED
17
18# RUN: wasm-ld --no-entry --no-check-features -o - %t1.o %t.disallowed.o | obj2yaml | FileCheck %s --check-prefix DISALLOWED-NOCHECK
19
20# RUN: yaml2obj %S/Inputs/no-feature-foo.yaml -o %t.none.o
21# RUN: wasm-ld --no-entry -o - %t1.o %t.none.o | obj2yaml | FileCheck %s --check-prefix NONE
22
23# Check that the following combinations of feature linkage policies
24# give the expected results:
25#
26#     USED x USED => USED
27#     USED x REQUIRED => USED
28#     USED x DISALLOWED => Error
29#     USED x NONE => USED
30
31--- !WASM
32FileHeader:
33  Version:         0x00000001
34Sections:
35  - Type:            CUSTOM
36    Name:            linking
37    Version:         2
38  - Type:            CUSTOM
39    Name:            target_features
40    Features:
41      - Prefix:        USED
42        Name:          "foo"
43...
44
45# SPECIFIED:        - Type:            CUSTOM
46# SPECIFIED:          Name:            target_features
47# SPECIFIED-NEXT:     Features:
48# SPECIFIED-NEXT:       - Prefix:          USED
49# SPECIFIED-NEXT:         Name:            bar
50# SPECIFIED-NEXT:       - Prefix:          USED
51# SPECIFIED-NEXT:         Name:            baz
52# SPECIFIED-NEXT:       - Prefix:          USED
53# SPECIFIED-NEXT:         Name:            foo
54# SPECIFIED-NEXT: ...
55
56# UNSPECIFIED: Target feature 'foo' used by {{.*}}target-feature-used.yaml.tmp1.o is not allowed.{{$}}
57
58# UNSPECIFIED-NOCHECK:        - Type:            CUSTOM
59# UNSPECIFIED-NOCHECK:          Name:            target_features
60# UNSPECIFIED-NOCHECK-NEXT:     Features:
61# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
62# UNSPECIFIED-NOCHECK-NEXT:         Name:            bar
63# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
64# UNSPECIFIED-NOCHECK-NEXT:         Name:            baz
65# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
66# UNSPECIFIED-NOCHECK-NEXT:         Name:            quux
67# UNSPECIFIED-NOCHECK-NEXT: ...
68
69# USED:        - Type:            CUSTOM
70# USED:          Name:            target_features
71# USED-NEXT:     Features:
72# USED-NEXT:       - Prefix:          USED
73# USED-NEXT:         Name:            foo
74# USED-NEXT: ...
75
76# REQUIRED:        - Type:            CUSTOM
77# REQUIRED:          Name:            target_features
78# REQUIRED-NEXT:     Features:
79# REQUIRED-NEXT:       - Prefix:          USED
80# REQUIRED-NEXT:         Name:            foo
81# REQUIRED-NEXT: ...
82
83# DISALLOWED: Target feature 'foo' used in {{.*}}target-feature-used.yaml.tmp1.o is disallowed by {{.*}}target-feature-used.yaml.tmp.disallowed.o. Use --no-check-features to suppress.{{$}}
84
85# DISALLOWED-NOCHECK:        - Type:            CUSTOM
86# DISALLOWED-NOCHECK:          Name:            target_features
87# DISALLOWED-NOCHECK-NEXT:     Features:
88# DISALLOWED-NOCHECK-NEXT:       - Prefix:          USED
89# DISALLOWED-NOCHECK-NEXT:         Name:            foo
90# DISALLOWED-NOCHECK-NEXT: ...
91
92# NONE:        - Type:            CUSTOM
93# NONE:          Name:            target_features
94# NONE-NEXT:     Features:
95# NONE-NEXT:       - Prefix:          USED
96# NONE-NEXT:         Name:            foo
97# NONE-NEXT: ...
98