On Fri, 08 Nov 2019 21:14:19 +0900
Oleg Endo <oleg.e...@t-online.de> wrote:

> On Thu, 2019-11-07 at 21:31 +0000, Jozef Lawrynowicz wrote:
> > When building small programs for MSP430, the impact of the unused
> > functions pulled in from the CRT libraries is quite noticeable. Most of 
> > these
> > relates to feature that will never be used for MSP430 (Transactional memory,
> > supporting shared objects and dynamic linking), or rarely used (exception
> > handling).  
> 
> There's a magic switch, which does the business, at least for me, most
> of the time:
> 
>        -flto
> 
> If you're trying to bring down the executable size as much as possible,
> but don't use -flto, I think something is wrong.
> 
> Cheers,
> Oleg
> 

Yes, I should have used -flto in my examples. But it doesn't help remove these
CRT library functions which are normally either directly added to the
list of functions to run before main (via .init, .ctors or .init_array) or used
in functions which are themselves added to this list.

The unnecessary functions we want to remove are:
  deregister_tm_clones
  register_tm_clones
  __do_global_dtors_aux
  frame_dummy
LTO can't remove any of them.

Thanks,
Jozef

Reply via email to