public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-03-31 19:11 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:11 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4e0afb0249236fd8c7339ab45778d7373abd5268
commit 4e0afb0249236fd8c7339ab45778d7373abd5268
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
include/math.h | 6 -----
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
26 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/elf/Makefile b/elf/Makefile
index 724e35f0c4..5a2c921829 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/include/math.h b/include/math.h
index fa11a710a6..03cc614d51 100644
--- a/include/math.h
+++ b/include/math.h
@@ -122,12 +122,6 @@ __isinff128 (_Float128 x)
return ~(lx >> 63) & (hx >> 62);
}
# endif
-
-extern inline _Float128
-fabsf128 (_Float128 x)
-{
- return __builtin_fabsf128 (x);
-}
# endif
# if !(defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0)
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-10-04 12:55 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 12:55 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fef612a18315ff9bf1598c4b768e3d382418e37e
commit fef612a18315ff9bf1598c4b768e3d382418e37e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, this approach is still fragile
and not future proof since we do not if this will be the only
optimization option gcc will add that transform loops to memset
(or any libcall).
This patch add a new header dl-symbol-hacks.h that can be used to
redirect the compiler generated libcalls to port specific string
implementatation if required (defined by dl-ifunc-generic.h).
Checked on x86_64-linux-gnu and aarch64-linux-gnu.
Diff:
---
elf/Makefile | 5 ---
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 31 ++++++++++++++++++
sysdeps/aarch64/multiarch/dl-ifunc-generic.h | 24 ++++++++++++++
sysdeps/generic/dl-ifunc-generic.h | 37 ++++++++++++++++++++++
sysdeps/i386/i686/multiarch/dl-ifunc-generic.h | 24 ++++++++++++++
.../powerpc64/le/multiarch/dl-ifunc-generic.h | 24 ++++++++++++++
sysdeps/s390/multiarch/dl-ifunc-generic.h | 29 +++++++++++++++++
.../sparc32/sparcv9/multiarch/dl-ifunc-generic.h | 24 ++++++++++++++
sysdeps/sparc/sparc64/multiarch/dl-ifunc-generic.h | 24 ++++++++++++++
sysdeps/x86_64/multiarch/dl-ifunc-generic.h | 32 +++++++++++++++++++
11 files changed, 250 insertions(+), 5 deletions(-)
diff --git a/elf/Makefile b/elf/Makefile
index 008770bfaf..b915ea8f02 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -162,11 +162,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 4af0b5b2ce..6d1996ae6e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -44,6 +44,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..1b83b284dd
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,31 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+#include <dl-ifunc-generic.h>
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifdef HAVE_MEMSET_IFUNC_GENERIC
+asm ("memset = " HAVE_MEMSET_IFUNC_GENERIC);
+#endif
+
+#endif
diff --git a/sysdeps/aarch64/multiarch/dl-ifunc-generic.h b/sysdeps/aarch64/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..1278a06ff0
--- /dev/null
+++ b/sysdeps/aarch64/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,24 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#define HAVE_MEMSET_IFUNC_GENERIC "__memset_generic"
+
+#endif
diff --git a/sysdeps/generic/dl-ifunc-generic.h b/sysdeps/generic/dl-ifunc-generic.h
new file mode 100644
index 0000000000..5e1d5c1fd8
--- /dev/null
+++ b/sysdeps/generic/dl-ifunc-generic.h
@@ -0,0 +1,37 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+/* The compiler might optimize loops or other constructs to library calls even
+ in freestanding mode. Although it is safe in most scenarios, on program
+ loading and static startup, iFUNC resolution might require other dynamic
+ relocation that are not yet done.
+
+ Instead of adding per-file compiler flags to avoid the libcall generation,
+ this header defines generic symbols that will be routed instead of the
+ default symbols name.
+
+ Each port can then define the following macro to the expected generic
+ implementation if the symbol is provided as iFUNC:
+
+ HAVE_MEMSET_IFUNC_GENERIC - the generic memset call.
+ */
+
+#endif
diff --git a/sysdeps/i386/i686/multiarch/dl-ifunc-generic.h b/sysdeps/i386/i686/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..a538931c03
--- /dev/null
+++ b/sysdeps/i386/i686/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,24 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#define HAVE_MEMSET_IFUNC_GENERIC "__memset_ia32"
+
+#endif
diff --git a/sysdeps/powerpc/powerpc64/le/multiarch/dl-ifunc-generic.h b/sysdeps/powerpc/powerpc64/le/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..1bf516494d
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,24 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#define HAVE_MEMSET_IFUNC_GENERIC "__memset_power8"
+
+#endif
diff --git a/sysdeps/s390/multiarch/dl-ifunc-generic.h b/sysdeps/s390/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..b0e5ed23aa
--- /dev/null
+++ b/sysdeps/s390/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#include <ifunc-memset.h>
+
+#define IFUNC_SYMBOL_STR1(s) #s
+#define IFUNC_SYMBOL_STR(s) IFUNC_SYMBOL_STR1(s)
+
+#define HAVE_MEMSET_IFUNC_GENERIC IFUNC_SYMBOL_STR(MEMSET_DEFAULT)
+
+#endif
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-ifunc-generic.h b/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..417b24d2c1
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,24 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#define HAVE_MEMSET_IFUNC_GENERIC "__memset_ultra1"
+
+#endif
diff --git a/sysdeps/sparc/sparc64/multiarch/dl-ifunc-generic.h b/sysdeps/sparc/sparc64/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..417b24d2c1
--- /dev/null
+++ b/sysdeps/sparc/sparc64/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,24 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#define HAVE_MEMSET_IFUNC_GENERIC "__memset_ultra1"
+
+#endif
diff --git a/sysdeps/x86_64/multiarch/dl-ifunc-generic.h b/sysdeps/x86_64/multiarch/dl-ifunc-generic.h
new file mode 100644
index 0000000000..7b7cf1c3d6
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/dl-ifunc-generic.h
@@ -0,0 +1,32 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_IFUNC_GENERIC_H
+#define _DL_IFUNC_GENERIC_H
+
+#include <isa-level.h>
+
+#if MINIMUM_X86_ISA_LEVEL >= 4
+# define HAVE_MEMSET_IFUNC_GENERIC "__memset_evex_unaligned"
+#elif MINIMUM_X86_ISA_LEVEL == 3
+# define HAVE_MEMSET_IFUNC_GENERIC "__memset_avx2_unaligned"
+#else
+# define HAVE_MEMSET_IFUNC_GENERIC "__memset_sse2_unaligned"
+#endif
+
+#endif
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-06-09 21:24 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:24 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0fd07e5a462e6826add303d921150c97c208e2c5
commit 0fd07e5a462e6826add303d921150c97c208e2c5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 197143c384..2d7a21846d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -162,11 +162,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 4af0b5b2ce..6d1996ae6e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -44,6 +44,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index 3d92f6993a..acd7763b25 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -28,6 +28,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-06-09 13:21 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:21 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0fd07e5a462e6826add303d921150c97c208e2c5
commit 0fd07e5a462e6826add303d921150c97c208e2c5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 197143c384..2d7a21846d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -162,11 +162,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 4af0b5b2ce..6d1996ae6e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -44,6 +44,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index 3d92f6993a..acd7763b25 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -28,6 +28,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-06-03 14:10 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:10 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a93218019b8ed1e9d15da805e30fda878f369b16
commit a93218019b8ed1e9d15da805e30fda878f369b16
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 86110e9a42..40cc2a19a2 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -162,11 +162,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 4af0b5b2ce..6d1996ae6e 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -44,6 +44,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index 3d92f6993a..acd7763b25 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -28,6 +28,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-05-13 14:24 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:24 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3f8462be02cbccfa381a2e28f3812f09888912ef
commit 3f8462be02cbccfa381a2e28f3812f09888912ef
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 36035acb9e..518b1c0233 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-05-12 19:38 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:38 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=39a5b2eacc9b4c57b31a6191374067ce01aaea14
commit 39a5b2eacc9b4c57b31a6191374067ce01aaea14
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 36035acb9e..518b1c0233 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-05-10 18:28 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:28 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fe94561d542a9c73c0334403c0c47aa9ac5203a7
commit fe94561d542a9c73c0334403c0c47aa9ac5203a7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 36035acb9e..518b1c0233 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-04-29 14:08 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:08 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c3e7ad93e51f91886e7083b4ecab765dc891d426
commit c3e7ad93e51f91886e7083b4ecab765dc891d426
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
sysdeps/sparc/sparc32/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/memset.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
33 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 36035acb9e..518b1c0233 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/memset.S b/sysdeps/sparc/sparc32/memset.S
index b1b67cb2d1..5026275239 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -142,4 +142,5 @@ ENTRY(memset)
b 4b
sub %o0, %o2, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/memset.S b/sysdeps/sparc/sparc64/memset.S
index 33ecbc93fe..6a68ab52cb 100644
--- a/sysdeps/sparc/sparc64/memset.S
+++ b/sysdeps/sparc/sparc64/memset.S
@@ -303,4 +303,5 @@ ENTRY(memset)
0: retl
mov %o5, %o0
END(memset)
+strong_alias (memset, __memset_generic)
libc_hidden_builtin_def (memset)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
@ 2022-04-04 12:58 Adhemerval Zanella
0 siblings, 0 replies; 10+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:58 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89f4d92c6ca0ca0b62151b4d6fc8562ed28031f8
commit 89f4d92c6ca0ca0b62151b4d6fc8562ed28031f8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 30 09:23:35 2022 -0300
elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support
Besides the option being gcc specific, his approach is still fragile
since we don't how if this will be the only optimization option gcc
will make loops to memset.
Instead, it adds a __memset_generic internal symbol on all ports to
avoid the iFUNC plt and a symbol redirection to header to include on
TU that required it.
Diff:
---
benchtests/bench-bzero-large.c | 1 +
benchtests/bench-bzero-walk.c | 1 +
benchtests/bench-bzero.c | 1 +
benchtests/bench-memset-large.c | 1 +
benchtests/bench-memset-walk.c | 1 +
benchtests/bench-memset.c | 1 +
elf/Makefile | 5 ----
elf/dl-support.c | 1 +
elf/dl-symbol-hacks.h | 29 ++++++++++++++++++++++
intl/l10nflist.c | 2 +-
string/memset.c | 1 +
sysdeps/alpha/memset.S | 1 +
sysdeps/arm/memset.S | 1 +
sysdeps/csky/abiv2/memset.S | 1 +
sysdeps/ia64/memset.S | 1 +
sysdeps/mips/memset.S | 1 +
sysdeps/powerpc/powerpc32/memset.S | 1 +
sysdeps/powerpc/powerpc32/power4/memset.S | 1 +
.../powerpc32/power4/multiarch/memset-ppc32.S | 1 +
sysdeps/powerpc/powerpc32/power6/memset.S | 1 +
sysdeps/powerpc/powerpc32/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 1 +
sysdeps/powerpc/powerpc64/power4/memset.S | 1 +
sysdeps/powerpc/powerpc64/power6/memset.S | 1 +
sysdeps/powerpc/powerpc64/power7/memset.S | 1 +
sysdeps/powerpc/powerpc64/power8/memset.S | 1 +
sysdeps/sh/memset.S | 1 +
.../sparc32/sparcv9/multiarch/memset-ultra1.S | 1 +
sysdeps/sparc/sparc64/multiarch/memset-ultra1.S | 1 +
.../x86_64/multiarch/memmove-sse2-unaligned-erms.S | 5 ++++
.../x86_64/multiarch/memset-sse2-unaligned-erms.S | 1 +
31 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/benchtests/bench-bzero-large.c b/benchtests/bench-bzero-large.c
index cfc7b81cdf..f016165d45 100644
--- a/benchtests/bench-bzero-large.c
+++ b/benchtests/bench-bzero-large.c
@@ -137,6 +137,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero-walk.c b/benchtests/bench-bzero-walk.c
index 851a72b137..25a1a38fa3 100644
--- a/benchtests/bench-bzero-walk.c
+++ b/benchtests/bench-bzero-walk.c
@@ -136,6 +136,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-bzero.c b/benchtests/bench-bzero.c
index 500b7eba96..90b807c98a 100644
--- a/benchtests/bench-bzero.c
+++ b/benchtests/bench-bzero.c
@@ -155,6 +155,7 @@ test_main (void)
# define libc_hidden_builtin_def(X)
# define libc_hidden_def(X)
# define libc_hidden_weak(X)
+# define strong_alias(X,Y)
# define weak_alias(X,Y)
# undef MEMSET
# define MEMSET generic_memset
diff --git a/benchtests/bench-memset-large.c b/benchtests/bench-memset-large.c
index 0ea1e3811b..6605e2d414 100644
--- a/benchtests/bench-memset-large.c
+++ b/benchtests/bench-memset-large.c
@@ -118,6 +118,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset-walk.c b/benchtests/bench-memset-walk.c
index 466ee1b8d6..f7fcdf90ba 100644
--- a/benchtests/bench-memset-walk.c
+++ b/benchtests/bench-memset-walk.c
@@ -116,6 +116,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#undef MEMSET
#define MEMSET generic_memset
diff --git a/benchtests/bench-memset.c b/benchtests/bench-memset.c
index 6c95a1e965..c801c86b73 100644
--- a/benchtests/bench-memset.c
+++ b/benchtests/bench-memset.c
@@ -147,6 +147,7 @@ test_main (void)
#define libc_hidden_builtin_def(X)
#define libc_hidden_def(X)
#define libc_hidden_weak(X)
+#define strong_alias(X,Y)
#define weak_alias(X,Y)
#ifndef WIDE
# undef MEMSET
diff --git a/elf/Makefile b/elf/Makefile
index 724e35f0c4..5a2c921829 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..7066c4e3d5 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-auxv.h>
#include <dl-find_object.h>
#include <array_length.h>
+#include <dl-symbol-hacks.h>
extern char *__progname;
char **_dl_argv = &__progname; /* This is checked for some error messages. */
diff --git a/elf/dl-symbol-hacks.h b/elf/dl-symbol-hacks.h
new file mode 100644
index 0000000000..b8caccb570
--- /dev/null
+++ b/elf/dl-symbol-hacks.h
@@ -0,0 +1,29 @@
+/* Symbol rediretion for loader/static initialization code.
+ Copyright (C) 2022 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef _DL_SYMBOL_HACKS_H
+#define _DL_SYMBOL_HACKS_H
+
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper redirection it might call PLT throught
+ ifunc without relocations being processed. */
+#ifndef SHARED
+asm ("memset = __memset_generic");
+#endif
+
+#endif
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index 078a450dfe..1945d3f873 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -210,7 +210,7 @@ _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
}
*cp++ = '/';
- stpcpy (cp, filename);
+ strcpy (cp, filename);
/* Look in list of already loaded domains whether it is already
available. */
diff --git a/string/memset.c b/string/memset.c
index 1303dd7ad3..b98bad7095 100644
--- a/string/memset.c
+++ b/string/memset.c
@@ -88,3 +88,4 @@ MEMSET (void *dstpp, int c, size_t len)
return dstpp;
}
libc_hidden_builtin_def (MEMSET)
+strong_alias (MEMSET, __memset_generic)
diff --git a/sysdeps/alpha/memset.S b/sysdeps/alpha/memset.S
index 9249663d37..c5adae754b 100644
--- a/sysdeps/alpha/memset.S
+++ b/sysdeps/alpha/memset.S
@@ -124,3 +124,4 @@ $done: ret
cfi_endproc
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/arm/memset.S b/sysdeps/arm/memset.S
index 9c05669864..9b9a3cb264 100644
--- a/sysdeps/arm/memset.S
+++ b/sysdeps/arm/memset.S
@@ -66,3 +66,4 @@ ENTRY(memset)
DO_RET(lr)
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/csky/abiv2/memset.S b/sysdeps/csky/abiv2/memset.S
index 41df8e2bb8..7e23edc787 100644
--- a/sysdeps/csky/abiv2/memset.S
+++ b/sysdeps/csky/abiv2/memset.S
@@ -96,3 +96,4 @@ END (memset)
libc_hidden_builtin_def (memset)
.weak memset
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/ia64/memset.S b/sysdeps/ia64/memset.S
index d52f23dd93..70ad1140b8 100644
--- a/sysdeps/ia64/memset.S
+++ b/sysdeps/ia64/memset.S
@@ -395,3 +395,4 @@ store_words:
;; }
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index c5ffab1d8c..cb5c9a140f 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -424,3 +424,4 @@ END(MEMSET_NAME)
libc_hidden_builtin_def (MEMSET_NAME)
# endif
#endif
+strong_alias(MEMSET_NAME, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index c125934f55..63ad3d2d2b 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -302,3 +302,4 @@ L(handletail32):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/memset.S b/sysdeps/powerpc/powerpc32/power4/memset.S
index 40b140c841..98811c1a66 100644
--- a/sysdeps/powerpc/powerpc32/power4/memset.S
+++ b/sysdeps/powerpc/powerpc32/power4/memset.S
@@ -224,3 +224,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
index 0937ba2215..4c5724bc60 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset-ppc32.S
@@ -39,3 +39,4 @@
#endif
#include <sysdeps/powerpc/powerpc32/power4/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power6/memset.S b/sysdeps/powerpc/powerpc32/power6/memset.S
index d86701ff7c..5f4c8518bd 100644
--- a/sysdeps/powerpc/powerpc32/power6/memset.S
+++ b/sysdeps/powerpc/powerpc32/power6/memset.S
@@ -537,3 +537,4 @@ L(medium_28t):
blr
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc32/power7/memset.S b/sysdeps/powerpc/powerpc32/power7/memset.S
index 368e8b3939..68a6ec18d8 100644
--- a/sysdeps/powerpc/powerpc32/power7/memset.S
+++ b/sysdeps/powerpc/powerpc32/power7/memset.S
@@ -428,3 +428,4 @@ L(small):
END (memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index 30b25ef15f..91b9775edd 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -26,3 +26,4 @@
#endif
#include <sysdeps/powerpc/powerpc64/memset.S>
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 0f14a5198a..91557f0442 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -237,3 +237,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 140a756348..29ec7f200f 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -381,3 +381,4 @@ L(medium_28t):
blr
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 358199a805..1afeaf754d 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -384,3 +384,4 @@ L(small):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 70cace14ef..73676cdb88 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -504,3 +504,4 @@ L(LE7_tail5):
END_GEN_TB (MEMSET,TB_TOCLESS)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index 7852b472eb..fc36bc836a 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -84,3 +84,4 @@ L_byte_exit:
mov r7,r0
END(memset)
libc_hidden_builtin_def (memset)
+strong_alias (memset, __memset_generic)
diff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
index 2dda6f1ed6..e5082fa161 100644
--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc32/sparcv9/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
index 3c3add791e..478a106c83 100644
--- a/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
+++ b/sysdeps/sparc/sparc64/multiarch/memset-ultra1.S
@@ -27,3 +27,4 @@
# define memset __memset_ultra1
# include <sysdeps/sparc/sparc64/memset.S>
#endif
+strong_alias (__memset_ultra1, __memset_generic)
diff --git a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
index 09e7c1d6cd..b7b7e01a5e 100644
--- a/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memmove-sse2-unaligned-erms.S
@@ -31,3 +31,8 @@ weak_alias (__mempcpy, mempcpy)
compat_symbol (libc, __memmove_sse2_unaligned, memcpy, GLIBC_2_2_5);
# endif
#endif
+
+#ifndef SHARED
+strong_alias (__mempcpy_sse2_unaligned, __memcpy_generic)
+strong_alias (__memmove_sse2_unaligned, __memmove_generic)
+#endif
diff --git a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
index d52d170804..bbbb82ab3b 100644
--- a/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
+++ b/sysdeps/x86_64/multiarch/memset-sse2-unaligned-erms.S
@@ -29,6 +29,7 @@
# undef libc_hidden_builtin_def
# define libc_hidden_builtin_def(name)
# endif
+strong_alias (__memset_sse2_unaligned, __memset_generic)
# undef weak_alias
# define weak_alias(original, alias)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-10-04 12:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 19:11 [glibc/azanella/clang] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support Adhemerval Zanella
2022-04-04 12:58 Adhemerval Zanella
2022-04-29 14:08 Adhemerval Zanella
2022-05-10 18:28 Adhemerval Zanella
2022-05-12 19:38 Adhemerval Zanella
2022-05-13 14:24 Adhemerval Zanella
2022-06-03 14:10 Adhemerval Zanella
2022-06-09 13:21 Adhemerval Zanella
2022-06-09 21:24 Adhemerval Zanella
2022-10-04 12:55 Adhemerval Zanella
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).