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