bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/15839] avr-ld -r removes sections created with avr-gcc -ffunctio


From: asmtwiddler at gmail dot com
Subject: [Bug ld/15839] avr-ld -r removes sections created with avr-gcc -ffunction-sections -fdata-sections
Date: Fri, 23 Aug 2013 03:30:51 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=15839

--- Comment #2 from asmtwiddler at gmail dot com ---
(In reply to Nick Clifton from comment #1)
> Created attachment 7160 [details]
> Update AVR linker script to only merge text and data sections during a final
> link
> 
> Hi amstwiddler,
> 
>   Please could you try out the uploaded patch and let me know if it works
> for you.
> 
>   The problem is the AVR linker script which is merging the text sections
> created by -ffunction-sections into a single .text section, even when
> creating a relocatable object file.
> 
> Cheers
>   Nick

Thanks for the fast response.

I tried the patch and it's working correctly.
Now objdump -h shows that the sections have been relocated.
Also ld --gc-sections properly removes unused sections.

This works correctly with functions and data, but doesn't work with progmem
data.
I'm not sure whether or not this is intended (as progmem is a special section)
but the code below isn't relocated properly:
#include <avr/pgmspace.h>
const PROGMEM int table [] = {
    8,7,6,5,4,3,2,1
};

Initial objdump:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000000  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000034  2**0
                  ALLOC
  3 .progmem.data.table 00000010  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .comment      0000002a  00000000  00000000  00000044  2**0
                  CONTENTS, READONLY

Relocated objdump:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000010  00000000  00000000  00000034  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000044  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000044  2**0
                  ALLOC
  3 .comment      0000002a  00000000  00000000  00000044  2**0
                  CONTENTS, READONLY

I was able to fix this by changing
*(.progmem*)
to
${RELOCATING+ *(.progmem*)}
but I'm not sure if this is right.

Other than the "progmem" issue, I believe this is fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

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