Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/elftoolchain/dist/libdwarf Relocation of type S...
details: https://anonhg.NetBSD.org/src/rev/a586234558c9
branches: trunk
changeset: 343965:a586234558c9
user: hannken <hannken%NetBSD.org@localhost>
date: Mon Mar 07 14:32:02 2016 +0000
description:
Relocation of type SHT_REL must use the current value as addend.
Fixes ctfconvert for i386 where section .debug_info uses this relocation.
Ok: Christos Zoulas
diffstat:
external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c | 19 +++++++++---
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (61 lines):
diff -r 6006a94b0fa6 -r a586234558c9 external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c
--- a/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c Mon Mar 07 13:08:48 2016 +0000
+++ b/external/bsd/elftoolchain/dist/libdwarf/libdwarf_elf_init.c Mon Mar 07 14:32:02 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libdwarf_elf_init.c,v 1.3 2016/02/20 02:43:41 christos Exp $ */
+/* $NetBSD: libdwarf_elf_init.c,v 1.4 2016/03/07 14:32:02 hannken Exp $ */
/*-
* Copyright (c) 2009 Kai Wang
@@ -28,7 +28,7 @@
#include "_libdwarf.h"
-__RCSID("$NetBSD: libdwarf_elf_init.c,v 1.3 2016/02/20 02:43:41 christos Exp $");
+__RCSID("$NetBSD: libdwarf_elf_init.c,v 1.4 2016/03/07 14:32:02 hannken Exp $");
ELFTC_VCSID("Id: libdwarf_elf_init.c 3161 2015-02-15 21:43:36Z emaste ");
static const char *debug_name[] = {
@@ -54,7 +54,8 @@
static void
_dwarf_elf_write_reloc(Dwarf_Debug dbg, Elf_Data *symtab_data, int endian,
- void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend)
+ void *buf, uint64_t offset, GElf_Xword r_info, GElf_Sxword r_addend,
+ int is_rel)
{
GElf_Sym sym;
int size;
@@ -63,6 +64,14 @@
return;
if ((size = _dwarf_get_reloc_size(dbg, GELF_R_TYPE(r_info))) == 0)
return; /* Unknown or non-absolute relocation. */
+ if (is_rel) {
+ uint64_t roffset = offset;
+
+ if (endian == ELFDATA2MSB)
+ r_addend = _dwarf_read_msb(buf, &roffset, size);
+ else
+ r_addend = _dwarf_read_lsb(buf, &roffset, size);
+ }
if (endian == ELFDATA2MSB)
_dwarf_write_msb(buf, &offset, sym.st_value + r_addend, size);
else
@@ -79,7 +88,7 @@
j = 0;
while (gelf_getrel(rel_data, j++, &rel) != NULL)
_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
- rel.r_offset, rel.r_info, 0);
+ rel.r_offset, rel.r_info, 0, 1);
}
static void
@@ -92,7 +101,7 @@
j = 0;
while (gelf_getrela(rel_data, j++, &rela) != NULL)
_dwarf_elf_write_reloc(dbg, symtab_data, endian, buf,
- rela.r_offset, rela.r_info, rela.r_addend);
+ rela.r_offset, rela.r_info, rela.r_addend, 0);
}
static int
Home |
Main Index |
Thread Index |
Old Index