[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] Re: Removal of unused functions

From: Eric Weddington
Subject: RE: [avr-gcc-list] Re: Removal of unused functions
Date: Fri, 25 Aug 2006 10:17:59 -0600


> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Bernd Trog
> Sent: Friday, August 25, 2006 9:36 AM
> To: address@hidden
> Subject: Re: [avr-gcc-list] Re: Removal of unused functions
> On Tue, 22 Aug 2006, Joerg Wunsch wrote:
> > Bernd Trog <address@hidden> wrote:
> > > Use __attribute__((used)) for ISRs if you call gcc with -combine
> > > -fwhole-program *.c.
> >
> > OK, that'll require changes in avr-libc (in the prototype 
> for ISR()).
> > Should be easy though.
> Oh - the documentation for __attribute__((used)) makes no
> guarantees about the symbol visibility.
> We should use 'externally_visible' for ISRs:
> | externally_visible:
> | This attribute, attached to a global variable or function 
> nullify effect
> | of -fwhole-program command line option, so the object remain visible
> | outside the current compilation unit.
> It would probably better to do this in the compiler some how (if
> 'signal'|'innterrupt' then add 'externally_visible')?

Hi Bernd,

I'm sorry, but can you explain this more?

The idea is to be able to use -fwhole-program and ISRs. AFAIU,
-fwhole-program sees that the ISR is not being reference, i.e. not being
called explicitly, and hence the optimizer removes the code. If
__attribute__((used)) is used in the ISR() macro (and the other interrupt
defining macros), then it forces the compiler to emit the ISR code.

I read the GCC docs too on externally_visible and is says that it nullifies
the effect of -fwhole-program. But why would we want to do this if we intend
to use -fwhole-program anyway?
The docs also say "so the object remains visible outside the current
compilation unit". But if we are using -fwhole-program, shouldn't we be
putting all .c modules on the command line anyway? And using -combine? Why
would we still need it to remain visible outside the compilation unit, when
that would make it a single compilation unit?

I'm probably just not understanding this...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]