xref: /aosp_15_r20/external/llvm/test/MC/COFF/relocation-imgrel.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// COFF Image-relative relocations
2*9880d681SAndroid Build Coastguard Worker//
3*9880d681SAndroid Build Coastguard Worker// Test that we produce image-relative relocations (IMAGE_REL_I386_DIR32NB
4*9880d681SAndroid Build Coastguard Worker// and IMAGE_REL_AMD64_ADDR32NB) when accessing foo@imgrel.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W32 %s
7*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W64 %s
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker.data
10*9880d681SAndroid Build Coastguard Workerfoo:
11*9880d681SAndroid Build Coastguard Worker    .long 1
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker.text
14*9880d681SAndroid Build Coastguard Worker    mov foo@IMGREL(%ebx, %ecx, 4), %eax
15*9880d681SAndroid Build Coastguard Worker    mov foo@imgrel(%ebx, %ecx, 4), %eax
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker// W32:      Relocations [
18*9880d681SAndroid Build Coastguard Worker// W32-NEXT:   Section (1) .text {
19*9880d681SAndroid Build Coastguard Worker// W32-NEXT:     0x3 IMAGE_REL_I386_DIR32NB foo
20*9880d681SAndroid Build Coastguard Worker// W32-NEXT:     0xA IMAGE_REL_I386_DIR32NB foo
21*9880d681SAndroid Build Coastguard Worker// W32-NEXT:   }
22*9880d681SAndroid Build Coastguard Worker// W32-NEXT: ]
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker// W64:      Relocations [
25*9880d681SAndroid Build Coastguard Worker// W64-NEXT:   Section (1) .text {
26*9880d681SAndroid Build Coastguard Worker// W64-NEXT:     0x4 IMAGE_REL_AMD64_ADDR32NB foo
27*9880d681SAndroid Build Coastguard Worker// W64-NEXT:     0xC IMAGE_REL_AMD64_ADDR32NB foo
28*9880d681SAndroid Build Coastguard Worker// W64-NEXT:   }
29*9880d681SAndroid Build Coastguard Worker// W64-NEXT: ]
30