I have an assert detonating in bfd/elflink.c with the following code linked with mips-linux-elf-ld -shared -q:
main.c: /* 'a' goes into .data */ int a = 1; /* 'b' goes into .rodata and creates a reloc for .rodata against .data */ const int *b = &a; when linking with mips-linux-elf-ld version 2.17, we end-up with: mips-linux-elf-ld: BFD 2.17 assertion fail elflink.c:7973 After some investigations, I have observed the following: - the section for which we have an assert is '.rel.dyn' - sh_entsize for this section is zero - we reach this code because reloc_count is greater than zero (and is equals to sec->reloc_count because of the -q option passed to ld) - '.rel.dyn' section is created by mips_elf_rel_dyn_section() - room is reserved for our .rel.dyn section by mips_elf_allocate_dynamic_relocations() - I have a '.rel.rel.dyn' section in the output I was surprised to see in mips_elf_allocate_dynamic_relocations() that reloc_count is incremented only for the 1st entries and ins't for subsequent entries. I was under the impression that asection::reloc_count is the number of relocations to be applied to a section; is it the number of relocs for a relocation section. I have the feeling that the incrementation of reloc_count in bfd/elfxx-mips.c:mips_elf_allocate_dynamic_relocations:4710 should be removed but are we breaking something with this change? -- Summary: sh_entsize not set for .dyn.rel cause an assert to detonate with mips-linux-elf-ld -shared -q Product: binutils Version: 2.17 Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: chombourger at nexwave-solutions dot com CC: bug-binutils at gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: mips-linux-elf http://sourceware.org/bugzilla/show_bug.cgi?id=3679 ------- 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