OSDev.org

The Place to Start for Operating System Developers
It is currently Wed May 08, 2024 9:46 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: YASM error: 'coff: invalid relocation size'
PostPosted: Sat May 24, 2008 9:55 pm 
Offline
Member
Member

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

_________________
.................................. um what should i put here .............................?..........................................
..... :D................


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 4:23 am 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
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.

_________________
Tysos | rpi-boot


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 25, 2008 3:42 pm 
Offline
Member
Member

Joined: Tue Sep 04, 2007 4:18 am
Posts: 61
Location: the world wide web
thank you for your help! :D

_________________
.................................. um what should i put here .............................?..........................................
..... :D................


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group