flat assembler
Message board for the users of flat assembler.

Index > Heap > File Formats

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Hey, y'all! I'm wondering if anyone can answer my questions.
1. What does the output-object format consist of and how does it work?
2. What are Windows/Linux executable formats consisting of?

Reason why I ask, and you can probably guess....

I want to make a small compiler for fun.
Post 30 Sep 2006, 03:18
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Not to be a forum man-whore, but *bump* O_o
Post 30 Sep 2006, 17:58
View user's profile Send private message Reply with quote
DataHunter2009



Joined: 10 Jun 2005
Posts: 144
DataHunter2009
At least give it a day or two. Perhaps no one knows the answer to your question, which is why no one is replying. Bumping the topic isn't going to make them magically know the answer. Wink
Post 30 Sep 2006, 18:07
View user's profile Send private message Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
bumping a post within 24hrs is somewhat stupid...
anyway, a bit of googling helps, and most file formats can be found from wotsit.org
Post 30 Sep 2006, 18:09
View user's profile Send private message MSN Messenger Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Post 30 Sep 2006, 18:13
View user's profile Send private message Visit poster's website Reply with quote
RedGhost



Joined: 18 May 2005
Posts: 443
Location: BC, Canada
RedGhost
rhyno_dagreat wrote:
Hey, y'all! I'm wondering if anyone can answer my questions.
1. What does the output-object format consist of and how does it work?
2. What are Windows/Linux executable formats consisting of?

Reason why I ask, and you can probably guess....

I want to make a small compiler for fun.


Windows: PE (Portable Executable)
Linux: ELF

Both are pretty well documented elf being more widely used and better documented but I am more comfortable with PE.

_________________
redghost.ca
Post 30 Sep 2006, 18:25
View user's profile Send private message AIM Address MSN Messenger Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thank's y'all.
Post 30 Sep 2006, 18:59
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Well, I looked at wotsit.org, and it contained info on PE and ELF, and I downloaded the Microsoft OBJ docs, but they don't seem to be of much help. I was wondering how I could create a general OBJ file like the ones used by GCC, FreeBasic, and even FASM.

Thank you again for your time.
Post 01 Oct 2006, 19:26
View user's profile Send private message Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
rhyno_dagreat wrote:
Well, I looked at wotsit.org, and it contained info on PE and ELF, and I downloaded the Microsoft OBJ docs, but they don't seem to be of much help. I was wondering how I could create a general OBJ file like the ones used by GCC, FreeBasic, and even FASM.

Thank you again for your time.


If thing like that is problem for you, coding a compiler might be a bit too much for you, for now atleast... Wink
But, you could always take a look at some opensource compiler like fasm and see how it does it, I think formats.inc has the code you're looking for...


edit: oh and as a forewarning, dont get worried if the code is too confusing for you, you're not alone Embarassed

_________________
When We Ride On Our Enemies
support reverse smileys |:
Post 01 Oct 2006, 19:47
View user's profile Send private message MSN Messenger Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thanks, I'll take it to mind Smile
I know with OBJ files though that there are four sections (from viewing one with a hex editor):
- A section labeled ".text" first
- A section labeled ".data" second
- A section labeled ".bss" third
- A section labeled ".rdata" fourth

For the first section, I assume that means the code section, correct?
The second section, I also assume, means the section where variables during design time are stored, am I right?
For the third section I don't know what BSS stands for, but if anyone could fill me in, I'd be greatly appreciative.
For the fourth section, I don't know what that means, but I assume it means reserved data for future use (like rb in FASM).

If I'm off the mark with any of this, please let me know! Thanks!

EDIT: Also, I found another area like that after the first .rdata called ".file" which is followed by a DWORD and a WORD and a half of zeros, then another WORD (not sure what that signifies yet) with some code in it, then another DWORD with gibberish, and then the file name, which I assume is just the name of the file.


Last edited by rhyno_dagreat on 02 Oct 2006, 23:59; edited 1 time in total
Post 02 Oct 2006, 23:54
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
rdata = relocations
Post 02 Oct 2006, 23:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
vid wrote:
rdata = relocations

Could you please be a bit more detailed?
Post 03 Oct 2006, 00:12
View user's profile Send private message Reply with quote
OzzY



Joined: 19 Sep 2003
Posts: 1029
Location: Everywhere
OzzY
If you don't want to study formats, you can try the easiest way:
Write a compiler that converts the source into ASM source and use FASM as back-end to assemble it and build the executable.
i would use FASM macros to create the language and the use FASM to assemble that. (easier than writting a parser).
Post 03 Oct 2006, 00:35
View user's profile Send private message Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
I do want to study formats, that's the reason why I posted this, but thanks for the idea. =P
Post 03 Oct 2006, 03:00
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
Post 03 Oct 2006, 07:49
View user's profile Send private message Visit poster's website Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Thanks for the links Tomasz. I'm wondering, though, can you output simply object files with FASM or is it always gonna directly create an executable? Just curious because if you can create object files, where did you get your resources?

EDIT: *smacks self* ... ELF files are .O files... Embarassed
Mybad. I just wish I realized it sooner.
Post 04 Oct 2006, 03:04
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Post 04 Oct 2006, 06:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rhyno_dagreat



Joined: 31 Jul 2006
Posts: 487
Location: Maryland, Unol Daleithiau
rhyno_dagreat
Well, vid, I didn't know that existed. Thank you.
Post 04 Oct 2006, 23:36
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
you're welcome
Post 05 Oct 2006, 06:53
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2466
Location: Bucharest, Romania
Borsuc
rhyno_dagreatI had some articles with .obj, but I can't find them (let's hope I didn't erased them when I formatted).. however, take a look at "linkers" that link .obj files and create executable. Just as a warning: if you can't understand "relocations" (i.e relative addresses), you'll have a hard time figuring the .obj format out. (i've also never coded an .obj reader/writer, so i may not be the perfect expert).


[offtopic]elf and dwarf formats.. where's the orc format? Laughing

i like fantasy btw
Post 05 Oct 2006, 09:45
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.