OSDev.org
https://forum.osdev.org/

YASM error: 'coff: invalid relocation size'
https://forum.osdev.org/viewtopic.php?f=13&t=17058
Page 1 of 1

Author:  HJED [ Sat May 24, 2008 9:55 pm ]
Post subject:  YASM error: 'coff: invalid relocation size'

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:
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:
unsigned char res=0;

and _portid is declared as
Code:
unsigned short portid
(the value varies)

line 443 is in the above asm code
Code:
mov dx, _portid

thanks for any help

Author:  jnc100 [ Sun May 25, 2008 4:23 am ]
Post subject: 

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.

Author:  HJED [ Sun May 25, 2008 3:42 pm ]
Post subject: 

thank you for your help! :D

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/