Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Minimal executable

Reply
Thread Tools

Minimal executable

 
 
Joon
Guest
Posts: n/a
 
      08-15-2003
Hello,

I am programming for Windows, using MinGW (GCC 3.2.3) and I have just read
"Techniques for reducing Executable size"
(http://www.catch22.org.uk/tuts/minexe.asp). I want to write the smallest
program with gcc, and I will use neither command line arguments (argc and
argv) nor memory functions (malloc, ...) (I will take advantage of
HeapAlloc) nor exception handling so that I do need the functions that are
called before main(). As a consequence I just wote

int mainCRTStartup()
{
return 0;
}

which is exactly 2 048 bytes, telling the linker I did not want any standard
or startup library.

I would like to get even smaller executables, by changing the FILEALIGN and
ALIGN of the executable, as explained in catch22's article. They use, for
Visual C++ 6.0 :

//---------------
// Make section alignment really small
#pragma comment(linker, "/FILEALIGN:16")
#pragma comment(linker, "/ALIGN:16")

// Merge sections
#pragma comment(linker, "/MERGE:.rdata=.text")
#pragma comment(linker, "/MERGE:.text=.text")
#pragma comment(linker, "/MERGE:.reloc=.text")
//---------------

How could I "translate" this for the MinGW linker ?

Thanks,
Sam.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create executable from executable with py2exe vedrandekovic@gmail.com Python 0 03-29-2008 12:23 PM
Running an Executable Before Executable JAR Jason Cavett Java 8 05-16-2007 07:14 PM
what is fast dynamically linked executable or statically linked executable ?how to decide? pratap C Programming 20 03-07-2007 04:46 AM
How can I run a c executable in pwd ,while the executable is in some other directory vishsid3@gmail.com C Programming 15 08-21-2006 06:04 AM
ASPNET_WP.EXE Hangs (W2K/IIS5/ASP.NET 1.1) With Minimal Load Ken Barrett ASP .Net 5 11-16-2003 08:03 PM



Advertisments