This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Removal of unused functions

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 ?

Parents Reply Children
  • 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.