avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] RE: [bug #16411] -fwhole-program optimization deletes ISR


From: Eric Weddington
Subject: [avr-libc-dev] RE: [bug #16411] -fwhole-program optimization deletes ISRs
Date: Thu, 24 Aug 2006 10:53:13 -0600

 

> -----Original Message-----
> From: Joerg Wunsch [mailto:address@hidden 
> Sent: Thursday, August 24, 2006 10:13 AM
> To: Ned Konz; Levi Harper; Joerg Wunsch; Eric Weddington; 
> address@hidden
> Subject: [bug #16411] -fwhole-program optimization deletes ISRs
> 
> 
> Follow-up Comment #5, bug #16411 (project avr-libc):
> 
> Please mind Björn Haase's latest changes to the linker script
> templates.  He added several KEEP statements there.  AFAIK
> these changes are not yet in binutils 2.17, they only have
> been added afterwards.  (They might be present in his
> ATmega256x/linker relaxation patch set, I'm not sure.)
> 
> Still, I'm opposed to "officially support" any of these
> features unless someone tests every aspect of them, and is
> also willing to add documentation for them.  Otherwise, it
> will only become a support nightmare.
> 
> Sorry, I currently complete ran out of time for that, so
> the "someone" above needs to be someone else, or it won't
> happen for the next avr-libc release.


I understand your concern. However, for this one aspect of this bug, I think
the concern is unfounded.

Let's ignore the KEEP statements in the linker scripts for the moment.

The original bug report stated:
"When using the -fwhole-program optimization on an AVR program containing an
ISR, the optimizer apparently sees the ISR as uncalled and deletes it.

Adding the __attribute__((used)) to the definition of ISR() fixes this."

The GCC documentation for __attribute__((used)) states:
"This attribute, attached to a function, means that code must be emitted for
the function even if it appears that the function is not referenced. This is
useful, for example, when the function is referenced only in inline
assembly."

Adding __attribute__((used)) to all ISRs (defined in a user application)
seems to be a reasonable change, regardless of whether -fwhole-program is
being used or not. The compiler will make sure that the ISR code is emitted,
even if -fwhole-program would want to kill it because there are no direct
references to the ISR.

I'm certainly willing to make this change. I disagree with the
"externally_visible" attribute in Ned's latest patch to this bug report; Ned
has already said that that can be removed.

Going back to the KEEP statements in the linker scripts, I would rather that
be analyzed as a separate issue from this bug report.

Joerg, do you have any overwhelming objections to just this minimal change,
beyond what you've already stated?

Thanks
Eric





reply via email to

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