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/mips Fix bug found by Izumi Tsutsui -...



details:   https://anonhg.NetBSD.org/src/rev/2850b5658587
branches:  trunk
changeset: 518107:2850b5658587
user:      rafal <rafal%NetBSD.org@localhost>
date:      Sat Nov 24 18:07:04 2001 +0000

description:
Fix bug found by Izumi Tsutsui -- if _rtld_find_symdef returned NULL, the
runtime linker would crash.  Restore behavior similar to version 1.3, where
the runtime linker continues on, ignoring the symbol.

diffstat:

 libexec/ld.elf_so/arch/mips/mips_reloc.c |  56 ++++++++++++++++---------------
 1 files changed, 29 insertions(+), 27 deletions(-)

diffs (77 lines):

diff -r 515b0ea51ce5 -r 2850b5658587 libexec/ld.elf_so/arch/mips/mips_reloc.c
--- a/libexec/ld.elf_so/arch/mips/mips_reloc.c  Sat Nov 24 17:39:31 2001 +0000
+++ b/libexec/ld.elf_so/arch/mips/mips_reloc.c  Sat Nov 24 18:07:04 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_reloc.c,v 1.4 2001/10/14 23:13:22 rafal Exp $     */
+/*     $NetBSD: mips_reloc.c,v 1.5 2001/11/24 18:07:04 rafal Exp $     */
 
 /*
  * Copyright 1997 Michael L. Hitch <mhitch%montana.edu@localhost>
@@ -73,39 +73,41 @@
                            obj->path, sym->st_name + obj->strtab,
                            (u_long) ELF_R_TYPE(info), 
                            (u_long) obj->symtabno - i - 1);
+               else {
 
-               if (sym->st_shndx == SHN_UNDEF) {
+                       if (sym->st_shndx == SHN_UNDEF) {
 #if 0  /* These don't seem to work? */
 
-                       if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
-                           STT_FUNC) {
-                               if (sym->st_value)
-                                       *got = sym->st_value +
-                                           (Elf_Word)obj->relocbase;
-                               else
+                               if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                                   STT_FUNC) {
+                                       if (sym->st_value)
+                                               *got = sym->st_value +
+                                                   (Elf_Word)obj->relocbase;
+                                       else
+                                               *got = def->st_value +
+                                                   (Elf_Word)defobj->relocbase;
+                               } else
+#endif
                                        *got = def->st_value +
                                            (Elf_Word)defobj->relocbase;
-                       } else
-#endif
+                       } else if (sym->st_shndx == SHN_COMMON) {
                                *got = def->st_value +
                                    (Elf_Word)defobj->relocbase;
-               } else if (sym->st_shndx == SHN_COMMON) {
-                       *got = def->st_value +
-                           (Elf_Word)defobj->relocbase;
-               } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
-                   STT_FUNC &&
-                   *got != sym->st_value) {
-                       *got += (Elf_Word)obj->relocbase;
-               } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
-                   STT_SECTION && ELFDEFNNAME(ST_BIND)(sym->st_info) ==
-                   STB_GLOBAL) {
-                       if (sym->st_shndx == SHN_ABS)
-                               *got = sym->st_value +
-                                   (Elf_Word)obj->relocbase;
-                       /* else SGI stuff ignored */
-               } else
-                       *got = def->st_value +
-                           (Elf_Word)defobj->relocbase;
+                       } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                           STT_FUNC &&
+                           *got != sym->st_value) {
+                               *got += (Elf_Word)obj->relocbase;
+                       } else if (ELFDEFNNAME(ST_TYPE)(sym->st_info) ==
+                           STT_SECTION && ELFDEFNNAME(ST_BIND)(sym->st_info) ==
+                           STB_GLOBAL) {
+                               if (sym->st_shndx == SHN_ABS)
+                                       *got = sym->st_value +
+                                           (Elf_Word)obj->relocbase;
+                               /* else SGI stuff ignored */
+                       } else
+                               *got = def->st_value +
+                                   (Elf_Word)defobj->relocbase;
+               }
 
                ++sym;
                ++got;



Home | Main Index | Thread Index | Old Index