public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] elf: Simplify _dl_aux_init with inhibit_loop_to_libcall
@ 2022-03-30  4:11 Fangrui Song
  2022-03-31  8:56 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song @ 2022-03-30  4:11 UTC (permalink / raw)
  To: libc-alpha, Florian Weimer, Szabolcs Nagy

---
 elf/Makefile     | 5 -----
 elf/dl-support.c | 9 ++++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/elf/Makefile b/elf/Makefile
index c96924e9c2..281551d380 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -160,11 +160,6 @@ ifeq (yes,$(have-loop-to-function))
 CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns
 endif
 
-ifeq (yes,$(have-loop-to-function))
-# Likewise, during static library startup, memset is not yet available.
-CFLAGS-dl-support.c = -fno-tree-loop-distribute-patterns
-endif
-
 # Compile rtld itself without stack protection.
 # Also compile all routines in the static library that are elided from
 # the shared libc because they are in libc.a in the same way.
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 153dd57ad2..b886a1462c 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -245,6 +245,9 @@ __rtld_lock_define_initialized_recursive (, _dl_load_tls_lock)
 
 int _dl_clktck;
 
+/* Inhibit memset for auxv_values initialization because memset may not
+   be available yet.  */
+inhibit_loop_to_libcall
 void
 _dl_aux_init (ElfW(auxv_t) *av)
 {
@@ -254,11 +257,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
 #endif
 
   _dl_auxv = av;
-  dl_parse_auxv_t auxv_values;
-  /* Use an explicit initialization loop here because memset may not
-     be available yet.  */
-  for (int i = 0; i < array_length (auxv_values); ++i)
-    auxv_values[i] = 0;
+  dl_parse_auxv_t auxv_values = { 0 };
   _dl_parse_auxv (av, auxv_values);
 }
 #endif
-- 
2.35.1.1021.g381101b075-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] elf: Simplify _dl_aux_init with inhibit_loop_to_libcall
  2022-03-30  4:11 [PATCH] elf: Simplify _dl_aux_init with inhibit_loop_to_libcall Fangrui Song
@ 2022-03-31  8:56 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2022-03-31  8:56 UTC (permalink / raw)
  To: Fangrui Song; +Cc: libc-alpha, Florian Weimer

The 03/29/2022 21:11, Fangrui Song wrote:
> +/* Inhibit memset for auxv_values initialization because memset may not
> +   be available yet.  */
> +inhibit_loop_to_libcall
>  void
>  _dl_aux_init (ElfW(auxv_t) *av)
>  {
> @@ -254,11 +257,7 @@ _dl_aux_init (ElfW(auxv_t) *av)
>  #endif
>  
>    _dl_auxv = av;
> -  dl_parse_auxv_t auxv_values;
> -  /* Use an explicit initialization loop here because memset may not
> -     be available yet.  */
> -  for (int i = 0; i < array_length (auxv_values); ++i)
> -    auxv_values[i] = 0;
> +  dl_parse_auxv_t auxv_values = { 0 };
>    _dl_parse_auxv (av, auxv_values);

this does not work for me
https://godbolt.org/z/s49TMP3z7

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-31  8:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-30  4:11 [PATCH] elf: Simplify _dl_aux_init with inhibit_loop_to_libcall Fangrui Song
2022-03-31  8:56 ` Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).