YASM error: 'coff: invalid relocation size'

Programming, for all ages and all languages.
Post Reply
HJED
Member
Member
Posts: 61
Joined: Tue Sep 04, 2007 4:18 am
Location: the world wide web
Contact:

YASM error: 'coff: invalid relocation size'

Post 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
.................................. um what should i put here .............................?..........................................
..... :D................
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post 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.
HJED
Member
Member
Posts: 61
Joined: Tue Sep 04, 2007 4:18 am
Location: the world wide web
Contact:

Post by HJED »

thank you for your help! :D
.................................. um what should i put here .............................?..........................................
..... :D................
Post Reply