g++keeps unused objects with virtual functions

2015-04-07 Thread Stefan Ehrlich
Hello GCC developer team, I hope I am right here to address my problem with memory usage and g++: I am writing C++ software for several very small embedded systems (8k and smaller) and a feature with the virtual tables and the linker does not make my life easy :-) I have a lot of objects with v

Re: g++keeps unused objects with virtual functions

2015-04-07 Thread Richard Biener
On April 7, 2015 5:00:27 PM GMT+02:00, Stefan Ehrlich wrote: >Hello GCC developer team, >I hope I am right here to address my problem with memory usage and g++: > >I am writing C++ software for several very small embedded systems (8k >and smaller) and a feature with the virtual tables and the li

Re: g++keeps unused objects with virtual functions

2015-04-07 Thread Zan Lynx
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

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Richard Biener
On Wed, Apr 8, 2015 at 1:11 AM, Zan Lynx 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=atm

AW: g++keeps unused objects with virtual functions

2015-04-08 Thread Stefan Ehrlich
t without any effect. Is here something missing or too much? Lg Stefan -Ursprüngliche Nachricht- Von: Richard Biener [mailto:richard.guent...@gmail.com] Gesendet: Dienstag, 07. April 2015 18:42 An: Stefan Ehrlich; gcc@gcc.gnu.org Betreff: Re: g++keeps unused objects with virtual functi

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Richard Biener
) > (.data + .bss + .noinit) > > > I added the -fwhole-program flag (as mentioned by Zan Lynx) but without any > effect. > Is here something missing or too much? > > Lg > > Stefan > > > -Ursprüngliche Nachricht- > Von: Richard Biener [mailto:richard.guent

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Jan Hubicka
> which shows how the global objects initialization keeps things live. > Early optimization turns it into > > (static initializers for t.C) () > { > : > NotUsedObject._vptr.CObject = &MEM[(void *)&_ZTV7CObject + 16B]; > return; > > } > > but we don't have any pass removing stores to global

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Jan Hubicka
> > which shows how the global objects initialization keeps things live. > > Early optimization turns it into > > > > (static initializers for t.C) () > > { > > : > > NotUsedObject._vptr.CObject = &MEM[(void *)&_ZTV7CObject + 16B]; > > return; > > > > } > > > > but we don't have any pass r

AW: g++keeps unused objects with virtual functions

2015-04-08 Thread Stefan Ehrlich
n I do? Stefan -Ursprüngliche Nachricht- Von: Jan Hubicka [mailto:hubi...@ucw.cz] Gesendet: Mittwoch, 08. April 2015 11:00 An: Jan Hubicka Cc: Richard Biener; Stefan Ehrlich; GCC Development; zl...@acm.org Betreff: Re: g++keeps unused objects with virtual functions > > which shows h

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Richard Biener
> Von: Jan Hubicka [mailto:hubi...@ucw.cz] > Gesendet: Mittwoch, 08. April 2015 11:00 > An: Jan Hubicka > Cc: Richard Biener; Stefan Ehrlich; GCC Development; zl...@acm.org > Betreff: Re: g++keeps unused objects with virtual functions > >> > which show

AW: g++keeps unused objects with virtual functions

2015-04-08 Thread Stefan Ehrlich
Von: Richard Biener [mailto:richard.guent...@gmail.com] Gesendet: Mittwoch, 08. April 2015 12:14 An: Stefan Ehrlich Cc: Jan Hubicka; GCC Development; zl...@acm.org Betreff: Re: g++keeps unused objects with virtual functions On Wed, Apr 8, 2015 at 11:59 AM, Stefan Ehrlich wrote: > But without the v

Re: g++keeps unused objects with virtual functions

2015-04-08 Thread Richard Biener
il 2015 12:14 > An: Stefan Ehrlich > Cc: Jan Hubicka; GCC Development; zl...@acm.org > Betreff: Re: g++keeps unused objects with virtual functions > > On Wed, Apr 8, 2015 at 11:59 AM, Stefan Ehrlich > wrote: >> But without the virtual keyword the global object never read

AW: g++keeps unused objects with virtual functions

2015-04-08 Thread Stefan Ehrlich
: Jan Hubicka; GCC Development; zl...@acm.org Betreff: Re: g++keeps unused objects with virtual functions On Wed, Apr 8, 2015 at 1:23 PM, Stefan Ehrlich wrote: > Dear Richard, > > The optimization step for doing it does already exist --> it is used for > stack variables/objects, bu

AW: g++keeps unused objects with virtual functions

2015-04-09 Thread Stefan Ehrlich
. April 2015 13:32 An: Richard Biener Cc: Jan Hubicka; GCC Development; zl...@acm.org Betreff: AW: g++keeps unused objects with virtual functions That means, that there is no chance to find this in the next future GCC releases :-( But anyway... Thanks so far Stefan PS: Hope dies last