Linker includes a lot of dead code from API library

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

   
    Could you consider splitting API library sources into smaller units, preferably every function into separate file/module. This will give a chance for linker to include only the code that is mandatory for application.   
   
        
   
    Regards,   
   
    K   
0 Likes
2 Replies
Anonymous
Not applicable

 I doubt that linker adds code as files, it adds them as functions. Anyways please create a tech support case so that this can be discussed properly and in detail.

   

Regards,

   

Anand

0 Likes
Anonymous
Not applicable
        GCC can be instructed to remove unused functions and data elements from the final executable. You should make sure to include --gc-sections in your linker flags, and -ffunction-sections and -fdata-sections in the compiler flags. All three of these are checkboxes in the Eclipse C/C++ Build properties for the project. (-ffunction-sections and -fdata-sections under Settings/Tool Settings/ARM Sourcery Windows GCC C compiler/Optimization, and --gc-sections under ARM Sourcery Windows GCC Linker/General). I do not know of a way to strip anything further out of the closed-source .a file supplied by Cypress.   
0 Likes