You are here

Linker includes a lot of dead code from API library | Cypress Semiconductor

Linker includes a lot of dead code from API library

Summary: 2 Replies, Latest post by akohlsmith on 15 Jul 2013 08:28 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
kalev's picture
96 posts


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.
aasi's picture
Cypress Employee
1166 posts

 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.



user_193124556's picture
128 posts

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.

Log in to post new comments.