>From 4ddfddc5c44c6c4ae84b5d71646d9c82ffef44c4 Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <[email protected]>
Date: Tue, 26 Oct 2010 20:22:48 -0300
Subject: [PATCH] ldso/powerpc: add support for protected symbols

* Protected symbols should not be overridden with
  symbols from other modules.

Signed-off-by: Gustavo Zacarias <[email protected]>
---
 ldso/ldso/powerpc/elfinterp.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c
index 855c040..f921c24 100644
--- a/ldso/ldso/powerpc/elfinterp.c
+++ b/ldso/ldso/powerpc/elfinterp.c
@@ -203,7 +203,9 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
 	symtab_index = ELF32_R_SYM(rpnt->r_info);
 	sym          = &symtab[symtab_index];
 	symname      = strtab + sym->st_name;
-	if (symtab_index) {
+	if (symtab_index &&
+			(ELF32_ST_VISIBILITY(symtab[symtab_index].st_other)
+			 != STV_PROTECTED)) {
 		symbol_addr = (unsigned long) _dl_find_hash(symname, scope, tpnt,
 							    elf_machine_type_class(reloc_type), &tls_tpnt);
 		/* We want to allow undefined references to weak symbols - this might
@@ -215,7 +217,12 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope,
 				&& ELF32_ST_BIND(sym->st_info) != STB_WEAK)))
 			return 1;
 	} else {
-		symbol_addr = sym->st_value;
+		if (symtab_index)
+			symbol_addr = DL_FIND_HASH_VALUE(tpnt, elf_machine_type_class(reloc_type),
+											&symtab[symtab_index]);
+		else
+			symbol_addr = sym->st_value;
+
 		tls_tpnt = tpnt;
 	}
 #if defined (__SUPPORT_LD_DEBUG__)
-- 
1.7.1

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to