Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Apr 2002 02:10:09 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 9191 for review
Message-ID:  <200204061010.g36AA9T30341@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9191

Change 9191 by peter@peter_thunder on 2002/04/06 02:10:00

	Check in an a real fix for the cxa_finalize weak symbol.  It
	was a bug in ld.so after all.  This still needs work, especially
	the comments about find_symdef not working for local symbols.

Affected files ...

... //depot/projects/ia64/libexec/rtld-elf/ia64/reloc.c#2 edit

Differences ...

==== //depot/projects/ia64/libexec/rtld-elf/ia64/reloc.c#2 (text+ko) ====

@@ -136,7 +136,7 @@
 		 * to ensure this within a single object. If the
 		 * caller's alloca failed, we don't even ensure that.
 		 */
-		const Elf_Sym *def;
+		const Elf_Sym *def, *ref;
 		const Obj_Entry *defobj;
 		struct fptr *fptr = 0;
 		Elf_Addr target, gp;
@@ -153,8 +153,21 @@
 			def = &obj->symtab[ELF_R_SYM(rela->r_info)];
 			defobj = obj;
 		}
-		target = (Elf_Addr) (defobj->relocbase + def->st_value);
-		gp = (Elf_Addr) defobj->pltgot;
+		/*
+		 * If this is an undefined weak reference, we need to
+		 * have a zero target,gp fptr, not pointing to relocbase.
+		 * This isn't quite right.  Maybe we should check
+		 * explicitly for def == &sym_zero.
+		 */
+		if (def->st_value == 0 &&
+		    (ref = obj->symtab + ELF_R_SYM(rela->r_info)) &&
+		    ELF_ST_BIND(ref->st_info) == STB_WEAK) {
+			target = 0;
+			gp = 0;
+		} else {
+			target = (Elf_Addr) (defobj->relocbase + def->st_value);
+			gp = (Elf_Addr) defobj->pltgot;
+		}
 
 		/*
 		 * Find the @fptr, using fptrs as a helper.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204061010.g36AA9T30341>