Size of executable files gets too large with SDK v53.20
Posted: Wed Dec 21, 2011 10:08 pm
Hello,
When compiling small & simple programs, the size of the compiled executable files gets much larger than they ought to be.
F.ex., a simple "Hello World"-program that only prints that text in the shell occupies as much as 66884 Bytes (even after using the strip-command).
Such a program shouldn't occupy more than a few KBytes.
Compiler used : gcc
Command to reduce filesize: strip
SDK version : v53.20 (1.3.2010)
Hardware : Sam440ep
OS version : Amiga OS 4.1 update 3
Whether this has something to do with the SDK, gcc or strip, I don't know.
What I do know, is that with an older version of the SDK (the previous one, I think), the size of the executable of the same program was around 6-7000 Bytes.
I would be really happy if there exist a workaround (or a bugfix) for this issue.
Thanks in advance for your help.
Below is a test-program for the issue.
/*
Here is what I do to to verify the statement above:
-----------------------------------------------------------------
Step 1)
Compile the program below from the shell, and check the file size.
In addition, have a look in a HEX viewer to see what the executable file contains.
The interesting thing you will see, is that it contains a huge amount of zeros in the beginning of the executable.
gcc -o HelloWorld HelloWorld.c
Result: 67373 Bytes.
Step 2)
Reduce the size of the executable by typing in the below from the shell.
After you have done this, have a look in a HEX viewer to see what the executable file contains.
The interesting thing you will see, is that the zeros found in the original executable, is now replaced by
lots of "unused text".
strip -s HelloWorld
Result: 66884 Bytes.
*/
#include <proto/dos.h>
int main(int32 argc, char* argv[])
{
IDOS->Printf("Hello world!\n");
}
When compiling small & simple programs, the size of the compiled executable files gets much larger than they ought to be.
F.ex., a simple "Hello World"-program that only prints that text in the shell occupies as much as 66884 Bytes (even after using the strip-command).
Such a program shouldn't occupy more than a few KBytes.
Compiler used : gcc
Command to reduce filesize: strip
SDK version : v53.20 (1.3.2010)
Hardware : Sam440ep
OS version : Amiga OS 4.1 update 3
Whether this has something to do with the SDK, gcc or strip, I don't know.
What I do know, is that with an older version of the SDK (the previous one, I think), the size of the executable of the same program was around 6-7000 Bytes.
I would be really happy if there exist a workaround (or a bugfix) for this issue.
Thanks in advance for your help.
Below is a test-program for the issue.
/*
Here is what I do to to verify the statement above:
-----------------------------------------------------------------
Step 1)
Compile the program below from the shell, and check the file size.
In addition, have a look in a HEX viewer to see what the executable file contains.
The interesting thing you will see, is that it contains a huge amount of zeros in the beginning of the executable.
gcc -o HelloWorld HelloWorld.c
Result: 67373 Bytes.
Step 2)
Reduce the size of the executable by typing in the below from the shell.
After you have done this, have a look in a HEX viewer to see what the executable file contains.
The interesting thing you will see, is that the zeros found in the original executable, is now replaced by
lots of "unused text".
strip -s HelloWorld
Result: 66884 Bytes.
*/
#include <proto/dos.h>
int main(int32 argc, char* argv[])
{
IDOS->Printf("Hello world!\n");
}