2 Replies Latest reply on Jul 15, 2013 8:28 AM by user_193124556

    Linker includes a lot of dead code from API library

    user_57556229

      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   
        • 1. Re: Linker includes a lot of dead code from API library
          ananda_26

           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

          • 2. Re: Linker includes a lot of dead code from API library
            user_193124556
                    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.