On (20/01/12 10:36), Carmelo AMOROSO wrote:
> On 20/01/2012 7.55, Khem Raj wrote:
> > On Thu, Jan 19, 2012 at 6:42 AM, Carmelo AMOROSO <carmelo.amor...@st.com> 
> > wrote:
> >> On 19/01/2012 15.28, Carmelo AMOROSO wrote:
> >>> Fill properly the sym_ref fields when invoking _dl_find_hash to lookup
> >>> symbols
> > 
> > this did not make the segfault go away. Although this patch is ok.
> > this problem is a crash in libstdc++ I did not have debug info to
> > get more info but I am building an image with debug info
> > 
> 
> I can't help with mips. As soon as you have some debug out, I can try to
> figure out where the problem is.
> 
> I've looked at the change history of mips/elfinterp.c, I'm not seeing
> currently other fix than this one, but I'll keep on looking at this.

I see the problem and attached patch fixed it. Relocations on mips were
being resolved before the new module scope was added to scope map and
it was causing the libstdc++ constructors to fail to run since the
symbols were not resolved properly.

I will push the three fixes we have in this series soon unless someone
has objections

-Khem


>From 09eaabe18e3abbad4e8fded447a5649372a2d204 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.k...@gmail.com>
Date: Sat, 21 Jan 2012 00:21:41 -0800
Subject: [PATCH] mips/libdl: Apply relocations after appending the new scope

Without this the relocations for the current shared object
are not resolved since the scope is not added to map yet

Signed-off-by: Khem Raj <raj.k...@gmail.com>
---
 ldso/libdl/libdl.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index bc3ef8a..32afe1c 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -543,6 +543,12 @@ static void *do_dlopen(const char *libname, int flag)
 	 * Now we go through and look for REL and RELA records that indicate fixups
 	 * to the GOT tables.  We need to do this in reverse order so that COPY
 	 * directives work correctly */
+
+	/* Get the tail of the list */
+	for (ls = &_dl_loaded_modules->symbol_scope; ls && ls->next; ls = ls->next);
+
+	/* Extend the global scope by adding the local scope of the dlopened DSO. */
+	ls->next = &dyn_chain->dyn->symbol_scope;
 #ifdef __mips__
 	/*
 	 * Relocation of the GOT entries for MIPS have to be done
@@ -550,11 +556,6 @@ static void *do_dlopen(const char *libname, int flag)
 	 */
 	_dl_perform_mips_global_got_relocations(tpnt, !now_flag);
 #endif
-	/* Get the tail of the list */
-	for (ls = &_dl_loaded_modules->symbol_scope; ls && ls->next; ls = ls->next);
-
-	/* Extend the global scope by adding the local scope of the dlopened DSO. */
-	ls->next = &dyn_chain->dyn->symbol_scope;
 
 	if (_dl_fixup(dyn_chain, &_dl_loaded_modules->symbol_scope, now_flag))
 		goto oops;
-- 
1.7.0.4

_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to