I have a lib file containing a number of general functions.
As far as I can tell, all the functions in the library are always linked into my final executable, even if the function is not called.
i.e. lib file contains func0, func1, func2 and func3, each is 1k (CSEG) giving total 4k.
My main calls only func0, however my executable is > 4k since all functions are linked.
- Is my understanding correct ?
- Is there a compile or linker option to optimize out the uncalled functions.
Thanks in advance,
Are all those functions in separate objects? In other words did they come from separate source files? The linker does not filter out functions from objects. It can only take or leave whole objects.
This was exactly the issue - I had all functions defined in a single source file.
Thanks for the help !
Log in to post a comment.