Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/stand/prekern Handle absolute symbols. Since ...



details:   https://anonhg.NetBSD.org/src/rev/e383552c09f6
branches:  trunk
changeset: 827538:e383552c09f6
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Nov 01 17:00:17 2017 +0000

description:
Handle absolute symbols. Since my linux_sigcode.S::rev1.4 there are two
Elf_Rela that point to the NULL symbol - which the prekern thought was an
external reference.

In the ELF spec, STN_UNDEF means the value of the symbol is zero.

diffstat:

 sys/arch/amd64/stand/prekern/elf.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 608ed7810550 -r e383552c09f6 sys/arch/amd64/stand/prekern/elf.c
--- a/sys/arch/amd64/stand/prekern/elf.c        Wed Nov 01 15:34:28 2017 +0000
+++ b/sys/arch/amd64/stand/prekern/elf.c        Wed Nov 01 17:00:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elf.c,v 1.5 2017/10/29 11:38:43 maxv Exp $     */
+/*     $NetBSD: elf.c,v 1.6 2017/11/01 17:00:17 maxv Exp $     */
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -147,6 +147,10 @@
        char *buf, *secname;
        Elf_Shdr *sec;
 
+       if (symidx == STN_UNDEF) {
+               return 0;
+       }
+
        if (symidx >= eif.symcnt) {
                fatal("elf_sym_lookup: symbol beyond table");
        }



Home | Main Index | Thread Index | Old Index