We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm using armclang compiler Product: Professional Component: ARM Compiler 6.16
There are unused functions which are linked in the final application. There functions are coming from a library which is linked to final application, but not called in application.
How to remove these unused functions from final image ?
Hi Benny
Use --keep <object containing this function> on the linker command line.
https://developer.arm.com/documentation/102284/6-16-2LTS/armlink-Reference/Image-Structure-and-Generation/The-structure-of-an-Arm-ELF-image/Image-entry-points
Ronan
Hi Ronan,
This seems to be tedious, for example if a file foo.o contains functions which are called and some are unused. Specifying each, of these to keep is cumbersome. Is there a better way to remove the unused functions while keeping the ones which are required like compiler calling functions like __stack_chck_fail().
Also after using --keep=foo_*.o it is showing so many 8 bytes removed, though they are being called from caller functions. .ARM.exidx.text.foo_test ), (8 bytes). What is this .exidx sections ?
Is it removing the functions or some data, it seems only 8 bytes.
Removing foo_test.o(.ARM.exidx.text.foo_test_init), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_getHandle), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_setType0), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_SetupType0In), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_cfgPort), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_StatusCmd), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_cfgTimerCtrl), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_SetLm), (8 bytes).Removing foo_test.o(.ARM.exidx.text.foo_test_cfgP0Ctrl), (8 bytes).
I am not aware of another solution.