[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uclibc-cvs
Subject:    [uClibc-cvs] CVS update of uClibc/ldso/ldso (ldso.c)
From:       jocke () codepoet ! org (Joakim Tjernlund)
Date:       2004-08-27 2:46:22
Message-ID: 20040827084619.0908EB401A () codepoet ! org
[Download RAW message or body]

    Date: Friday, August 27, 2004 @ 02:46:19
  Author: jocke
    Path: /var/cvs/uClibc/ldso/ldso

Modified: ldso.c (1.116 -> 1.117)

As Mike Frysinger notes, this code is still needed. I
misread this code and removed it, sorry.

I printed the values of _dl_brkp and _dl_envp in ldso and
got this when executing:
ls:
   __curbrk: 0x300c16e0
   __environ: 0x1008372c
ldd:
  __curbrk: 0x300776e0
  __environ: 0x3007759c

why is__environ in the app when executing ls but not ldd?


Index: uClibc/ldso/ldso/ldso.c
diff -u uClibc/ldso/ldso/ldso.c:1.116 uClibc/ldso/ldso/ldso.c:1.117
--- uClibc/ldso/ldso/ldso.c:1.116	Thu Aug 26 12:38:19 2004
+++ uClibc/ldso/ldso/ldso.c	Fri Aug 27 02:46:19 2004
@@ -99,6 +99,8 @@
 	struct r_debug *debug_addr;
 	unsigned long brk_addr, *lpnt;
 	int (*_dl_atexit) (void *);
+	unsigned long *_dl_brkp;		/* The end of the data segment for brk and sbrk */
+	unsigned long *_dl_envp;		/* The environment address */
 #if defined (__SUPPORT_LD_DEBUG__)
 	int (*_dl_on_exit) (void (*FUNCTION)(int STATUS, void *ARG),void*);
 #endif
@@ -689,6 +691,14 @@
 	   dynamicly linked if we are using ld.so.1, so we have to look
 	   up each symbol individually. */
 
+	_dl_brkp = (unsigned long *) (intptr_t) _dl_find_hash("__curbrk", _dl_symbol_tables, 0);
+	if (_dl_brkp)
+		*_dl_brkp = brk_addr;
+
+	_dl_envp = (unsigned long *) (intptr_t) _dl_find_hash("__environ", _dl_symbol_tables, 0);
+	if (_dl_envp)
+		*_dl_envp = (unsigned long) envp;
+
 #ifndef FORCE_SHAREABLE_TEXT_SEGMENTS
 	{
 		unsigned int j;

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic