e29cecdd47
Copy from Base:System/glibc based on submit request 27940 from user dirkmueller OBS-URL: https://build.opensuse.org/request/show/27940 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=14
77 lines
2.2 KiB
Diff
77 lines
2.2 KiB
Diff
Index: elf/dl-load.c
|
|
===================================================================
|
|
--- elf/dl-load.c.orig
|
|
+++ elf/dl-load.c
|
|
@@ -1207,6 +1207,9 @@ cannot allocate TLS data structures for
|
|
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
|
|
@@ -42,6 +42,7 @@ size_t _dl_platformlen;
|
|
|
|
int _dl_debug_mask;
|
|
int _dl_lazy;
|
|
+int _dl_madvise;
|
|
ElfW(Addr) _dl_use_load_bias = -2;
|
|
int _dl_dynamic_weak;
|
|
|
|
@@ -254,6 +255,8 @@ _dl_non_dynamic_init (void)
|
|
|
|
_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
|
|
@@ -158,6 +158,7 @@ struct rtld_global_ro _rtld_global_ro at
|
|
._dl_lazy = 1,
|
|
._dl_fpu_control = _FPU_DEFAULT,
|
|
._dl_pointer_guard = 1,
|
|
+ ._dl_madvise = 1,
|
|
|
|
/* Function pointers. */
|
|
._dl_debug_printf = _dl_debug_printf,
|
|
@@ -2612,6 +2613,14 @@ process_envvars (enum mode *modep)
|
|
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
|
|
@@ -580,6 +580,9 @@ struct rtld_global_ro
|
|
/* 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;
|
|
|