Source code additional info
Full startup sources for c/c++ and with build instructions for different targets ST/F030/CT60 (m68000-060) can now be found on atari gcc startup repository.C startup
To remove standard library, we have to pass "-nostdlib" flag to the linker. If we try to compile the minimal program (empty main() function) with this flag, we will get some linker errors indicating several missing symbols (which are mostly gcc built-in functions).In this case we have to provide them and add our own startup code which should be linked first. If not, program will be executing from another part of code, which will result in crash, be warned. It's best to check everything by examining generated symbol tables generated by "-Wl,-Map,symbols.map" linker option and order of linked files.
Startup itself is really simple, we reserve program basepage / stack space, return rest of the memory to operating system and after that we jump to our main program function. Optionally there is possibility to redirect console output to RS232, it might be useful for debugging purposes. Most used gcc built-in functions are now provided.
C++ startup
This one is more tricky, because we have to fake some more symbols, add global static constructors / destructor list handling and fool compiler to generate those lists (by including dummy struct with static methods in our source code). After that we can use C++ language, but remember if something will be missing, you have to provide it.Besides we need to add memory allocators which aren't present in C language. We have to provide: new, new[], delete and delete[] operators. Additionally there is also missing piece for list support (if you want to use lists). Program is compiled without RTTI and with C++ exceptions disabled ("-fno-rtti -fno-exceptions"). And that's all.
Summary
As you see removing standard library isn't that hard. Take a look at source code in repository, which is more illustrative.What else we can do?
Executable file size can be reduced even further by using excellent _blank (Ultimate packer for executables) or PackFire by Neural.And don't forget to strip symbols, you can do it by passing ("-Os" flag to the linker or by executing 'm68k-atari-mint-strip -S' on TOS executable) and turn on compiler optimisations.