Module Name:    src
Committed By:   joerg
Date:           Fri Nov 25 14:39:02 UTC 2011

Modified Files:
        src/libexec/ld.elf_so: symbol.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/libexec/ld.elf_so/symbol.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/ld.elf_so/symbol.c
diff -u src/libexec/ld.elf_so/symbol.c:1.58 src/libexec/ld.elf_so/symbol.c:1.59
--- src/libexec/ld.elf_so/symbol.c:1.58	Sat Aug 13 22:24:57 2011
+++ src/libexec/ld.elf_so/symbol.c	Fri Nov 25 14:39:02 2011
@@ -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 @@ _rtld_symlook_obj(const char *name, unsi
 		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 @@ _rtld_symlook_obj(const char *name, unsi
 		 * 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 */;
-#endif
-		else
+		if (symp->st_shndx == SHN_UNDEF &&
+		    ((flags & SYMLOOK_IN_PLT) ||
+		    symp->st_value == 0 ||
+		    ELF_ST_TYPE(symp->st_info) != STT_FUNC))
 			continue;
+#endif
 
 		if (ventry == NULL) {
 			if (obj->versyms != NULL) {

Reply via email to