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. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils