flat assembler
Message board for the users of flat assembler.

Index > Windows > Section Alignment

Author
Thread Post new topic Reply to topic
Kain



Joined: 26 Oct 2003
Posts: 108
Kain 30 Oct 2004, 03:04
Can someone explain section alignment for me? I read two conflicting documents on the subject.

One source says it must be multiples of two, but the FASM docs point out it must be power of two.

I'm no mathematician, but I'm pretty sure these are totally different.

2, 4, 6, 8, ...

vs

1, 4, 9, 16, ...

Or something else?
Post 30 Oct 2004, 03:04
View user's profile Send private message Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv 30 Oct 2004, 07:35
Actually it is

2,4,6,8,10, ...
vs
2,4,8,16,32,64,...
Post 30 Oct 2004, 07:35
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 30 Oct 2004, 11:13
I am not completely sure, but I think that it is about power of 2. But there is another problem. On win95/98 these values are constant and are equal to 512 for FileAlignment and 4096 for SectionAlignment. Files compiled with other values, won't work on other than NT platforms. So if you want to remain compatible with older versions of windows, you should stay with these values. But we have a small advantage. Because as you know, if we have even only one byte in section, it will pad it with zeroes to these 512 needed by the FileAlignment. But, we can truncate these zeroes if they are in the last section. Such file will work fine on all windowses Smile
Post 30 Oct 2004, 11:13
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 01 Nov 2004, 21:50
yes, they must be power of two (which are also multiples of two Smile )
Post 01 Nov 2004, 21:50
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kain



Joined: 26 Oct 2003
Posts: 108
Kain 04 Nov 2004, 04:25
Thanks for the replies.

My understanding now is that it must be:

2^n

Where n = { 1 .. 13 }
Post 04 Nov 2004, 04:25
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.