• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | llvm-readobj -s -sr -sd | FileCheck %s
2
3// COFF resolves differences between labels in the same section, unless that
4// label is declared with function type.
5
6.section baz, "xr"
7	.globl	X
8X:
9	mov	Y-X+42,	%eax
10	retl
11
12	.globl	Y
13Y:
14	retl
15
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
27
28	.globl	_baz
29_baz:
30	calll	_foobar
31	retl
32
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
41
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.
45
46// CHECK:        Name: .text
47// CHECK:        Relocations [
48// CHECK-NEXT:     0x12 IMAGE_REL_I386_REL32 _foobar
49// CHECK-NEXT:   ]
50
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:   )
60
61// CHECK:        Name: baz
62// CHECK:        Relocations [
63// CHECK-NEXT:   ]
64// CHECK:        SectionData (
65// CHECK-NEXT:     0000: A1300000 00C3C3
66// CHECK-NEXT:   )
67