flat assembler
Message board for the users of flat assembler.

Index > Linux > fasm & align

Author
Thread Post new topic Reply to topic
walker



Joined: 27 Apr 2007
Posts: 1
walker 27 Apr 2007, 22:21
Prompt please why it is not compiled.
fasm refuses align 8 if I use an option "format ELF"

Here an example:

format ELF
use32
align 8
xor eax,eax
Post 27 Apr 2007, 22:21
View user's profile Send private message Reply with quote
realcr



Joined: 02 Apr 2007
Posts: 39
realcr 22 May 2007, 21:02
Hey walker.

Maybe I don't understand your question , but why in fact do you want to align to bytes? I don't think there is anything in your program not aligned by bytes already.
the smallest piece of data the processor can handle is byte.

maybe you mean align by 8 bytes?

realcr.
Post 22 May 2007, 21:02
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 22 May 2007, 22:11
The default ELF section is aligned to 4 bytes only, and you cannot align data inside the section more than the section is aligned itself.

Thus, to make it work, you need first to align the section properly (and this is also what the error message says). For example:
Code:
format ELF

section '.code' executable align 8

align 8
xor eax,eax    
Post 22 May 2007, 22:11
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 May 2007, 22:30
should go to FAQ
Post 22 May 2007, 22:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.