gn build: Merge r374476
[llvm-complete.git] / test / MC / COFF / diff.s
blob2fb48ccc4ee7a05a736a75fc79a8373208d39931
1 // RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | llvm-readobj -S --sr --sd | FileCheck %s
3 // COFF resolves differences between labels in the same section, unless that
4 // label is declared with function type.
6 .section baz, "xr"
7 .globl X
8 X:
9 mov Y-X+42, %eax
10 retl
12 .globl Y
14 retl
16 .def _foobar;
17 .scl 2;
18 .type 32;
19 .endef
20 .text
21 .long 0
22 .globl _foobar
23 .align 16, 0x90
24 _foobar: # @foobar
25 # %bb.0:
26 ret
28 .globl _baz
29 _baz:
30 calll _foobar
31 retl
33 .data
34 .globl _rust_crate # @rust_crate
35 .align 4
36 _rust_crate:
37 .long 0
38 .long _foobar
39 .long _foobar-_rust_crate
40 .long _foobar-_rust_crate
42 // Even though _baz and _foobar are in the same .text section, we keep the
43 // relocation for compatibility with the VC linker's /guard:cf and /incremental
44 // flags, even on mingw.
46 // CHECK: Name: .text
47 // CHECK: Relocations [
48 // CHECK-NEXT: 0x12 IMAGE_REL_I386_REL32 _foobar
49 // CHECK-NEXT: ]
51 // CHECK: Name: .data
52 // CHECK: Relocations [
53 // CHECK-NEXT: 0x4 IMAGE_REL_I386_DIR32 _foobar
54 // CHECK-NEXT: 0x8 IMAGE_REL_I386_REL32 _foobar
55 // CHECK-NEXT: 0xC IMAGE_REL_I386_REL32 _foobar
56 // CHECK-NEXT: ]
57 // CHECK: SectionData (
58 // CHECK-NEXT: 0000: 00000000 00000000 0C000000 10000000
59 // CHECK-NEXT: )
61 // CHECK: Name: baz
62 // CHECK: Relocations [
63 // CHECK-NEXT: ]
64 // CHECK: SectionData (
65 // CHECK-NEXT: 0000: A1300000 00C3C3
66 // CHECK-NEXT: )