2009-02-20 08:46:43 +01:00
|
|
|
Index: elf/dl-load.c
|
|
|
|
===================================================================
|
|
|
|
--- elf/dl-load.c.orig
|
|
|
|
+++ elf/dl-load.c
|
2010-01-03 12:31:34 +01:00
|
|
|
@@ -1207,6 +1207,9 @@ cannot allocate TLS data structures for
|
2009-02-20 08:46:43 +01:00
|
|
|
goto call_lose_errno;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (GLRO(dl_madvise))
|
|
|
|
+ posix_fadvise (fd, c->mapoff, maplength, POSIX_FADV_WILLNEED);
|
|
|
|
+
|
|
|
|
l->l_map_end = l->l_map_start + maplength;
|
|
|
|
l->l_addr = l->l_map_start - c->mapstart;
|
|
|
|
|
|
|
|
Index: elf/dl-support.c
|
|
|
|
===================================================================
|
|
|
|
--- elf/dl-support.c.orig
|
|
|
|
+++ elf/dl-support.c
|
2009-11-16 09:54:19 +01:00
|
|
|
@@ -42,6 +42,7 @@ size_t _dl_platformlen;
|
2009-02-20 08:46:43 +01:00
|
|
|
|
|
|
|
int _dl_debug_mask;
|
|
|
|
int _dl_lazy;
|
|
|
|
+int _dl_madvise;
|
|
|
|
ElfW(Addr) _dl_use_load_bias = -2;
|
|
|
|
int _dl_dynamic_weak;
|
|
|
|
|
2009-11-16 09:54:19 +01:00
|
|
|
@@ -254,6 +255,8 @@ _dl_non_dynamic_init (void)
|
2009-02-20 08:46:43 +01:00
|
|
|
|
|
|
|
_dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0';
|
|
|
|
|
|
|
|
+ _dl_madvise = *(getenv ("LD_NOMADVISE") ?: "") == '\0';
|
|
|
|
+
|
|
|
|
_dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0';
|
|
|
|
|
|
|
|
_dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0';
|
|
|
|
Index: elf/rtld.c
|
|
|
|
===================================================================
|
|
|
|
--- elf/rtld.c.orig
|
|
|
|
+++ elf/rtld.c
|
2010-01-03 12:31:34 +01:00
|
|
|
@@ -158,6 +158,7 @@ struct rtld_global_ro _rtld_global_ro at
|
2009-02-20 08:46:43 +01:00
|
|
|
._dl_lazy = 1,
|
|
|
|
._dl_fpu_control = _FPU_DEFAULT,
|
|
|
|
._dl_pointer_guard = 1,
|
|
|
|
+ ._dl_madvise = 1,
|
|
|
|
|
|
|
|
/* Function pointers. */
|
|
|
|
._dl_debug_printf = _dl_debug_printf,
|
2010-01-03 12:31:34 +01:00
|
|
|
@@ -2612,6 +2613,14 @@ process_envvars (enum mode *modep)
|
2009-02-20 08:46:43 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 9:
|
|
|
|
+ /* Test whether we should not advise the kernel
|
|
|
|
+ about memory usage. */
|
|
|
|
+ if (memcmp (envline, "NOMADVISE", 9) == 0)
|
|
|
|
+ {
|
|
|
|
+ GLRO(dl_madvise) = envline[10] == '\0';
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
/* Test whether we want to see the content of the auxiliary
|
|
|
|
array passed up from the kernel. */
|
|
|
|
if (!INTUSE(__libc_enable_secure)
|
|
|
|
Index: sysdeps/generic/ldsodefs.h
|
|
|
|
===================================================================
|
|
|
|
--- sysdeps/generic/ldsodefs.h.orig
|
|
|
|
+++ sysdeps/generic/ldsodefs.h
|
2010-01-03 12:31:34 +01:00
|
|
|
@@ -580,6 +580,9 @@ struct rtld_global_ro
|
2009-02-20 08:46:43 +01:00
|
|
|
/* Do we do lazy relocations? */
|
|
|
|
EXTERN int _dl_lazy;
|
|
|
|
|
|
|
|
+ /* Should we advise kernel about memory usage? */
|
|
|
|
+ EXTERN int _dl_madvise;
|
|
|
|
+
|
|
|
|
/* Nonzero if runtime lookups should not update the .got/.plt. */
|
|
|
|
EXTERN int _dl_bind_not;
|
|
|
|
|