flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Backend internals

Author
Thread Post new topic Reply to topic
Shirk



Joined: 12 Sep 2011
Posts: 10
Shirk
Hi,
I'm seriously tempted to put time into FASM mach-o support.
However as good as my assembly knowledge is - the format generator is not well suited for expansion (IMHO).
The whole code has no comments and only vague labels which hint at what's done where.

Is there any documentation or anyone with deeper insights on what the different relocation structs etc. contain and how they're layout is composed?

I really like FASM and I wan't to contribute something useful but right now I don't even have a good way to get my starting point right. (Apart from reading all other parts of the assembler / parser etc.)

Cheers,
Post 27 Sep 2012, 13:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7750
Location: Kraków, Poland
Tomasz Grysztar
It is very easy to add another output format when you know all the structures, though it would take a long time to deduce it all from reading the source only. I once started writing a guide to fasm's internals, so that it would be easier for others to get versed in fasm's structures, but I never really managed to get it past the basic information needed to port fasm into other OSes. I keep changing the internal structures faster than I am able to document them.

But I think there are some other ways in which you could help. You can try to create a correct Mach-O file using the fasm's binary output (create everything, even relocations, with the DB/DD directives, etc.) One of the most time-consuming tasks in implementing any new output format was to do such initial research and find out what headers need to be generated, etc. If I had some working templates it would be much easier for me to proceed.
Post 27 Sep 2012, 13:42
View user's profile Send private message Visit poster's website Reply with quote
Shirk



Joined: 12 Sep 2011
Posts: 10
Shirk
Well, thank you - this is a really nice idea Smile

I'd never thought about creating a mach-o using the flat binary format!
If a template and maybe some macros to create mach-o objects will help I see what can be done.
However I'm going to focus on mach-o object files for now since they have a much simpler structure than mach-o executables.
(And the later can be produced by a simple ld call anyway..)

Thank's for the reply!
Post 27 Sep 2012, 15:34
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7750
Location: Kraków, Poland
Tomasz Grysztar
BTW, the only reason why it isn't really viable to support additional output format with just macros are relocations. I remember I once (even before object output was implemented into fasm) considered adding some universal support for relocations in plain binary output mode - so that you could mark part of code as relocatable and then process gathered relocations in a loop and generate the right codes. But I did not have any good idea for such a generic design and it could easily become a mess.
Post 27 Sep 2012, 16:02
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.