flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Size of executing file

Author
Thread Post new topic Reply to topic
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
Forgive me, for mine English

When I compile the project the size of executing file is increased each time on kilobyte, how to reduce the size of a executing file?
Post 26 Oct 2005, 14:14
View user's profile Send private message ICQ Number Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Hmm... The more code you have the larger .exe file gets Smile Simple.
But there are some ways to make .exes smaller. Use PE Packer eg. FSG is great and free, but it has two disadvantages: some stupid antivirus programs claim that all programs packed with fsg are viruses; second, if some processors (recent ones) have such protection that code inside a header cannot be executed - and this trick was used in FSG. Other solution is to use (also free) UPX. Google for both and check them
Post 26 Oct 2005, 18:52
View user's profile Send private message Visit poster's website Reply with quote
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
Thanks, but I wanted to tell absolutely another. When I compile the file, in my exe-file there is a lot of empty space between sections. How to make, that it has disappeared? I used only one section but file, at the same there is a lot of empty space.
Post 27 Oct 2005, 06:41
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
what you meant is section alignment. it's value somwhere in PE file header, which gives minimum size of section, and each section mustb multiply of this number. in theory you could change this number, but i think windows refuses to run EXE with any other than it's (i think it's 512 bytes, not sure). There are some hacks how to make section smaller, but they are quite system-dependant (they maybe won't run on newer windozes etc.). It's really best with bigger EXEs to use some packer
Post 27 Oct 2005, 08:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
The size of file only 3 kb and UPX does not want to pack this file.
Post 27 Oct 2005, 08:33
View user's profile Send private message ICQ Number Reply with quote
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
Is opportunity in fasm, that change alignment? The option 'align' does not help. Masm32 give such opportunity.
Post 27 Oct 2005, 08:38
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
no, because windows wouldn't be able to run such executable anyway
Post 27 Oct 2005, 09:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
Why? I thought, that alignment is needed only for quickly execution application in Windows.
Post 27 Oct 2005, 09:46
View user's profile Send private message ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes, but they, as usual, don't support specification (even thei own). If PE executable has other alignment then they want it won't load. THis is how it ends up with commercial projects - if it works (somehow), thn leave it be
Post 27 Oct 2005, 10:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Kermil



Joined: 26 Oct 2005
Posts: 35
Location: Russia
Kermil
Ok, thx.
Post 27 Oct 2005, 11:04
View user's profile Send private message ICQ Number Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
1 - upx compresses only files above 5 kb I think
2 - section alignment set by default is the smallest possible Smile you can change it, but only to higher value; but there's one exception for this - drivers, afaik they can have section alignment set to 2
There's also one trick to mention. You can rip all zeroes in the last section.The file will have then some weirdsize, but it will execute normally. Also you can have all data in one section, and so when you rip these zeroes you don't have any unused space
Post 01 Nov 2005, 09:52
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.