summaryrefslogtreecommitdiffstats
path: root/lld/test/wasm/target-feature-required.yaml
blob: ce9857a7e89ad7c261e1853b99fd856d084b2946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# RUN: yaml2obj %s -o %t1.o

# RUN: wasm-ld --no-entry --features=foo,bar,baz -o - %t1.o | obj2yaml | FileCheck %s --check-prefix SPECIFIED

# RUN: not wasm-ld --no-entry --features=bar,baz,quux -o /dev/null %t1.o 2>&1 | FileCheck %s --check-prefix UNSPECIFIED

# RUN: wasm-ld --no-entry --no-check-features --features=bar,baz,quux -o - %t1.o | obj2yaml | FileCheck %s --check-prefix UNSPECIFIED-NOCHECK

# RUN: yaml2obj %S/Inputs/require-feature-foo.yaml -o %t.required.o
# RUN: wasm-ld --no-entry -o - %t1.o %t.required.o | obj2yaml | FileCheck %s --check-prefix REQUIRED

# RUN: yaml2obj %S/Inputs/disallow-feature-foo.yaml -o %t.disallowed.o
# RUN: not wasm-ld --no-entry -o /dev/null %t1.o %t.disallowed.o 2>&1 | FileCheck %s --check-prefix DISALLOWED

# RUN: wasm-ld --no-entry --no-check-features -o - %t1.o %t.disallowed.o | obj2yaml | FileCheck %s --check-prefix DISALLOWED-NOCHECK

# RUN: yaml2obj %S/Inputs/no-feature-foo.yaml -o %t.none.o
# RUN: not wasm-ld --no-entry -o /dev/null %t1.o %t.none.o 2>&1 | FileCheck %s --check-prefix NONE

# RUN: wasm-ld --no-entry --no-check-features -o - %t1.o %t.none.o | obj2yaml | FileCheck %s --check-prefix NONE-NOCHECK

# Check that the following combinations of feature linkage policies
# give the expected results:
#
#     REQUIRED x REQUIRED => USED
#     REQUIRED x DISALLOWED => Error
#     REQUIRED x NONE => Error

--- !WASM
FileHeader:
  Version:         0x00000001
Sections:
  - Type:            CUSTOM
    Name:            linking
    Version:         2
  - Type:            CUSTOM
    Name:            target_features
    Features:
      - Prefix:        REQUIRED
        Name:          "foo"
...

# SPECIFIED:        - Type:            CUSTOM
# SPECIFIED-NEXT:     Name:            target_features
# SPECIFIED-NEXT:     Features:
# SPECIFIED-NEXT:       - Prefix:          USED
# SPECIFIED-NEXT:         Name:            bar
# SPECIFIED-NEXT:       - Prefix:          USED
# SPECIFIED-NEXT:         Name:            baz
# SPECIFIED-NEXT:       - Prefix:          USED
# SPECIFIED-NEXT:         Name:            foo
# SPECIFIED-NEXT: ...

# UNSPECIFIED: Target feature 'foo' used by {{.*}}target-feature-required.yaml.tmp1.o is not allowed.{{$}}

# UNSPECIFIED-NOCHECK:        - Type:            CUSTOM
# UNSPECIFIED-NOCHECK-NEXT:     Name:            target_features
# UNSPECIFIED-NOCHECK-NEXT:     Features:
# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
# UNSPECIFIED-NOCHECK-NEXT:         Name:            bar
# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
# UNSPECIFIED-NOCHECK-NEXT:         Name:            baz
# UNSPECIFIED-NOCHECK-NEXT:       - Prefix:          USED
# UNSPECIFIED-NOCHECK-NEXT:         Name:            quux
# UNSPECIFIED-NOCHECK-NEXT: ...

# REQUIRED:        - Type:            CUSTOM
# REQUIRED-NEXT:     Name:            target_features
# REQUIRED-NEXT:     Features:
# REQUIRED-NEXT:       - Prefix:          USED
# REQUIRED-NEXT:         Name:            foo
# REQUIRED-NEXT: ...

# 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.{{$}}

# DISALLOWED-NOCHECK:        - Type:            CUSTOM
# DISALLOWED-NOCHECK-NEXT:     Name:            target_features
# DISALLOWED-NOCHECK-NEXT:     Features:
# DISALLOWED-NOCHECK-NEXT:       - Prefix:          USED
# DISALLOWED-NOCHECK-NEXT:         Name:            foo
# DISALLOWED-NOCHECK-NEXT: ...

# 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.{{$}}

# NONE-NOCHECK:        - Type:            CUSTOM
# NONE-NOCHECK-NEXT:     Name:            target_features
# NONE-NOCHECK-NEXT:     Features:
# NONE-NOCHECK-NEXT:       - Prefix:          USED
# NONE-NOCHECK-NEXT:         Name:            foo
# NONE-NOCHECK-NEXT: ...
OpenPOWER on IntegriCloud