cosmic 编译器未调用函数优化

Q. Can the compiler automatically remove unused functions from my application?

A. Yes, the default behavior includes all code linked however, you can add the +split compiler command line option to split the object into multiple sections. i.e. One section per function such that individual functions may be removed by the linker if they are not called. You then mark one or more segments in the link command file with the -k (keep) option to specifiy which segments need to be kept. Typically, you just need to add the -k segment option to the segment containing the vecotr table. This usually coversl all of the applications call trees.

stvd-cosmic