#164 OBJ size optimization in outcoff.c

open
nobody
None
5
2010-01-08
2010-01-08
sapero
No

I'm asking for a small optimization gor the coff generator (-f win32). If you define a structure, it will be icluded in the object file, as a set of impossible to reference strings. If you include windows.inc header, the object file will be a huge 300KB file with about 99% of structures, and less than 1% of the important part - code.

The change is very simple: in outcoff.c, in the coff_deflabel subroutine you need to add the following somewhere at the beginning of function:
if (segment == -1) return; // do not write absolute symbols to file

The difference: a nice 8KB file instead 300KB, or so.

Second stage: defined as external, but not referenced symbols ('extern label' without 'call label') are added to the symbol table in object file. Some linkers just ignore such symbols (eg. alink based private builds), but the linker from Microsoft and Pelles does not ignore it. This is not a problem, because I can "kill" such symbols by changing storage class and section number, if it has no references in relocations table, only the size of object file is important to me when I need to create a static library with >100 object files.
Until now I could not find where to put a return to remove unreferenced external symbols, I need more time to study your code. If you know where, let me know, I can apply and compile.
Or, please add an command line option for stripping both case symbols.

Discussion

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks