bugAVR C Runtime Library - Bugs: bug #16411, -fwhole-program optimization...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #16411: -fwhole-program optimization deletes ISRs

Submitter:  Ned Konz <nedkonz>
Submitted:  Sat 22 Apr 2006 01:26:10 PM UTC
   
 
Category:  Header Severity:  5 - Blocker
Priority:  9 - Immediate Item Group:  None
Status:  Fixed Assigned to:  arcanum
Percent Complete:  100% Open/Closed:  Closed
Release:  None Fixed Release:  None

Jump to the original submission

Thu 24 Aug 2006 04:23:16 PM UTC, comment #6: 

Sorry, I don't recall why I added externally_visible, and I can't find it in my notes. If they aren't necessary for the fix, they should be removed.

Ned Konz <nedkonz>
Thu 24 Aug 2006 04:12:48 PM UTC, comment #5: 

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.

Joerg Wunsch <joerg_wunsch>
Group administrator
Thu 24 Aug 2006 04:00:34 PM UTC, comment #4: 

Hi Ned,

Can you explain why, in your latest patch, that you want to add the "externally_visible" attribute? Why would you want to nullify -fwhole-program? FYI, I agree with adding "used".

Eric

Eric Weddington <arcanum>
Group administrator
Sat 29 Apr 2006 09:50:28 PM UTC, comment #3: 

I am not suggesting that avr-libc support -fwhole-program or any other global optimzation.

I am merely suggesting that we add the "used" attribute to the definition of ISR() and friends.

This should be a harmless fix (that is, it just declares that the __vector_whatever() is actually called even though it's not called directly from the compilation unit), and happens to fix a particular class of problems for me and others who may wish to risk using these flags despite the acknowledged lack of support for them in avr-libc.

Ned Konz <nedkonz>
Sat 22 Apr 2006 07:13:42 PM UTC, comment #2: 

Currently, avr-libc doesn't claim support for that kind of
optimizations at all.  Supposedly, this will similarly apply
to the use of -ffunction-sections and --gc-sections in the
linker.

In order for this patch to be useful, a complete audit of
the library needs to be performed to guarantee compatibility.
This not only includes ISRs, but likely other functions where
there is no guarantee the compiler or linker would recognize
their usage correctly, namely:

. anything in gcrtS.c (not only the vectors)
. anything in .initN and .finiN sections (i. e. the
  documentation needs to mention this)

Joerg Wunsch <joerg_wunsch>
Group administrator
Sat 22 Apr 2006 04:06:20 PM UTC, comment #1: 

I've uploaded two more patches:

- one replaces the avr/interrupt.h patch that I earlier posted (it is a cosmetic change that combines the attributes)

- the other is for avr/compat/deprecated.h and adds the "used" attribute to INTERRUPT too (just in case)

Ned Konz <nedkonz>
Sat 22 Apr 2006 01:26:10 PM UTC, original submission:  

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.

I've attached two versions of a patch for this; the longer one also fixes the incorrect (I think) placement of the "extern C {" line.

Ned Konz <nedkonz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #9820:  usedISR+externCPP.patch added by nedkonz (2KiB - application/octet-stream - replacement for file#9816)
file #9819:  deprecatedUsedISR.patch added by nedkonz (605B - application/octet-stream - revised patches)
file #9816:  usedISR+externCPP.patch added by nedkonz (2KiB - application/octet-stream - above patch plus fix for extern "C" { placement)
file #9815:  usedISR.patch added by nedkonz (2KiB - application/octet-stream - patch to add _attribute_((used)) to ISR and friends)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Follow 13 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-09-01 arcanum Percent Complete0% 100%
    Open/ClosedOpen Closed
2006-09-01 arcanum StatusNone Fixed
2006-08-24 arcanum Assigned toNone arcanum
2006-08-14 arcanum Severity3 - Normal 5 - Blocker
    Priority3 - Low 9 - Immediate
2006-05-02 leviharper Carbon-Copy- Added leviharper
2006-04-22 joerg_wunsch Priority5 - Normal 3 - Low
2006-04-22 nedkonz Attached File- Added usedISR+externCPP.patch, #9820
2006-04-22 nedkonz Attached File- Added deprecatedUsedISR.patch, #9819
2006-04-22 nedkonz Attached File- Added usedISR+externCPP.patch, #9816
    Carbon-Copy- Added joerg_wunsch
2006-04-22 nedkonz Attached File- Added usedISR.patch, #9815

Back to the top

Powered by Savane 3.13-4b48.
Corresponding source code