0

I try migrate to gcc 7.2 from gcc 4.9 (gcc-arm-none-eabi, -O2). My code builds successfully, but result program is bigger than on gcc 4.9.

I make some investigation and realize, that size of "non virtual thunk on xxx" is too big, if overriding function defined in class:

struct IA { virtual void fa() = 0; };
struct IB { virtual void fb() = 0; };
struct C : IA, IB {
  void fa() override {}
  void fb() override // If I place definition here, 
  // size of "non virtual thunk to C::fb()" is almost the same, as the function itself
};
// but if I place definition outside the class, 
// size of non virtual thunk is about 6-8 bytes, same as in gcc4.9

There may be a option that prevents such inlining?

enji
  • 43
  • 1
  • 6
  • 1
    If the output size matters to you, why don't you compiles with the `-Os` option? – YSC Aug 18 '17 at 13:53
  • Does `-fno-default-inline` help? _"Do not make member functions inline by default merely because they are defined inside the class scope."_ – YSC Aug 18 '17 at 13:54

0 Answers0