armcc library used in ARM_GNU GCC application, Removing unused functions code from the final binary

Asked by Siva Pothireddy

I have created an application with ARM GNU GCC compiler which uses the armcc library(created with armar).
i tried -fdata-sections -ffunction-sections options while compiling and --gc-sections while linking and was successfully able to remove unused functions in the application code from the final binary, but not the ones from the library.

I am doing this exercise to reduce my application size, so wanted to know if there is a way to give some options in the armcc side , then use that library with GCC to remove the unused functions code of the library in the final binary.

Please let me know


Question information

English Edit question
GNU Arm Embedded Toolchain Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :

Hi Siva,

Are the function in the library in separate sections? As its name implies it, --gc-sections works at the section level and will remove a section only if none of its content is used by another section. I am guessing in each section you have a mix of function used and not used by your application.

Best regards,


Revision history for this message
Siva Pothireddy (sivasanath) said :

HI Thomas,
Thanks for your reply...
You might be right, i might have a mix of functions, But how to put in to sections in library with armcc, is there a way?, assume if we put them in to sections will GCC can understand the sections created by armcc and remove it?

Please let me know


Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :

Hi Siva,

Section is an ELF concept so GCC should understand sections created by ARMCC just fine. I'm not familiar with ARMCC but there should be an option similar to -ffunction-sections which does just that.

Best regards.

Can you help with this problem?

Provide an answer of your own, or ask Siva Pothireddy for more information if necessary.

To post a message you must log in.