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

 
 

bug #16411: -fwhole-program optimization deletes ISRs

Submitted by:  Ned Konz <nedkonz>
Submitted on:  Sat 22 Apr 2006 01:26:10 PM UTC  
 
Category: HeaderSeverity: 5 - Blocker
Priority: 9 - ImmediateItem Group: None
Status: FixedPercent Complete: 100%
Assigned to: Eric Weddington <arcanum>Open/Closed: Closed
Release: NoneFixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission 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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project 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.)

Attach File(s):
   
   
Comment:
   

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

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 13 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 01 Sep 2006 04:46:40 PM UTCarcanumPercent Complete0%=>100%
  Open/ClosedOpen=>Closed
Fri 01 Sep 2006 04:45:52 PM UTCarcanumStatusNone=>Fixed
Thu 24 Aug 2006 04:55:57 PM UTCarcanumAssigned toNone=>arcanum
Mon 14 Aug 2006 04:41:37 PM UTCarcanumSeverity3 - Normal=>5 - Blocker
  Priority3 - Low=>9 - Immediate
Tue 02 May 2006 08:11:36 PM UTCleviharperCarbon-Copy-=>Added leviharper
Sat 22 Apr 2006 07:13:42 PM UTCjoerg_wunschPriority5 - Normal=>3 - Low
Sat 22 Apr 2006 04:07:48 PM UTCnedkonzAttached File-=>Added usedISR+externCPP.patch, #9820
Sat 22 Apr 2006 04:06:20 PM UTCnedkonzAttached File-=>Added deprecatedUsedISR.patch, #9819
Sat 22 Apr 2006 01:27:17 PM UTCnedkonzAttached File-=>Added usedISR+externCPP.patch, #9816
  Carbon-Copy-=>Added joerg_wunsch
Sat 22 Apr 2006 01:26:11 PM UTCnedkonzAttached File-=>Added usedISR.patch, #9815

Back to the top


Powered by Savane 3.1-cleanup1