!479 fix LD_HUGEPAGE_LIB env does not take effect

From: @lvying6 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2022-08-12 01:44:45 +00:00 committed by Gitee
commit 8d7433e01b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 23 additions and 21 deletions

View File

@ -1,8 +1,8 @@
From 28a9a4123b8a7494c0b5e70fd943fa7aa4f64fe8 Mon Sep 17 00:00:00 2001
From 0e86566343057fc021a6d82fe2b6be8651e51b3e Mon Sep 17 00:00:00 2001
From: Lv Ying <lvying6@huawei.com>
Date: Mon, 7 Mar 2022 03:28:33 +0000
Subject: [PATCH 1/3] elf: dynamic linker load shared object use hugepage as
much as possible
Subject: [PATCH] elf: dynamic linker load shared object use hugepage as much
as possible
This patch provides environment variables HUGEPAGE_PROBE and LD_HUGEPAGE_LIB
to enable load shared object use hugepage.
@ -31,9 +31,9 @@ as much as possible. This means:
elf/dl-map-segments-hugepage.h | 593 +++++++++++++++++++++++++++++++++
elf/elf.h | 2 +
elf/hugepageedit.c | 169 ++++++++++
elf/rtld.c | 64 ++++
elf/rtld.c | 63 ++++
sysdeps/generic/ldsodefs.h | 6 +-
12 files changed, 939 insertions(+), 1 deletion(-)
12 files changed, 938 insertions(+), 1 deletion(-)
create mode 100644 elf/dl-map-segments-hugepage.h
create mode 100644 elf/hugepageedit.c
@ -125,7 +125,7 @@ index af47cd51..27a48338 100644
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
diff --git a/elf/Makefile b/elf/Makefile
index 48bb4703..1574574d 100644
index 6fd515ba..32aba7ac 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -207,6 +207,14 @@ others-extras = $(ldconfig-modules)
@ -1055,10 +1055,10 @@ index 00000000..14a91a4b
+ return exit_status;
+}
diff --git a/elf/rtld.c b/elf/rtld.c
index 8268849a..491ef6b1 100644
index a8ae8b31..242b47e3 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2502,6 +2502,40 @@ dl_main (const ElfW(Phdr) *phdr,
@@ -2543,6 +2543,40 @@ dl_main (const ElfW(Phdr) *phdr,
/* Once we return, _dl_sysdep_start will invoke
the DT_INIT functions and then *USER_ENTRY. */
}
@ -1099,7 +1099,7 @@ index 8268849a..491ef6b1 100644
/* This is a little helper function for resolving symbols while
tracing the binary. */
@@ -2637,6 +2671,9 @@ process_envvars (struct dl_main_state *state)
@@ -2678,6 +2712,9 @@ process_envvars (struct dl_main_state *state)
char **runp = _environ;
char *envline;
char *debug_output = NULL;
@ -1109,10 +1109,11 @@ index 8268849a..491ef6b1 100644
/* This is the default place for profiling data file. */
GLRO(dl_profile_output)
@@ -2751,6 +2788,16 @@ process_envvars (struct dl_main_state *state)
@@ -2790,6 +2827,15 @@ process_envvars (struct dl_main_state *state)
if (!__libc_enable_secure
&& memcmp (envline, "DYNAMIC_WEAK", 12) == 0)
GLRO(dl_dynamic_weak) = 1;
break;
+
+#ifdef HUGEPAGE_SHARED_LIB
+ if (memcmp (envline, "HUGEPAGE_LIB", 12) == 0 && envline[13] != '\0')
+ {
@ -1121,12 +1122,10 @@ index 8268849a..491ef6b1 100644
+ }
+#endif
+
+ break;
+
break;
case 13:
/* We might have some extra environment variable with length 13
to handle. */
@@ -2771,6 +2818,13 @@ process_envvars (struct dl_main_state *state)
@@ -2812,6 +2858,13 @@ process_envvars (struct dl_main_state *state)
&& memcmp (envline, "PROFILE_OUTPUT", 14) == 0
&& envline[15] != '\0')
GLRO(dl_profile_output) = &envline[15];
@ -1140,7 +1139,7 @@ index 8268849a..491ef6b1 100644
break;
case 16:
@@ -2800,6 +2854,16 @@ process_envvars (struct dl_main_state *state)
@@ -2841,6 +2894,16 @@ process_envvars (struct dl_main_state *state)
}
}
@ -1158,7 +1157,7 @@ index 8268849a..491ef6b1 100644
variables. */
if (__builtin_expect (__libc_enable_secure, 0))
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index fcbbf697..03cab4c4 100644
index a1d70ce7..3328fd9b 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -549,7 +549,11 @@ struct rtld_global_ro
@ -1175,5 +1174,5 @@ index fcbbf697..03cab4c4 100644
EXTERN unsigned int _dl_osversion;
/* Platform name. */
--
2.31.1
2.33.0

View File

@ -66,7 +66,7 @@
##############################################################################
Name: glibc
Version: 2.34
Release: 93
Release: 94
Summary: The GNU libc libraries
License: %{all_license}
URL: http://www.gnu.org/software/glibc/
@ -1414,6 +1414,9 @@ fi
%endif
%changelog
* Thu Aug 11 2022 Lv Ying <lvying6@huawei.com> - 2.34-94
- fix LD_HUGEPAGE_LIB env does not take effect
* Mon Aug 1 2022 xujing <xujing125@huawei.com> - 2.34-93
- sync patches from upstream community