summaryrefslogtreecommitdiff
path: root/test/MC/COFF/relocation-imgrel.s
blob: ccd19ee318b6103adf2abd3b389e1bbaeb73e8b8 (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
// COFF Image-relative relocations
//
// Test that we produce image-relative relocations (IMAGE_REL_I386_DIR32NB
// and IMAGE_REL_AMD64_ADDR32NB) when accessing foo@imgrel.

// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W32 %s
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W64 %s

.data
foo:
    .long 1

.text
    mov foo@IMGREL(%ebx, %ecx, 4), %eax
    mov foo@imgrel(%ebx, %ecx, 4), %eax

// W32:      Relocations [
// W32-NEXT:   Section (1) .text {
// W32-NEXT:     0x3 IMAGE_REL_I386_DIR32NB foo
// W32-NEXT:     0xA IMAGE_REL_I386_DIR32NB foo
// W32-NEXT:   }
// W32-NEXT: ]

// W64:      Relocations [
// W64-NEXT:   Section (1) .text {
// W64-NEXT:     0x4 IMAGE_REL_AMD64_ADDR32NB foo
// W64-NEXT:     0xC IMAGE_REL_AMD64_ADDR32NB foo
// W64-NEXT:   }
// W64-NEXT: ]