xref: /llvm-project/llvm/test/MC/WebAssembly/bad-fixup-expr.s (revision 9647a6f719ee4b1c23eea7aef368c1dcd5317949)
1// RUN: not llvm-mc -filetype=obj -triple wasm32 %s -o /dev/null 2>&1 | FileCheck %s
2
3  .section    .data.foo,"",@
4foo:
5  .int8       1
6  .size       foo, 1
7foo_other:
8  .int8       1
9  .size       foo_other, 1
10
11  .section    .data.bar,"",@
12bar:
13  .int8       1
14  .size       bar, 1
15
16  .section    .data.fizz,"",@
17fizz:
18  .int8       1
19  .size       fizz, 1
20
21  .section    .data.segment1,"",@
22segment1:
23// CHECK: 'bar' can not be placed in a different section
24  .int32 fizz-bar
25// CHECK: 'undef_baz' can not be undefined in a subtraction expression
26  .int32 fizz-undef_baz
27// CHECK: 'fizz' can not be placed in a different section
28  .int32 undef_baz-fizz
29  .size       segment1, 12
30
31
32  .text
33  .section    .text.main,"",@
34main:
35  .functype   main () -> (i32, i32, i32, i32, i32)
36// Expressions involving symbols within the same sections can be evaluated
37// prior to writing the object file.
38// CHECK-NOT: foo
39  i32.const foo-foo_other+2
40  i32.const foo_other-foo-10
41
42// CHECK: 'bar' unsupported subtraction expression used in relocation in code section.
43  i32.const foo-bar
44// CHECK: 'undef_baz' unsupported subtraction expression used in relocation in code section.
45  i32.const foo-undef_baz
46// CHECK: 'foo' unsupported subtraction expression used in relocation in code section.
47  i32.const undef_baz-foo
48  end_function
49