SHA256
1
0
forked from pool/binutils
binutils/avr-binutils-relocs.patch
Richard Biener ef845cca75 Accepting request 105013 from home:rmax:branches:devel:gcc
- Add spec files that build variants for arm and avr that install
  under /usr rather than /opt/cross.
- Add avr-binutils-relocs.patch to fix a crash in avr-ld.
  http://sourceware.org/bugzilla/show_bug.cgi?id=12161

OBS-URL: https://build.opensuse.org/request/show/105013
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/binutils?expand=0&rev=87
2012-02-15 09:19:39 +00:00

39 lines
1.2 KiB
Diff

===================================================================
RCS file: /cvs/src/src/bfd/elf32-avr.c,v
retrieving revision 1.51
retrieving revision 1.51.2.1
diff -u -r1.51 -r1.51.2.1
--- src/bfd/elf32-avr.c 2011/06/02 13:43:14 1.51
+++ src/bfd/elf32-avr.c 2012/02/01 17:07:37 1.51.2.1
@@ -1503,11 +1503,18 @@
bfd_vma symval;
bfd_vma shrinked_insn_address;
+ if (isec->reloc_count == 0)
+ continue;
+
shrinked_insn_address = (sec->output_section->vma
+ sec->output_offset + addr - count);
- irelend = elf_section_data (isec)->relocs + isec->reloc_count;
- for (irel = elf_section_data (isec)->relocs;
+ irel = elf_section_data (isec)->relocs;
+ /* PR 12161: Read in the relocs for this section if necessary. */
+ if (irel == NULL)
+ irel = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, FALSE);
+
+ for (irelend = irel + isec->reloc_count;
irel < irelend;
irel++)
{
@@ -1564,6 +1571,9 @@
/* else...Reference symbol is extern. No need for adjusting
the addend. */
}
+
+ if (elf_section_data (isec)->relocs == NULL)
+ free (irelend - isec->reloc_count);
}
}