Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so/arch/i386 Avoid using uninitialized variab...
details: https://anonhg.NetBSD.org/src/rev/dc1587cd774f
branches: trunk
changeset: 376209:dc1587cd774f
user: martin <martin%NetBSD.org@localhost>
date: Sun Jun 04 20:02:29 2023 +0000
description:
Avoid using uninitialized variable "symnum" when building with DEBUG
enabled by borrowing the rdbg_symname() macro from arch/x86_64.
diffstat:
libexec/ld.elf_so/arch/i386/mdreloc.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diffs (87 lines):
diff -r d0101305f8e1 -r dc1587cd774f libexec/ld.elf_so/arch/i386/mdreloc.c
--- a/libexec/ld.elf_so/arch/i386/mdreloc.c Sun Jun 04 19:28:54 2023 +0000
+++ b/libexec/ld.elf_so/arch/i386/mdreloc.c Sun Jun 04 20:02:29 2023 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: mdreloc.c,v 1.42 2023/06/04 01:24:57 joerg Exp $ */
+/* $NetBSD: mdreloc.c,v 1.43 2023/06/04 20:02:29 martin Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.42 2023/06/04 01:24:57 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.43 2023/06/04 20:02:29 martin Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -15,6 +15,9 @@ void _rtld_bind_start(void);
void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
caddr_t _rtld_bind(const Obj_Entry *, Elf_Word);
+#define rdbg_symname(obj, rela) \
+ ((obj)->strtab + (obj)->symtab[ELF_R_SYM((rela)->r_info)].st_name)
+
void
_rtld_setup_pltgot(const Obj_Entry *obj)
{
@@ -97,7 +100,7 @@ int
*where += target - (Elf_Addr)where;
rdbg(("PC32 %s in %s --> %p in %s",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where, defobj->path));
break;
@@ -111,7 +114,7 @@ int
if (*where != tmp)
*where = tmp;
rdbg(("32/GLOB_DAT %s in %s --> %p in %s",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where, defobj->path));
break;
@@ -154,7 +157,7 @@ int
*where += (Elf_Addr)(def->st_value - defobj->tlsoffset);
rdbg(("TLS_TPOFF %s in %s --> %p",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where));
break;
@@ -165,7 +168,7 @@ int
*where += (Elf_Addr)(defobj->tlsoffset - def->st_value);
rdbg(("TLS_TPOFF32 %s in %s --> %p",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where));
break;
@@ -173,7 +176,7 @@ int
*where = (Elf_Addr)(defobj->tlsindex);
rdbg(("TLS_DTPMOD32 %s in %s --> %p",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where));
break;
@@ -181,7 +184,7 @@ int
*where = (Elf_Addr)(def->st_value);
rdbg(("TLS_DTPOFF32 %s in %s --> %p",
- obj->strtab + obj->symtab[symnum].st_name,
+ rdbg_symname(obj, rel),
obj->path, (void *)*where));
break;
@@ -192,7 +195,7 @@ int
(u_long)ELF_R_SYM(rel->r_info),
(u_long)ELF_R_TYPE(rel->r_info),
(void *)rel->r_offset, (void *)*where,
- obj->strtab + obj->symtab[symnum].st_name));
+ rdbg_symname(obj, rel)));
_rtld_error("%s: Unsupported relocation type %ld "
"in non-PLT relocations",
obj->path, (u_long) ELF_R_TYPE(rel->r_info));
Home |
Main Index |
Thread Index |
Old Index