Page 1 of 1

YASM error: 'coff: invalid relocation size'

Posted: Sat May 24, 2008 9:55 pm
by HJED
Hello i have this annoying error in my code
start.asm(443) : error: coff: invalid relocation size
this error only occurs when I assemble the code using the win64 format
but this is required as i am using a windows 64bit Linker

the code in question is

Code: Select all

extern _portid
extern _res
global _aoutportb
 _aoutportb:
   mov dx, _portid
   in ax, dx
   mov [_res], al
_res is declared in my c++ code as

Code: Select all

unsigned char res=0;

and _portid is declared as

Code: Select all

unsigned short portid
(the value varies)

line 443 is in the above asm code

Code: Select all

 mov dx, _portid 
thanks for any help

Posted: Sun May 25, 2008 4:23 am
by jnc100
Perhaps the 64-bit version of coff does not support 16 bit relocations? My guess is its trying to output something like 66 ba 00 00 (i.e. mov dx, imm16) and then point the relocation to the 16-bit field (because what you're actually asking for is an address). If you want the actual value of the portid variable, try mov dx, [_portid], which should produce an opcode using modrm and a 32-bit offset (and therefore should assemble fine).

Regards,
John.

Posted: Sun May 25, 2008 3:42 pm
by HJED
thank you for your help! :D