flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > fasmg GCC x86 backend

Author
Thread Post new topic Reply to topic
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 22 Apr 2017, 18:58
Specifically, this is for 32 bit, .intel_syntax noprefix, GCC "C" asm output obtained with -masm=intel -S options.
The -S option produces the asm file (usually passed on to as).
Assemble with:
Code:
fasmg -i "include('80386.inc')" -i "include('gas.inc')" -i "include('align.inc')" -i "use32" -i "org 0x7C00"  x.asm x.bin    
Todo: section and ???
Added align to gas.inc and included align.inc and org on command line for linking flat binary.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com


Last edited by Mike Gonta on 27 May 2017, 22:49; edited 5 times in total
Post 22 Apr 2017, 18:58
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 22 Apr 2017, 19:36
Very interesting idea!

Does GCC produce register-based addresses with a strictly predictable structure? If it is always like displacement[base+index*scale] (plus simpler variants) then you could in theory replace the algebraic address parser that standard fasmg's macros use with a dedicated one. And parsing the AT&T syntax, as horrible as it is for anyone used to Intel one, could be probably even simpler.
Post 22 Apr 2017, 19:36
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 22 Apr 2017, 20:14
Tomasz Grysztar wrote:
Very interesting idea!
I was thinking more along the lines of having only one "C" compiler and letting fasmg generate multiple formats
instead of a native compiler and many cross compilers.

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com
Post 22 Apr 2017, 20:14
View user's profile Send private message Visit poster's website Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 22 Apr 2017, 22:18
Tomasz Grysztar wrote:
parsing the AT&T syntax, as horrible as it is for anyone used to Intel one,

I think there are not much people who like the AT&T syntax at all. Razz
Post 22 Apr 2017, 22:18
View user's profile Send private message Send e-mail 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.