avr-gcc-list
[Top][All Lists]
Advanced

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

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


From: Bernd Trog
Subject: RE: [avr-gcc-list] Re: Removal of unused functions
Date: Sun, 27 Aug 2006 05:31:55 -0700 (PDT)

Eric wrote:

> 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.

OK.

> 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.

Yes, but the docs for 'used' say nothing about the visibility of that
used function. OTH, the docs for -fwhole-program say that everything will
be static (invisible, local).

> 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?

externally_visible nullifies the effect of -fwhole-program for that
ISR, only. That's what we want, IMO.

> 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?

Yes!

> Why would we still need it to remain visible outside the compilation
> unit, when that would make it a single compilation unit?

To overwrite the weak __vector_* symbols from crt.o with the ISRs we want
to use.


Yes, it works with 'used' too, but this behaviour is not guaranteed, IMO.

In case you have a different opinion, let's discuss this on the gcc list
and ask the experts.





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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