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 Replace if() NADA else if() NADA else cont...



details:   https://anonhg.NetBSD.org/src/rev/0993fef710d9
branches:  trunk
changeset: 771581:0993fef710d9
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Nov 25 14:39:02 2011 +0000

description:
Replace if() NADA else if() NADA else continue logic with one explicit
block. Split out the MIPS handling to make it explicit and readable.

diffstat:

 libexec/ld.elf_so/symbol.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (51 lines):

diff -r bcb91315c7fe -r 0993fef710d9 libexec/ld.elf_so/symbol.c
--- a/libexec/ld.elf_so/symbol.c        Fri Nov 25 14:34:50 2011 +0000
+++ b/libexec/ld.elf_so/symbol.c        Fri Nov 25 14:39:02 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: symbol.c,v 1.58 2011/08/13 22:24:57 christos Exp $      */
+/*     $NetBSD: symbol.c,v 1.59 2011/11/25 14:39:02 joerg Exp $         */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: symbol.c,v 1.58 2011/08/13 22:24:57 christos Exp $");
+__RCSID("$NetBSD: symbol.c,v 1.59 2011/11/25 14:39:02 joerg Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -258,9 +258,10 @@
                rdbg(("check \"%s\" vs \"%s\" in %s", name, strp, obj->path));
                if (name[1] != strp[1] || strcmp(name, strp))
                        continue;
-               if (symp->st_shndx != SHN_UNDEF)
-                       /* Nothing to do */;
-#ifndef __mips__
+#ifdef __mips__
+               if (symp->st_shndx == SHN_UNDEF)
+                       continue;
+#else
                /*
                 * XXX DANGER WILL ROBINSON!
                 * If we have a function pointer in the executable's
@@ -271,13 +272,12 @@
                 * in the libraries to point to PLT slots in the
                 * executable, if they exist.
                 */
-               else if (!(flags & SYMLOOK_IN_PLT) &&
-                   symp->st_value != 0 &&
-                   ELF_ST_TYPE(symp->st_info) == STT_FUNC)
-                       /* Nothing to do */;
+               if (symp->st_shndx == SHN_UNDEF &&
+                   ((flags & SYMLOOK_IN_PLT) ||
+                   symp->st_value == 0 ||
+                   ELF_ST_TYPE(symp->st_info) != STT_FUNC))
+                       continue;
 #endif
-               else
-                       continue;
 
                if (ventry == NULL) {
                        if (obj->versyms != NULL) {



Home | Main Index | Thread Index | Old Index