usr/src/cmd/sgs/rtld/sparc/sparc_elf.c
changeset 12449 a87750d92895
parent 11827 d7ef53deac3f
--- a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c	Wed May 19 21:10:39 2010 -0700
+++ b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c	Wed May 19 22:33:49 2010 -0700
@@ -20,13 +20,10 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
  *	Copyright (c) 1988 AT&T
  *	  All Rights Reserved
+ *
+ * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -47,7 +44,8 @@
 #include	"_rtld.h"
 #include	"_audit.h"
 #include	"_elf.h"
-#include	"_inline.h"
+#include	"_inline_gen.h"
+#include	"_inline_reloc.h"
 #include	"msg.h"
 
 extern void	iflush_range(caddr_t, size_t);
@@ -539,6 +537,7 @@
 	uchar_t		rtype;
 	long		reladd, value, pvalue, relacount = RELACOUNT(lmp);
 	Sym		*symref, *psymref, *symdef, *psymdef;
+	Syminfo		*sip;
 	char		*name, *pname;
 	Rt_map		*_lmp, *plmp;
 	int		ret = 1, noplt = 0;
@@ -638,6 +637,7 @@
 	if (pltbgn && ((MODE(lmp) & RTLD_NOW) == 0))
 		noplt = 1;
 
+	sip = SYMINFO(lmp);
 	/*
 	 * Loop through relocations.
 	 */
@@ -657,11 +657,12 @@
 		    ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) {
 			if (relacount) {
 				relbgn = elf_reloc_relative_count(relbgn,
-				    relacount, relsiz, basebgn, lmp, textrel);
+				    relacount, relsiz, basebgn, lmp,
+				    textrel, 0);
 				relacount = 0;
 			} else {
 				relbgn = elf_reloc_relative(relbgn, relend,
-				    relsiz, basebgn, lmp, textrel);
+				    relsiz, basebgn, lmp, textrel, 0);
 			}
 			if (relbgn >= relend)
 				break;
@@ -672,7 +673,6 @@
 
 		reladd = (long)(((Rela *)relbgn)->r_addend);
 		rsymndx = ELF_R_SYM(((Rela *)relbgn)->r_info);
-
 		rel = (Rela *)relbgn;
 		relbgn += relsiz;
 
@@ -736,6 +736,14 @@
 		 */
 		if (rsymndx) {
 			/*
+			 * If a Syminfo section is provided, determine if this
+			 * symbol is deferred, and if so, skip this relocation.
+			 */
+			if (sip && is_sym_deferred((ulong_t)rel, basebgn, lmp,
+			    textrel, sip, rsymndx))
+				continue;
+
+			/*
 			 * Get the local symbol table entry.
 			 */
 			symref = (Sym *)((ulong_t)SYMTAB(lmp) +