[glibc] arm: Redirect memcpy to __memcpy_arm for loader/static init code

Adhemerval Zanella via Glibc-cvs <[email protected]> Mon, 1 Jun 2026 16:19:26 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c5278a64282f1c1f9a88711bac7b4e1469f851d6

commit c5278a64282f1c1f9a88711bac7b4e1469f851d6
Author: Adhemerval Zanella <[email protected]>
Date:   Mon Jun 1 10:47:23 2026 -0300

    arm: Redirect memcpy to __memcpy_arm for loader/static init code
    
    After "elf: Initialize TCB and stack-protector before static IFUNC
    resolvers (BZ 20680, BZ 27582, BZ 28817)", early loader and static
    initialization code may run before the IFUNC resolvers are processed.
    
    The armv7-a supports memcpy, so add a dl-symbol-redir-ifunc.h to
    redirect the memcpy to to __memcpy_arm implementation.
    
    Checked on armv7a-linux-gnueabihf.

Diff:
---
 .../arm/armv7/multiarch/dl-symbol-redir-ifunc.h    | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/sysdeps/arm/armv7/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/arm/armv7/multiarch/dl-symbol-redir-ifunc.h
new file mode 100644
index 0000000000..63fe46f077
--- /dev/null
+++ b/sysdeps/arm/armv7/multiarch/dl-symbol-redir-ifunc.h
@@ -0,0 +1,24 @@
+/* Symbol redirection for loader/static initialization code.
+   Copyright (C) 2026 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
+
+asm ("memcpy = __memcpy_arm");
+
+#endif