On Wed, Apr 8, 2015 at 1:11 AM, Zan Lynx <zl...@acm.org> wrote: > On 04/07/2015 09:00 AM, Stefan Ehrlich wrote: >> compiler and linker options are: >> avr-g++.exe -c -Os -Wall -fdata-sections -ffunction-sections >> -fvisibility=hidden -fvisibility-inlines-hidden -fno-rtti -flto >> -fuse-linker-plugin -mmcu=atmega8 ... >> avr-gcc.exe -Wall -Os -Wl,-static -Wl,-flto -fuse-linker-plugin >> -Wl,--strip-all -Wl,-s -Wl,--gc-sections -mmcu=atmega8 ... >> >> The more not used objects I use the worse the problem gets. >> >> Is there any possibility to remove unused virtual functions or at least the >> objects, which are not used? I have not find any solution so far. >> If not, is there a plan to add this feature to the linker? > > Try adding -fwhole-program to the options. I haven't tried it.
With using a linker plugin this shouldn't be required. Richard. > I believe that GCC assumes that the executable can be dynamically opened > and its functions used as if it were a shared library. Because of that > GCC has to keep things available. Although I would have thought > visibility=hidden would have taken care of that. > > But -fwhole-program promises that this is the whole program and there > isn't anything else linking with it. I've noticed that when specified, > the output is heavily inlined and missing most function definitions so > it might be what you want.