summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-18 11:56:08 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-18 11:56:08 +0000
commit1670c7cf0d06b82b064ae37f4c47a9b9692935f2 (patch)
tree31d9484958d5ddc6902223b54d59650683c464ad
parentbe221e8df92045dd7175f127d2263ca435336c53 (diff)
* malloc/arena.c (ptmalloc_init): Don't use brk if dlopenedcvs/fedora-glibc-2_3_3-69
from statically linked program and avoid calling _dl_addr in that case.
-rw-r--r--ChangeLog6
-rw-r--r--malloc/arena.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a282a288db..9978171580 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2004-10-18 Jakub Jelinek <jakub@redhat.com>
+ * malloc/arena.c (ptmalloc_init): Don't use brk if dlopened
+ from statically linked program and avoid calling _dl_addr in that
+ case.
+
+2004-10-18 Jakub Jelinek <jakub@redhat.com>
+
* sysdeps/generic/strcpy_chk.c (__strcpy_chk): Speed up by checking
destlen only every 4 bytes.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9018a4f0e9..02e88a391e 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -429,10 +429,16 @@ ptmalloc_init (void)
main_arena.next = &main_arena;
#if defined _LIBC && defined SHARED
- /* In case this libc copy is in a non-default namespace, never use brk. */
+ /* In case this libc copy is in a non-default namespace, never use brk.
+ Likewise if dlopened from statically linked program. */
Dl_info di;
struct link_map *l;
- if (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0 && l->l_ns != LM_ID_BASE)
+ extern struct dl_open_hook *_dl_open_hook;
+ libc_hidden_proto (_dl_open_hook);
+
+ if (_dl_open_hook != NULL
+ || (_dl_addr (ptmalloc_init, &di, &l, NULL) != 0
+ && l->l_ns != LM_ID_BASE))
__morecore = __failing_morecore;
#endif