[binutils-gdb] RISC-V: Fix relocation failure with zero address sections.
Jim Wilson
wilson@sourceware.org
Thu Feb 15 21:49:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=09ca4b9d9bd61ecb779386a6cc7796cb05dde1af
commit 09ca4b9d9bd61ecb779386a6cc7796cb05dde1af
Author: Jim Wilson <jimw@sifive.com>
Date: Thu Feb 15 13:48:38 2018 -0800
RISC-V: Fix relocation failure with zero address sections.
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore
symbols whose section address is zero.
Diff:
---
bfd/ChangeLog | 3 +++
bfd/elfnn-riscv.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cab828b..b48afd6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
2018-02-15 Jim Wilson <jimw@sifive.com>
+ * elfnn-riscv.c (_bfd_riscv_relax_section): Ifdef out check to ignore
+ symbols whose section address is zero.
+
* elfnn-riscv.c (riscv_elf_relocate_section): Use bfd_reloc_dangerous
when pcrel_lo reloc has an addend. Use reloc_dangerous callback for
bfd_reloc_dangerous. Use einfo instead of warning callback for errors.
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 931bd1d..0530532 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -3399,8 +3399,14 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
{
BFD_ASSERT (isym->st_shndx < elf_numsections (abfd));
sym_sec = elf_elfsections (abfd)[isym->st_shndx]->bfd_section;
+#if 0
+ /* The purpose of this code is unknown. It breaks linker scripts
+ for embedded development that place sections at address zero.
+ This code is believed to be unnecessary. Disabling it but not
+ yet removing it, in case something breaks. */
if (sec_addr (sym_sec) == 0)
continue;
+#endif
symval = sec_addr (sym_sec) + isym->st_value;
}
}
More information about the Binutils-cvs
mailing list