Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Section at index 0 is SHN_UNDEF. When searchi...
details: https://anonhg.NetBSD.org/src/rev/445dc50f5d19
branches: trunk
changeset: 823273:445dc50f5d19
user: uwe <uwe%NetBSD.org@localhost>
date: Mon Apr 17 18:06:30 2017 +0000
description:
Section at index 0 is SHN_UNDEF. When searching for symbol sections
skip it and start with index 1.
diffstat:
sys/lib/libsa/loadfile_elf32.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 93c0f56ba938 -r 445dc50f5d19 sys/lib/libsa/loadfile_elf32.c
--- a/sys/lib/libsa/loadfile_elf32.c Mon Apr 17 17:44:48 2017 +0000
+++ b/sys/lib/libsa/loadfile_elf32.c Mon Apr 17 18:06:30 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile_elf32.c,v 1.37 2017/04/17 17:44:48 uwe Exp $ */
+/* $NetBSD: loadfile_elf32.c,v 1.38 2017/04/17 18:06:30 uwe Exp $ */
/*
* Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -432,7 +432,7 @@
/*
* First load the section names section.
*/
- if (boot_load_ctf && (elf->e_shstrndx != 0)) {
+ if (boot_load_ctf && (elf->e_shstrndx != SHN_UNDEF)) {
Elf_Off shstroff = shp[elf->e_shstrndx].sh_offset;
shstrsz = shp[elf->e_shstrndx].sh_size;
if (flags & LOAD_SYM) {
@@ -473,7 +473,7 @@
* table.
*/
first = 1;
- for (i = 0; i < elf->e_shnum; i++) {
+ for (i = 1; i < elf->e_shnum; i++) {
if (i == elf->e_shstrndx) {
/* already loaded this section */
continue;
@@ -492,7 +492,7 @@
shp[i].sh_offset = 0;
break;
case SHT_STRTAB:
- for (j = 0; j < elf->e_shnum; j++)
+ for (j = 1; j < elf->e_shnum; j++)
if (shp[j].sh_type == SHT_SYMTAB &&
shp[j].sh_link == (unsigned int)i)
goto havesym;
Home |
Main Index |
Thread Index |
Old Index