aboutsummaryrefslogtreecommitdiff
path: root/ld/ldmain.c
diff options
context:
space:
mode:
authorSimon Baldwin <simonb@google.com>2012-11-15 10:49:02 +0000
committerSimon Baldwin <simonb@google.com>2012-11-15 10:49:02 +0000
commit24a0971372e2ccaa6a9399fd324370d8a4b430ca (patch)
tree453b9f206f530c2b75d60594b2fe0f877711727d /ld/ldmain.c
parent2792b94d6b9ffb46c239ccb871119b41e449ed03 (diff)
downloadgdb-24a0971372e2ccaa6a9399fd324370d8a4b430ca.zip
gdb-24a0971372e2ccaa6a9399fd324370d8a4b430ca.tar.gz
gdb-24a0971372e2ccaa6a9399fd324370d8a4b430ca.tar.bz2
* ldmain.c (main): Add start_sbrk set to sbrk(0) on entry.
On exit, compute data size as the delta between current sbrk(0) and start_sbrk.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r--ld/ldmain.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 3ba19b9..07f5f09 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -191,6 +191,9 @@ main (int argc, char **argv)
{
char *emulation;
long start_time = get_run_time ();
+#ifdef HAVE_SBRK
+ char *start_sbrk = (char *) sbrk (0);
+#endif
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
@@ -505,7 +508,7 @@ main (int argc, char **argv)
program_name, run_time / 1000000, run_time % 1000000);
#ifdef HAVE_SBRK
fprintf (stderr, _("%s: data size %ld\n"), program_name,
- (long) (lim - (char *) &environ));
+ (long) (lim - start_sbrk));
#endif
fflush (stderr);
}