http://sourceware.org/bugzilla/show_bug.cgi?id=15839
Bug ID: 15839 Summary: avr-ld -r removes sections created with avr-gcc -ffunction-sections -fdata-sections Product: binutils Version: 2.23 Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: asmtwiddler at gmail dot com Currently avr-ld -r merges sections created with avr-gcc -ffunction-sections -fdata-sections back into the .text and .data sections. This is problematic as it prevents --gc-sections from removing unused functions. Example: long func1(long val) { return val - 1; } long func2(long val) { return val + 1; } I compiled with avr-gcc -ffunction-sections -fdata-sections -c I also used -O2 -mmcu=atmega328 -Wall but that shouldn't matter. Then I ran avr-ld -r on the created object file to create a new object file. Using avr-objdump -h gave me, for the initial object file: 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 .text.func1 0000000a 00000000 00000000 00000034 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 4 .text.func2 0000000a 00000000 00000000 0000003e 2**0 CONTENTS, ALLOC, LOAD, READONLY, CODE 5 .comment 0000002a 00000000 00000000 00000048 2**0 CONTENTS, READONLY And for the second (relocated) object file: Idx Name Size VMA LMA File off Algn 0 .text 00000014 00000000 00000000 00000034 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000048 2**0 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000048 2**0 ALLOC 3 .comment 0000002a 00000000 00000000 00000048 2**0 CONTENTS, READONLY Thanks for any help. -- 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