This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 6019
  [avr] avr-ld --relax requires --gc-sections Last modified: 2008-06-04 09:59:03
     Query page      Enter new bug
Bug#: 6019   Hardware:   Reporter: Eric Weddington <eric.weddington@atmel.com>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: unassigned@sources.redhat.com   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
binutils-bug-6019.zip Test case. application/binary 2008-05-25 20:14 Edit None
onewire.i reduced test case text/plain 2008-05-29 21:39 Edit None
pr6016_elf32-avr.c_patch Add test for no local symbols patch 2008-05-30 15:37 Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 6019 depends on: Show dependency tree
Show dependency graph
Bug 6019 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2008-03-31 22:26
avr-ld fails with --relax, unless --gc-sections is also used, even if
-ffunction-sections is not used with avr-gcc.

------- Additional Comment #1 From Nick Clifton 2008-05-21 11:23 -------
Hi Eric,

  Please can you provide a test case for this ?

Cheers
  Nick

------- Additional Comment #2 From Eric Weddington 2008-05-25 20:14 -------
Created an attachment (id=2756)
Test case.

This zip file contains the source code of a project that exhibits the bug, and
it contains a short build script. This source code comes from WinAVR
(SourceForge) bug #1819125:
<http://sourceforge.net/tracker/index.php?func=detail&aid=1819125&group_id=68108&atid=520074>

------- Additional Comment #3 From Eric Weddington 2008-05-25 20:15 -------
Unfortunately this is all I have in the way of test case. I know that it is too
large, but I haven't had time to investigate into a smaller test case.

------- Additional Comment #4 From Eric Weddington 2008-05-25 20:17 -------
Note that in the build script, using -Wl,--relax causes ld to fail. Using
-Wl,--relax,--gc-sections causes the link to be successful. This is with a
host=mingw toolchain. I have not verified the bug on a host=linux toolchain.

------- Additional Comment #5 From Jevin Sweval 2008-05-29 21:39 -------
Created an attachment (id=2766)
reduced test case

test with:
avr-gcc -c -o onewire.o -Os onewire.i
avr-gcc -Wl,--relax -o onewire.elf onewire.o

-Os is necessary and the linker doesn't crash with --gc-sections

------- Additional Comment #6 From Jevin Sweval 2008-05-29 21:42 -------
I've attached a reduced test case made with multidelta. It got minimized to 11
meaningful lines. It was run through the preprocessor before minimization so the
actual code is hard to read but I doubt that really matters.

------- Additional Comment #7 From Nick Clifton 2008-05-30 15:37 -------
Created an attachment (id=2768)
Add test for no local symbols

------- Additional Comment #8 From Nick Clifton 2008-05-30 15:38 -------
Hi Eric, Hi Jevin,

  Please could you try out the uploaded patch and let me know if it works for
you ?  (I am especially interested to know if it works on the real programs
where you encountered this bug, not just the reduced testcase).

Cheers
  Nick

------- Additional Comment #9 From Eric Weddington 2008-06-02 16:37 -------
Patch fixes bug on real-world application. 

Thanks, Nick!

------- Additional Comment #10 From Nick Clifton 2008-06-04 09:59 -------
Hi Guys,

  Great - I have applied the patch along with the changelog entry below.

Cheers
  Nick

bfd/ChangeLog
	PR ld/6019
	* elf32-avr.c (elf32_avr_relax_section): Handle the case where
	there are no local symbols.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In