flat assembler
Message board for the users of flat assembler.

Index > Windows > Section or structure bug?

Author
Thread Post new topic Reply to topic
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
If I compile with this (short snippet of my code):
Code:
 section '.udata' data readable writeable

 aes_keys   aes_keys_
 aes_tables aes_tables_
    

It compiles to ~7k, but if I have this:
Code:
 section '.udata' data readable writeable

 mmx_num_16 dd 16
 aes_keys   aes_keys_
 aes_tables aes_tables_
    

It also compiles to ~7k. If I put it after the structures:
Code:
 section '.udata' data readable writeable

 aes_keys   aes_keys_
 aes_tables aes_tables_
 mmx_num_16 dd 16 
    

It compiles to around 21k. Finally, if I simply place it inside of the aes_keys structure, it compiles normally to ~7k. But if I place it inside of the aes_tables structure, it compiles to 21k. Why is it that if I place a dword declaration AFTER the structures it compiles to more than 6 times as large?, and if I place it BEFORE it compiles normally?
Post 01 Apr 2008, 03:52
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
Not a bug. You have told fasm to put initialised data (mmx_num_16 dd 16) into the output file. So it has to extend the file to the point where you have that one dword of initialised data and then place the value 16 at that position.
Post 01 Apr 2008, 03:54
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17664
Location: In your JS exploiting you and your system
revolution
This compiles to 1 meg
Code:
rb 1 shl 20-1
db 0    
This compiles to 1 byte
Code:
db 0
rb 1 shl 20-1    
Post 01 Apr 2008, 03:56
View user's profile Send private message Visit poster's website Reply with quote
AlexP



Joined: 14 Nov 2007
Posts: 561
Location: Out the window. Yes, that one.
AlexP
Ha! Wow... Well, thanks, just a little odditiy that took me awhile to spot. Turns out I didn't need that dword anyways Smile.
Post 01 Apr 2008, 12:49
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


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.