flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > How to make x32 objects and executable?

Author
Thread Post new topic Reply to topic
Jin X



Joined: 06 Mar 2004
Posts: 12
How to make x32 objects and executable?
"format ELF executable 3" makes x86 executable
"format ELF64 executable 3" makes x64 executable
But how can I make x32 (x64 with 32-bit pointers) execetables?
https://en.wikipedia.org/wiki/X32_ABI

p.s. What does mean "3" after "executable" is these lines?
Post 12 Apr 2017, 08:26
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6356
Location: Kraków, Poland
It should be an ELF file with class ELFCLASS32 and machine EM_X86_64. fasm's "format ELF" is always ELFCLASS32/EM_386 and "format ELF64" is always ELFCLASS64/EM_X86_64. But you can experiment with the ELF formatting macros in fasmg, since they allow to set up these properties freely:

Code:
ELF.Settings.Class = ELFCLASS32
ELF.Settings.Machine = EM_X86_64
ELF.Settings.ABI = ELFOSABI_LINUX
include 'format/elfexe.inc'
include 'x64.inc'
use64

Note that the value of "ELFOSABI_LINUX" constant is 3 and this is the value in "format ELF executable 3" clause.
Post 12 Apr 2017, 09:58
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 12
Thanks!
But why don't you make "format ELFx32" support in original fasm?
Post 13 Apr 2017, 08:30
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6356
Location: Kraków, Poland
With fasmg's macros it is easier to test such things. If we test and make sure that changing these values is enough, I may try to implement it into fasm.
Post 13 Apr 2017, 11:17
View user's profile Send private message Visit poster's website Reply with quote
Jin X



Joined: 06 Mar 2004
Posts: 12
You may compare headers of x64 and x32 programs made by 'as'+'ld' or 'nasm' to be sure or to find other differences... Smile
Post 13 Apr 2017, 12:38
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6356
Location: Kraków, Poland

Jin X wrote:
You may compare headers of x64 and x32 programs made by 'as'+'ld' or 'nasm' to be sure or to find other differences... Smile

I may but I cannot say how soon that may happen. Wink
Post 13 Apr 2017, 15:53
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.