73 lines · plain
1// RUN: rm -rf %t && mkdir -p %t2// RUN: llvm-mc -triple i686-windows -filetype obj -o %t/COFF_i386.o %s3// RUN: llvm-rtdyld -triple i686-windows -dummy-extern _printf=0x7ffffffd \4// RUN: -dummy-extern _ExitProcess=0x7fffffff \5// RUN: -verify -check=%s %t/COFF_i386.o6 7 .text8 9 .def _main10 .scl 211 .type 3212 .endef13 .global _main14_main:15rel1:16 call _function // IMAGE_REL_I386_REL3217# rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)18 xorl %eax, %eax19rel12:20 jmp _printf21# rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)22 23 .def _function24 .scl 225 .type 3226 .endef27_function:28rel2:29 pushl string30# rtdyld-check: decode_operand(rel3, 3) = \31# rtdyld-check: stub_addr(COFF_i386.o/.text, __imp__ExitProcess)32# rtdyld-check: *{4}(stub_addr(COFF_i386.o/.text, __imp__ExitProcess)) = \33# rtdyld-check: _ExitProcess34rel3:35 calll *__imp__ExitProcess // IMAGE_REL_I386_DIR3236 37 .data38 39 .global relocations40relocations:41rel5:42 .long _function@imgrel // IMAGE_REL_I386_DIR32NB43# rtdyld-check: *{4}rel5 = _function - section_addr(COFF_i386.o, .text)44rel6:45# rtdyld-check: *{2}rel6 = 146 .secidx rel5 // IMAGE_REL_I386_SECTION47rel7:48# rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.o, .data)49 .secrel32 string // IMAGE_REL_I386_SECREL50 51# Test that addends work.52rel8:53# rtdyld-check: *{4}rel8 = string54 .long string // IMAGE_REL_I386_DIR3255rel9:56# rtdyld-check: *{4}rel9 = string+157 .long string+1 // IMAGE_REL_I386_DIR3258rel10:59# rtdyld-check: *{4}rel10 = string - section_addr(COFF_i386.o, .text) + 160 .long string@imgrel+1 // IMAGE_REL_I386_DIR32NB61rel11:62# rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.o, .data) + 163 .long string@SECREL32+1 // IMAGE_REL_I386_SECREL64 65# We explicitly add padding to put string outside of the 16bit address space66# (absolute and as an offset from .data), so that relocations involving67# 32bit addresses / offsets are not accidentally truncated to 16 bits.68 .space 6553669 .global string70 .align 171string:72 .asciz "Hello World!\n"73