🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm.x86
Article #186

32bit Assembler ( figureing out relocations )

#186
From: Erica A. Ramsey
Date: Sat, 14 Jan 1995 22:51
38 lines
2907 bytes
Hello, I want to write an assembler. I notice that dos .exe files have
relocation tables in them. This allows a module to relocated at load time.
Well, I recently looked inside a 32bit protected mode program and they have
relocation tables too. Well, i want to create a 32bit assembler with C
extentions, and I guess, as I can see now, i'll have to maintain a relocation
table too. The relocation table has address of items to be relocated at
load time.

I really don't see why a relocation table is necessary for 32bit protected
mode or even dos programs!!! the offsets within the modules themselves
don't change, regardless of the address the module was loaded at!!!

The only use of relocation tables for dos .exe files, I think, is that if
one is using far pointers. The same for 32bit protected mode programs,
relocation is only needed if the program uses 48bit far pointers; remember,
in 32bit protected mode a far pointer is 16bit selector plus 32bit offset.
If I say ahead time that one cannot use far pointers then  I should be
fine; ie, I will not need relocation tables. Or I could be wrong, I'm so
confused help!

How do I know which items should be relocatable ? 'call' instructions
shouldn't need to be relocated because 'call' instructions are relative
from pc counter; correct? conditional jumps shouldn't need to be relocated
because they are also relative from pc counter. But, jmp instructs
and variables would have to be relocatable because they are absolute
addresses in some cases and in the other cases they need to relocated
because the datum of data segment has changed. is this correct? gimme
more help! please.

Is a link phase really necessary ? Can't I just create exe modules? I
don't plan to have libraries or anything.

I have gnu assembler source from binutils. does anyone have any
experience porting gas to dos ?


thanks,
erica
Technical Details
Message-ID: <3f9kib$36o@flood.xnet.com>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!dearn!blekul11!idefix.CS.kuleuven.ac.be!ub4b!EU.net!howland.reston.ans.net!pipex!uunet!xnet!lajade

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,14c198d00592d0c8,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: 10f6aa,14c198d00592d0c8,start
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: 110292,14c198d00592d0c8,start
X-Google-Attributes: gid110292,public
X-Google-Thread: 102bfa,14c198d00592d0c8,start
X-Google-Attributes: gid102bfa,public
X-Google-Thread: 114917,14c198d00592d0c8,start
X-Google-Attributes: gid114917,public
X-Google-ArrivalTime: 1995-01-15 00:51:50 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!dearn!blekul11!idefix.CS.kuleuven.ac.be!ub4b!EU.net!howland.reston.ans.net!pipex!uunet!xnet!lajade
From: lajade@xnet.com (Erica A. Ramsey)
Newsgroups: comp.lang.asm.x86,comp.sys.intel,alt.msdos.programmer,comp.os.msdos.programmer,gnu.gcc.help
Subject: 32bit Assembler ( figureing out relocations )
Date: 14 Jan 1995 22:51:55 GMT
Organization: XNet Information Systems
Lines: 38
Message-ID: <3f9kib$36o@flood.xnet.com>
NNTP-Posting-Host: cyclone.xnet.com