I have an elf file with a section that has an allocated length, but no content in the file. In binutils 2.16.91.0.5 I used to be able to give it some contents (of whatever is the default value) by changing the flags, but in 2.17.50.0.17 I can no longer do so.
My target is SH, but I have no reason to think this is SH specific. How to reproduce: 1. Create an example binary: FILE: test.c int main() { } END-FILE FILE: link.ld SECTIONS { .text : { *(.text .stub .text.* .gnu.linkonce.t.*) } =0 .post_text_reserve : { /* Reserve some space so we can drop something in here later */ . += 0x160; } } END-FILE $ gcc test.c -T link.ld -nostdlib This should create a binary with the following properties: $ objdump -ph a.out a.out: file format elf32-shl Program Header: LOAD off 0x00000080 vaddr 0x00000000 paddr 0x00000000 align 2**7 filesz 0x0000000c memsz 0x0000016c flags rwx Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000000c 00000000 00000000 00000080 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .post_text_reserve 00000160 0000000c 0000000c 0000008c 2**0 ALLOC 2 .comment 00000043 00000000 00000000 0000008c 2**0 CONTENTS, READONLY 2. Run objcopy: $ objcopy a.out a2.out --set-section-flags .post_text_reserve=contents,alloc,load,readonly,code BFD: a2.out: section `.text' can't be allocated in segment 0 ....../bin/sh4objcopy: a2.out: Bad value BFD: a2.out: section `.text' can't be allocated in segment 0 ....../bin/sh4objcopy: a2.out: Bad value -- Summary: objcopy won't change section flags on zero file-size sections Product: binutils Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: andrew dot stubbs at st dot com CC: bug-binutils at gnu dot org http://sourceware.org/bugzilla/show_bug.cgi?id=5233 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils