1 Fix ld segfault for microblaze when --gc-sections is used
3 https://sourceware.org/bugzilla/show_bug.cgi?id=21180
5 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
7 diff -Nur binutils-2.25.1.orig/bfd/elf32-microblaze.c binutils-2.25.1/bfd/elf32-microblaze.c
8 --- binutils-2.25.1.orig/bfd/elf32-microblaze.c 2015-07-21 10:20:58.000000000 +0200
9 +++ binutils-2.25.1/bfd/elf32-microblaze.c 2017-02-23 19:43:24.560776208 +0100
10 @@ -3297,13 +3297,20 @@
13 asection *sec = h->root.u.def.section;
16 + value = h->root.u.def.value;
17 + if (sec->output_section != NULL)
18 + /* PR 21180: If the output section is NULL, then the symbol is no
19 + longer needed, and in theory the GOT entry is redundant. But
20 + it is too late to change our minds now... */
21 + value += sec->output_section->vma + sec->output_offset;
23 microblaze_elf_output_dynamic_relocation (output_bfd,
24 srela, srela->reloc_count++,
26 R_MICROBLAZE_REL, offset,
28 - + sec->output_section->vma
29 - + sec->output_offset);