public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Getting a 32bit symbol into a 16bit .word directive
@ 2003-07-18 14:38 MurF
  2003-07-21  0:29 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: MurF @ 2003-07-18 14:38 UTC (permalink / raw)
  To: binutils

Chaps,

 I've been using GCC with good results. And I'm slowly finding my way around 
the Protected mode of the IA-32 architechture. I've just started looking into 
interurpts, and want to write my own IDT for a i486. Problem is I can't get 
as to put a 32-bit symbol into a .word directive without getting an error.


 I want to do something like this ....

(A bit of code)
.
.
.
int0:
	mov $0x0,%eax
	mov $0x80,%edx
	out  %al,%dl
loop0:
	jmp loop0
.
.
(A bit of code)
.
.
.globl EXT(idtptr)
EXT(idtptr):
	.word	20*8-1
	.long	idt		
idt:
	//  Offset(15..0) , Segment Selector
	//  Reserved (4..0), '0'(7..5) '0D110'(12..8), DPL(14..13), P(15)
	//  offset(31..16)


	.word	(int0), 0x0010			// Int 0 - Divide Error
	.byte   0x00, 0x0e
	.word	0x0000

.
.
.
.
.

 But when i compile this i get the error 'relocation truncated to fit: 
R_386_16 text' and the rest of the compilation fails. This is due to the line 
'.word (int0),0x0010)'

 If I remove the (int0) and replce with a constant everything works.

 Any ideas?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting a 32bit symbol into a 16bit .word directive
  2003-07-18 14:38 Getting a 32bit symbol into a 16bit .word directive MurF
@ 2003-07-21  0:29 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2003-07-21  0:29 UTC (permalink / raw)
  To: MurF; +Cc: binutils

On Fri, Jul 18, 2003 at 03:38:01PM +0100, MurF wrote:
> Problem is I can't get 
> as to put a 32-bit symbol into a .word directive without getting an error.
[snip]
> '.word (int0),0x0010)'

You need to link your executable at an address such that "int0" resolves
to a valid 16 bit address.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-21  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-18 14:38 Getting a 32bit symbol into a 16bit .word directive MurF
2003-07-21  0:29 ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).