flat assembler
Message board for the users of flat assembler.

Index > Main > section alignment / func alignment (x86-64 windows)

Author
Thread Post new topic Reply to topic
gravvityy



Joined: 17 Oct 2019
Posts: 2
gravvityy 17 Oct 2019, 23:41
is there a way to set section alignment and make sure every function / proc aligns on an address that is a multiple of 16 or must i type "align 16" between each function? is there an easy way to do this (with a macro perhaps?)

Code:
section '.text' code readable writeable executable
    


edit: and i just realized i posted this in the wrong section, move if possible please Smile
Post 17 Oct 2019, 23:41
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 321
donn 18 Oct 2019, 13:18
I use:

Code:
section '.text' code readable writeable executable align 16    


Code:
section '.data' data readable writeable align 16    


And keep the stack aligned separately.

Code:
        and rsp, -32    


Also, I ensure the stack pointer increments and decrements are paired:

Code:
sub rsp, 8*8
...
add rsp, 8*8    


mostly just from trial and error, furs mentioned the and rsp, -32 technique, I believe.
Post 18 Oct 2019, 13:18
View user's profile Send private message Reply with quote
gravvityy



Joined: 17 Oct 2019
Posts: 2
gravvityy 19 Oct 2019, 01:41
Code:
Y:\andrew\Desktop>fasm test.asm test.exe
flat assembler  version 1.73.16  (1048576 kilobytes memory)
test.asm [17]:
section '.data' data readable writeable align 16
processed: section '.data' data readable writeable align 16
error: extra characters on line.
    


am i missing something? doesn't seem to like adding 'align 16' on segments (PE64)
Post 19 Oct 2019, 01:41
View user's profile Send private message 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.