Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2202504/?format=api
{ "id": 2202504, "url": "http://patchwork.ozlabs.org/api/patches/2202504/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260227183851.2113417-5-adhemerval.zanella@linaro.org/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260227183851.2113417-5-adhemerval.zanella@linaro.org>", "list_archive_url": null, "date": "2026-02-27T18:37:46", "name": "[v7,4/5] Fix assert during static startup", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0a6f302e5a73a5e3e9423b7ac613e9009db1dc89", "submitter": { "id": 66065, "url": "http://patchwork.ozlabs.org/api/people/66065/?format=api", "name": "Adhemerval Zanella", "email": "adhemerval.zanella@linaro.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260227183851.2113417-5-adhemerval.zanella@linaro.org/mbox/", "series": [ { "id": 493795, "url": "http://patchwork.ozlabs.org/api/series/493795/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=493795", "date": "2026-02-27T18:37:42", "name": "elf: Allow RPATH/RUNPATH for static-pie (BZ 33326)", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/493795/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2202504/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2202504/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "libc-alpha@sourceware.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "libc-alpha@sourceware.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=QUFlJTr4;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=QUFlJTr4", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=linaro.org", "sourceware.org; spf=pass smtp.mailfrom=linaro.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::92d" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fMxxm5rF7z1xy2\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Feb 2026 05:41:48 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 9D39C4BA23C9\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Feb 2026 18:41:46 +0000 (GMT)", "from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com\n [IPv6:2607:f8b0:4864:20::92d])\n by sourceware.org (Postfix) with ESMTPS id D0E464BA23FC\n for <libc-alpha@sourceware.org>; Fri, 27 Feb 2026 18:39:07 +0000 (GMT)", "by mail-ua1-x92d.google.com with SMTP id\n a1e0cc1a2514c-944168e8c5fso1317456241.2\n for <libc-alpha@sourceware.org>; Fri, 27 Feb 2026 10:39:07 -0800 (PST)", "from ubuntu-vm.. ([191.54.27.153]) by smtp.gmail.com with ESMTPSA id\n ada2fe7eead31-5ff1ea6ea19sm6283369137.12.2026.02.27.10.39.04\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 27 Feb 2026 10:39:05 -0800 (PST)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 9D39C4BA23C9", "OpenDKIM Filter v2.11.0 sourceware.org D0E464BA23FC" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org D0E464BA23FC", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org D0E464BA23FC", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772217547; cv=none;\n b=k+4rVHVGB3vA6SMnRKcp+ht9MOXygZilpYuYcMlKB1+KE3byrq0tpYIcOPwMlewx3PViKgZtSbX8jaGp07gX8f0+Fp2NeeQJzMUEDfUWhqUI+sbvLMiAWJxjEKLYsdZpC3JAbiH6zdE0GBcxOdOqDvsqGgS7Zsp5kw58QK1wCjY=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1772217547; c=relaxed/simple;\n bh=z9Wm8sR67hTOqiOC+pdKswxhAt6VCk5ptwHH+UALxxM=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=NmiSgnL6TyQ4QTwdEjjvF2bE/OglUPJBk+VOksFEUb1Bu/d92uW1HANGH7NJ3GAeT77m5tVyZIwP+o5jIvWsiGGa1ajIAi0naXX3Eg2SYIfS3j1AM1J5krBM8yMtiq7I/R6wQaFGA1NC6K7TdIlWClpvtrBdT1E21FimCMkAq+4=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1772217547; x=1772822347; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=klgYM+wPp5niVDFUL1wdWCybyeX+I2e2L7oHw8sNNHw=;\n b=QUFlJTr4lxIQfcWVMgkQBvwKKXZeGbYAWpq4ClbzNaEFnrZZDATyKxraKuLk8R5C89\n nqXyQIWWFF2j/G0zBQOLWgP2U5Z+Z/84lXDYIlFlxOvcHWTojTA+NysfwYdunIXJJE7G\n 6AWjXSaQ0FMnAfzNsIJJcKXhNOBaRE1zO3NaOZT+KlHB17NUxjDMpMthYhlcgn+9R9zL\n QYhyj+tG61AMrkNoYDJIjtWPAZbCiP37f6LrxGBuCnEQXFfrY83BJrXqnAvPQHmM/8S2\n 9/TQsa7GC2sLkKiIFEqzW9YNjB2Oe2ompOy1k/VCBFQc/Pe52kX6U9qy+NpmCiGoo08Y\n 8HCA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1772217547; x=1772822347;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=klgYM+wPp5niVDFUL1wdWCybyeX+I2e2L7oHw8sNNHw=;\n b=G8j3FhIlE9biz9Tf+WG0hXCeS9VjZpFNTAz0e10Im+YEQXvR1PHQLYCm4GVOtDZN0A\n UWjM5W1H8NnFtgT+iWapKHA/17sLZp1aBbDWgfyb2iAZKxWvOAbaqfANIQ8qgjgg9zfP\n nerndJYiTW7cselcmxxyFSIsE83t4UeWsnoba5ooMO8pOepw4StJfpDbHgJbw1jBWue2\n OXHc6aewwHp46/U46GBLMovwWMQmsajrZj3Xn33AD+KoLLOVK8oha/3bR4Js2q6iXfrx\n p6hN4r5OIdf8sKGdPEmbQDwj37jWJhYTem2OQASDtj6PSNrGSsU48RnM7vP/BOYKR4IT\n vDRA==", "X-Gm-Message-State": "AOJu0YxY2airQ97NSuA4w59tY/bgmB9SckQaeR5Z1O0Z3SYUVC4BkSsR\n gSSp1wTOWr1WRZVgNHVWsPm0mka5izakFoKuUYU311rX2IXCmsX1Pg8kzY/KK+Kj+fAdar9F+GB\n 2yYDe", "X-Gm-Gg": "ATEYQzy1BfV3CI9gKHAf/KHdIdNld7legjml7bliWo3+ZxuMpdpF7H6QhwxW68GlsTH\n ZtsZWRDd3MEyuzRGGSdZ0l++QywD4abuKG2jNoC+2uXsC+/uWNlzwmpB3jpROTXDPWcCwcoyQHl\n eSILMy7a7OLkSDxNZTxOqy5SlMLhlpyAQAaUSTy5ivaCmW6E4oyOR1pdR4h9fv2cbJxcdDoMy6x\n EXxXz/N4/5cRwvkkSKF9VcREbGWB6MM0AfPWLvwx4wXy1LP1DRfGxhz5roab8DOJnMiyrBMk3Er\n V4T8NvFKlXYE2lKh4VZ06Oerw3VHGi+97sPPwBMPP2DYX8qd1j2At22iNTy7mCPrtOyapo9Aj3o\n vpV7CJ02qNvt4o24c5Q9fxy6G56EWh38bu6SEzZbIfhq2eWffdQZKRLpRxW0A5ae4/S7gtyiNfl\n +eiE4e7IFlfXe8DkdsfG6L074kZmT3wTMRRB8=", "X-Received": "by 2002:a05:6102:cc6:b0:5ff:1445:88ff with SMTP id\n ada2fe7eead31-5ff322714abmr2104970137.7.1772217546399;\n Fri, 27 Feb 2026 10:39:06 -0800 (PST)", "From": "Adhemerval Zanella <adhemerval.zanella@linaro.org>", "To": "libc-alpha@sourceware.org", "Cc": "Florian Weimer <fweimer@redhat.com>", "Subject": "[PATCH v7 4/5] Fix assert during static startup", "Date": "Fri, 27 Feb 2026 18:37:46 +0000", "Message-ID": "<20260227183851.2113417-5-adhemerval.zanella@linaro.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260227183851.2113417-1-adhemerval.zanella@linaro.org>", "References": "<20260227183851.2113417-1-adhemerval.zanella@linaro.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libc-alpha@sourceware.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>", "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>", "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>", "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>", "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org" }, "content": "The BZ#33326 testcase triggers an assertion during process startup,\nwhich results in a segmentation fault instead of an error message\nand process termination with a SIGABRT. The assert issues\n__libc_message_impl, which in turn might call string functions\ndepending on the ABI (strchrnul, strlen, memcpy/mempcpy), system\ncalls (writev and mmap), and finally the abort call.\n\nSince each function may be called during process startup, before\nself-relocation and/or the thread pointer being set up, the\nfunctions should be built without stack protection.\n\nThe dl-symbol-redir-ifunc.h is also expanded to cover\nstrlen/memcpy/mempcpy/strchrnul on multiple architectures that implement\nifunc.\n\nOn i386, syscalls should not use the vDSO (\"call *%gs:SYSINFO_OFFSET\")\nduring program statuup because thread pointer is not yet initialized. This\nrequires __raise_direct, _dl_writev, and _dl_mmap to use I386_USE_SYSENTER.\nTo avoid possible sysdep.h I386_USE_SYSENTER redefinition, all\nimplementations are done on their own translation unit.\n\nThe s390x requires not calling libgcc for the generic strchrnul-c (via\nctz/clz macros) due to a libgcc issue: the __clzdi2 builtin is not built\nagainst a hidden reference to __clz_tab, which creates a GOT reference\nfor static-pie (and it cannot be called before self-relocation).\n\nCreating a test case is challenging. For static-pie, the assert is only\ncalled for ill-formed ELF files on elf_get_dynamic_info and by some targets\non ELF_DYNAMIC_RELOCATE (although not all targets use assert in their\ndl-machine.h). Some targets also issue __libc_fatal on ARCH_SETUP_IREL,\nbut also only for ill-formatted ELF files.\n\nThe test employs a different strategy and overrides the __tunables_init\nsymbol, which is invoked immediately before self-relocation and TLS setup.\nThe test is built with -Wl,-z,muldefs to avoid linker issues.\n\nI checked on aarch64, x86_64, i686, s390x (qemu), sparc (qemu),\nmips64el (qemu), armhf, riscv, and powerpc.\n---\n assert/Makefile | 5 +++\n elf/Makefile | 16 ++++++++\n elf/tst-assert-startup-static.c | 38 +++++++++++++++++++\n libio/Makefile | 5 +++\n stdlib/Makefile | 5 +++\n string/Makefile | 1 +\n .../aarch64/multiarch/dl-symbol-redir-ifunc.h | 1 +\n sysdeps/aarch64/multiarch/memcpy_generic.S | 4 ++\n sysdeps/generic/dl-mmap.h | 34 +++++++++++++++++\n .../lp64/multiarch/dl-symbol-redir-ifunc.h | 2 +\n sysdeps/posix/libc_fatal.c | 12 ++++--\n .../powerpc32/power4/multiarch/Makefile | 5 +++\n .../be/multiarch/dl-symbol-redir-ifunc.h | 27 +++++++++++++\n .../le/multiarch/dl-symbol-redir-ifunc.h | 1 +\n sysdeps/powerpc/powerpc64/multiarch/Makefile | 1 +\n sysdeps/s390/Makefile | 5 +++\n .../s390/multiarch/dl-symbol-redir-ifunc.h | 4 ++\n sysdeps/s390/string-bitops.h | 27 +++++++++++++\n .../sparcv9/multiarch/dl-symbol-redir-ifunc.h | 3 ++\n .../sparc64/multiarch/dl-symbol-redir-ifunc.h | 3 ++\n sysdeps/unix/sysv/linux/Makefile | 12 ++++++\n sysdeps/unix/sysv/linux/i386/Makefile | 14 +++++++\n sysdeps/unix/sysv/linux/i386/dl-mmap.c | 36 ++++++++++++++++++\n sysdeps/unix/sysv/linux/i386/dl-mmap.h | 27 +++++++++++++\n sysdeps/unix/sysv/linux/i386/dl-writev.c | 32 ++++++++++++++++\n sysdeps/unix/sysv/linux/i386/dl-writev.h | 15 +++++---\n sysdeps/unix/sysv/linux/i386/raise_direct.c | 26 +++++++++++++\n .../unix/sysv/linux/riscv/multiarch/Makefile | 7 ++++\n .../riscv/multiarch/dl-symbol-redir-ifunc.h | 26 +++++++++++++\n .../x86_64/multiarch/dl-symbol-redir-ifunc.h | 32 ++++++++++++++++\n 30 files changed, 418 insertions(+), 8 deletions(-)\n create mode 100644 elf/tst-assert-startup-static.c\n create mode 100644 sysdeps/generic/dl-mmap.h\n create mode 100644 sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h\n create mode 100644 sysdeps/s390/string-bitops.h\n create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.c\n create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.h\n create mode 100644 sysdeps/unix/sysv/linux/i386/dl-writev.c\n create mode 100644 sysdeps/unix/sysv/linux/i386/raise_direct.c\n create mode 100644 sysdeps/unix/sysv/linux/riscv/multiarch/dl-symbol-redir-ifunc.h", "diff": "diff --git a/assert/Makefile b/assert/Makefile\nindex f6f5eec1af..bb9e473963 100644\n--- a/assert/Makefile\n+++ b/assert/Makefile\n@@ -33,6 +33,11 @@ routines := \\\n assert-perr \\\n # routines\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-__libc_assert_fail.o = $(no-stack-protector)\n+CFLAGS-__libc_assert_fail.op = $(no-stack-protector)\n+\n tests := \\\n test-assert \\\n test-assert-2 \\\ndiff --git a/elf/Makefile b/elf/Makefile\nindex 1a0ed49bc3..d572d19a2f 100644\n--- a/elf/Makefile\n+++ b/elf/Makefile\n@@ -276,6 +276,7 @@ tests-static-normal := \\\n # tests-static-normal\n \n tests-static-internal := \\\n+ tst-assert-startup-static \\\n tst-dl-printf-static \\\n tst-dl_find_object-static \\\n tst-env-setuid-tunables \\\n@@ -287,6 +288,10 @@ tests-static-internal := \\\n tst-tunables-enable_secure \\\n # tests-static-internal\n \n+tests-special += \\\n+ $(objpfx)tst-assert-startup-static.out \\\n+ # tests-special\n+\n CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o\n tst-tls1-static-non-pie-no-pie = yes\n \n@@ -3533,3 +3538,14 @@ $(objpfx)tst-origin.out: tst-origin.sh $(objpfx)tst-origin\n \t$(evaluate-test)\n \n $(objpfx)tst-dlopen-sgid.out: $(objpfx)tst-dlopen-sgid-mod.so\n+\n+CFLAGS-tst-assert-startup-static.c += $(no-stack-protector)\n+LDFLAGS-tst-assert-startup-static = -Wl,-z,muldefs\n+\n+$(objpfx)tst-assert-startup-static.out: $(objpfx)tst-assert-startup-static\n+\t$(test-program-cmd-before-env) \\\n+\t\t$(run-program-env) \\\n+\t\t$< > $@ 2>&1; echo \"status: $$?\" >> $@; \\\n+\tgrep -q 'Fatal glibc error: tst-assert-startup-static' $@ \\\n+\t && grep -q '^status: 134$$' $@; \\\n+\t $(evaluate-test)\ndiff --git a/elf/tst-assert-startup-static.c b/elf/tst-assert-startup-static.c\nnew file mode 100644\nindex 0000000000..da1f157e1d\n--- /dev/null\n+++ b/elf/tst-assert-startup-static.c\n@@ -0,0 +1,38 @@\n+/* Check if assert work during program startup.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#include <stdlib.h>\n+#include <assert.h>\n+\n+/* The __tunables_init is called just before self-relocation and TLS setup,\n+ and the __libc_assert_fail is used internally for assert() calls. */\n+extern _Noreturn __typeof (__assert_fail) __libc_assert_fail;\n+\n+void __tunables_init (char **env)\n+{\n+ /* The test aims to mimic how assert works during process startup, and thus\n+ calling assert will issue __libc_assert (_(...)) which in turn may call\n+ __dcgettext. */\n+ __libc_assert_fail (\"error\", __FILE__, __LINE__, __func__);\n+}\n+\n+int main (int argc, char *argv[])\n+{\n+ /* Fail with a different error code than abort. */\n+ exit (EXIT_FAILURE);\n+}\ndiff --git a/libio/Makefile b/libio/Makefile\nindex 4f4dd9f275..a6e1e434ff 100644\n--- a/libio/Makefile\n+++ b/libio/Makefile\n@@ -181,6 +181,11 @@ endif\n \n CPPFLAGS += $(libio-mtsafe)\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-libc_fatal.o = $(no-stack-protector)\n+CFLAGS-libc_fatal.op = $(no-stack-protector)\n+\n # Support for exception handling.\n CFLAGS-fileops.c += -fexceptions\n CFLAGS-fputc.c += -fexceptions\ndiff --git a/stdlib/Makefile b/stdlib/Makefile\nindex 04596b53b1..8a39121777 100644\n--- a/stdlib/Makefile\n+++ b/stdlib/Makefile\n@@ -528,6 +528,11 @@ generated += \\\n tst-putenvmod.so \\\n # generated\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-abort.o = $(no-stack-protector)\n+CFLAGS-abort.op = $(no-stack-protector)\n+\n CFLAGS-bsearch.c += $(uses-callbacks)\n CFLAGS-qsort.c += $(uses-callbacks)\n CFLAGS-system.c += -fexceptions\ndiff --git a/string/Makefile b/string/Makefile\nindex aa0b0c2f57..969726cccb 100644\n--- a/string/Makefile\n+++ b/string/Makefile\n@@ -287,6 +287,7 @@ CFLAGS-wordcopy.c += $(no-stack-protector)\n CFLAGS-strncmp.c += $(no-stack-protector)\n CFLAGS-memset.c += $(no-stack-protector)\n CFLAGS-strlen.c += $(no-stack-protector)\n+CFLAGS-strchrnul.c += $(no-stack-protector)\n \n ifeq ($(run-built-tests),yes)\n $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out\ndiff --git a/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h\nindex 9f772614bf..a686fd1f92 100644\n--- a/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/aarch64/multiarch/dl-symbol-redir-ifunc.h\n@@ -19,6 +19,7 @@\n #ifndef _DL_IFUNC_GENERIC_H\n #define _DL_IFUNC_GENERIC_H\n \n+asm (\"memcpy = __memcpy_generic\");\n asm (\"memset = __memset_generic\");\n asm (\"strlen = __strlen_generic\");\n \ndiff --git a/sysdeps/aarch64/multiarch/memcpy_generic.S b/sysdeps/aarch64/multiarch/memcpy_generic.S\nindex c6d09081f4..d622268305 100644\n--- a/sysdeps/aarch64/multiarch/memcpy_generic.S\n+++ b/sysdeps/aarch64/multiarch/memcpy_generic.S\n@@ -42,3 +42,7 @@\n #endif\n \n #include \"../memcpy.S\"\n+\n+#if IS_IN (rtld)\n+strong_alias (memcpy, __memcpy_generic)\n+#endif\ndiff --git a/sysdeps/generic/dl-mmap.h b/sysdeps/generic/dl-mmap.h\nnew file mode 100644\nindex 0000000000..f786be0930\n--- /dev/null\n+++ b/sysdeps/generic/dl-mmap.h\n@@ -0,0 +1,34 @@\n+/* mmap wrapper for dynamic loader.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#ifndef _DL_MMAP_H\n+#define _DL_MMAP_H\n+\n+#include <sys/mman.h>\n+\n+/* This mmap call is used to allocate some memory to backup assert() messages\n+ before TLS setup is done (which setup the thread pointer used by some ABIs\n+ to issues syscalls). */\n+\n+static inline void *\n+_dl_mmap (void *addr, size_t len, int prot, int flags)\n+{\n+ return __mmap (addr, len, prot, flags, -1, 0);\n+}\n+\n+#endif\ndiff --git a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h\nindex 8af00d2846..43f50f8bcc 100644\n--- a/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/loongarch/lp64/multiarch/dl-symbol-redir-ifunc.h\n@@ -20,8 +20,10 @@\n #define _DL_IFUNC_GENERIC_H\n \n #ifndef SHARED\n+asm (\"memcpy = __memcpy_aligned\");\n asm (\"memset = __memset_aligned\");\n asm (\"memcmp = __memcmp_aligned\");\n+asm (\"__strchrnul = __strchrnul_aligned\");\n asm (\"strlen = __strlen_aligned\");\n #endif\n \ndiff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c\nindex 3f0e302b5e..1ff20d4feb 100644\n--- a/sysdeps/posix/libc_fatal.c\n+++ b/sysdeps/posix/libc_fatal.c\n@@ -16,7 +16,12 @@\n License along with the GNU C Library; if not, see\n <https://www.gnu.org/licenses/>. */\n \n+/* Mark symbols hidden in static PIE for early self relocation to work. */\n+#if BUILD_PIE_DEFAULT\n+# pragma GCC visibility push(hidden)\n+#endif\n #include <dl-writev.h>\n+#include <dl-mmap.h>\n #include <assert.h>\n #include <ldsodefs.h>\n #include <setvmaname.h>\n@@ -24,6 +29,7 @@\n #include <stdio.h>\n #include <sys/uio.h>\n #include <unistd.h>\n+#include <dl-symbol-redir-ifunc.h>\n \n #ifdef FATAL_PREPARE_INCLUDE\n #include FATAL_PREPARE_INCLUDE\n@@ -113,9 +119,9 @@ __libc_message_impl (const char *vma_name, const char *fmt, ...)\n \n total = ALIGN_UP (total + sizeof (struct abort_msg_s) + 1,\n \t\t\tGLRO(dl_pagesize));\n- struct abort_msg_s *buf = __mmap (NULL, total,\n-\t\t\t\t\tPROT_READ | PROT_WRITE,\n-\t\t\t\t\tMAP_ANON | MAP_PRIVATE, -1, 0);\n+ struct abort_msg_s *buf = _dl_mmap (NULL, total,\n+\t\t\t\t\t PROT_READ | PROT_WRITE,\n+\t\t\t\t\t MAP_ANON | MAP_PRIVATE);\n if (__glibc_likely (buf != MAP_FAILED))\n \t{\n \t buf->size = total;\ndiff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile\nindex 3a49b855ca..60ba2e50d2 100644\n--- a/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile\n+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/Makefile\n@@ -11,4 +11,9 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \\\n \t\t strchr-power7 strchr-ppc32 \\\n \t\t wordcopy-power7 wordcopy-ppc32 \\\n \t\t memmove-power7 memmove-ppc\n+\n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-strchrnul-ppc32.o = $(no-stack-protector)\n+CFLAGS-strchrnul-ppc32.op = $(no-stack-protector)\n endif\ndiff --git a/sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h\nnew file mode 100644\nindex 0000000000..560f57366b\n--- /dev/null\n+++ b/sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h\n@@ -0,0 +1,27 @@\n+/* Symbol rediretion for loader/static initialization code.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#ifndef _DL_IFUNC_GENERIC_H\n+#define _DL_IFUNC_GENERIC_H\n+\n+#ifndef SHARED\n+asm (\"__mempcpy = __mempcpy_ppc\");\n+asm (\"__strchrnul = __strchrnul_ppc\");\n+#endif\n+\n+#endif\ndiff --git a/sysdeps/powerpc/powerpc64/le/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/powerpc/powerpc64/le/multiarch/dl-symbol-redir-ifunc.h\nindex 4680092cd8..03f6f12032 100644\n--- a/sysdeps/powerpc/powerpc64/le/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/powerpc/powerpc64/le/multiarch/dl-symbol-redir-ifunc.h\n@@ -21,5 +21,6 @@\n \n asm (\"memset = __memset_power8\");\n asm (\"__mempcpy = __mempcpy_power7\");\n+asm (\"__strchrnul = __strchrnul_power8\");\n \n #endif\ndiff --git a/sysdeps/powerpc/powerpc64/multiarch/Makefile b/sysdeps/powerpc/powerpc64/multiarch/Makefile\nindex c9178223a8..0437a05a89 100644\n--- a/sysdeps/powerpc/powerpc64/multiarch/Makefile\n+++ b/sysdeps/powerpc/powerpc64/multiarch/Makefile\n@@ -40,3 +40,4 @@ endif\n \n # Called during static initialization\n CFLAGS-strncmp-ppc64.c += $(no-stack-protector)\n+CFLAGS-strchrnul-ppc64.c += $(no-stack-protector)\ndiff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile\nindex 985b4f25ee..078c0d165d 100644\n--- a/sysdeps/s390/Makefile\n+++ b/sysdeps/s390/Makefile\n@@ -104,6 +104,11 @@ routines_no_fortify += \\\n # routines_no_fortify\n endif\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-strchrnul-c.o = $(no-stack-protector)\n+CFLAGS-strchrnul-c.op = $(no-stack-protector)\n+\n ifeq ($(subdir),wcsmbs)\n sysdep_routines += wcslen wcslen-vx wcslen-c \\\n \t\t wcsnlen wcsnlen-vx wcsnlen-c \\\ndiff --git a/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h\nindex a128cd05bd..3721f3d95b 100644\n--- a/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h\n@@ -21,11 +21,15 @@\n \n #include <ifunc-memset.h>\n #include <ifunc-memcmp.h>\n+#include <ifunc-strchrnul.h>\n \n #define IFUNC_SYMBOL_STR1(s)\t#s\n #define IFUNC_SYMBOL_STR(s)\tIFUNC_SYMBOL_STR1(s)\n \n+#ifndef SHARED\n asm (\"memset = \" IFUNC_SYMBOL_STR(MEMSET_DEFAULT));\n asm (\"memcmp = \" IFUNC_SYMBOL_STR(MEMCMP_DEFAULT));\n+asm (\"__strchrnul = \" IFUNC_SYMBOL_STR(STRCHRNUL_DEFAULT));\n+#endif\n \n #endif\ndiff --git a/sysdeps/s390/string-bitops.h b/sysdeps/s390/string-bitops.h\nnew file mode 100644\nindex 0000000000..f660d019c7\n--- /dev/null\n+++ b/sysdeps/s390/string-bitops.h\n@@ -0,0 +1,27 @@\n+/* Zero byte detection, define whether to use stdbit.h\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+/* s390x support static-pie and the libgcc implementation for\n+ __builtin_clzl/__builtin_ctzl might access extern data that is not marked\n+ as hidden, which creates additiona GOT access that is used before\n+ self-relocation. */\n+#if __ARCH__ > 6\n+# define HAVE_BITOPTS_WORKING 1\n+#else\n+# define HAVE_BITOPTS_WORKING 0\n+#endif\ndiff --git a/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-symbol-redir-ifunc.h\nindex ffe1eee87d..1a76efd542 100644\n--- a/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/sparc/sparc32/sparcv9/multiarch/dl-symbol-redir-ifunc.h\n@@ -19,6 +19,9 @@\n #ifndef _DL_IFUNC_GENERIC_H\n #define _DL_IFUNC_GENERIC_H\n \n+#ifndef SHARED\n asm (\"memset = __memset_ultra1\");\n+asm (\"memcpy = __memcpy_ultra1\");\n+#endif\n \n #endif\ndiff --git a/sysdeps/sparc/sparc64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/sparc/sparc64/multiarch/dl-symbol-redir-ifunc.h\nindex ffe1eee87d..1a76efd542 100644\n--- a/sysdeps/sparc/sparc64/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/sparc/sparc64/multiarch/dl-symbol-redir-ifunc.h\n@@ -19,6 +19,9 @@\n #ifndef _DL_IFUNC_GENERIC_H\n #define _DL_IFUNC_GENERIC_H\n \n+#ifndef SHARED\n asm (\"memset = __memset_ultra1\");\n+asm (\"memcpy = __memcpy_ultra1\");\n+#endif\n \n #endif\ndiff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile\nindex 8797c5c9b3..18727605ce 100644\n--- a/sysdeps/unix/sysv/linux/Makefile\n+++ b/sysdeps/unix/sysv/linux/Makefile\n@@ -114,6 +114,11 @@ sysdep_routines += \\\n xstat \\\n xstat64 \\\n # sysdep_routines\n+#\n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-setvmaname.o = $(no-stack-protector)\n+CFLAGS-setvmaname.op = $(no-stack-protector)\n \n CFLAGS-gethostid.c = -fexceptions\n CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables\n@@ -459,6 +464,13 @@ sysdep_routines += \\\n raise_direct \\\n # sysdep_routines\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-raise.o = $(no-stack-protector)\n+CFLAGS-raise.op = $(no-stack-protector)\n+CFLAGS-raise_direct.o = $(no-stack-protector)\n+CFLAGS-raise_direct.op = $(no-stack-protector)\n+\n tests-special += \\\n $(objpfx)tst-signal-numbers.out \\\n # tests-special\ndiff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile\nindex f1f8c3f44c..9a70905df8 100644\n--- a/sysdeps/unix/sysv/linux/i386/Makefile\n+++ b/sysdeps/unix/sysv/linux/i386/Makefile\n@@ -28,3 +28,17 @@ ifeq ($(subdir),rt)\n librt-routines += sysdep\n librt-shared-only-routines += sysdep\n endif\n+\n+ifeq ($(subdir),elf)\n+sysdep_routines += \\\n+ dl-mmap \\\n+ dl-writev \\\n+ # sysdep-routines\n+\n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-dl-mmap.o = $(no-stack-protector)\n+CFLAGS-dl-mmap.op = $(no-stack-protector)\n+CFLAGS-dl-writev.o = $(no-stack-protector)\n+CFLAGS-dl-writev.op = $(no-stack-protector)\n+endif\ndiff --git a/sysdeps/unix/sysv/linux/i386/dl-mmap.c b/sysdeps/unix/sysv/linux/i386/dl-mmap.c\nnew file mode 100644\nindex 0000000000..ab6f96300f\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/i386/dl-mmap.c\n@@ -0,0 +1,36 @@\n+/* mmap wrapper for dynamic loader. Linux/i386 version.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+/* This mmap call is used to allocate some memory to backup assert() messages\n+ before TLS setup is done, so it can not use \"call *%gs:SYSINFO_OFFSET\"\n+ during startup in static PIE. */\n+#if BUILD_PIE_DEFAULT\n+# define I386_USE_SYSENTER 0\n+#endif\n+\n+#include <sys/mman.h>\n+#include <dl-mmap.h>\n+#include <mmap_internal.h>\n+#include <sysdep.h>\n+\n+void *\n+_dl_mmap (void *addr, size_t len, int prot, int flags)\n+{\n+ return (void *) MMAP_CALL (mmap2, addr, len, prot, flags, -1, 0);\n+}\n+\ndiff --git a/sysdeps/unix/sysv/linux/i386/dl-mmap.h b/sysdeps/unix/sysv/linux/i386/dl-mmap.h\nnew file mode 100644\nindex 0000000000..291f92ee14\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/i386/dl-mmap.h\n@@ -0,0 +1,27 @@\n+/* mmap wrapper for dynamic loader.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#ifndef _DL_MMAP_H\n+#define _DL_MMAP_H\n+\n+/* i386 requires out-of-line implementation because it sets\n+ I386_USE_SYSENTER to 0 to avoid use the vDSO. */\n+void * _dl_mmap (void *addr, size_t len, int prot, int flags)\n+ attribute_hidden;\n+\n+#endif\ndiff --git a/sysdeps/unix/sysv/linux/i386/dl-writev.c b/sysdeps/unix/sysv/linux/i386/dl-writev.c\nnew file mode 100644\nindex 0000000000..ef6a6a20b8\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/i386/dl-writev.c\n@@ -0,0 +1,32 @@\n+/* writev wrapper for the dynamic linker. Linux/i386 version.\n+ Copyright (C) 2013-2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+/* This writev call is used to assert() before TLS setup is done, so it can\n+ not use \"call *%gs:SYSINFO_OFFSET\" during startup in static PIE. */\n+#if BUILD_PIE_DEFAULT\n+# define I386_USE_SYSENTER 0\n+#endif\n+\n+#include <dl-writev.h>\n+#include <sysdep.h>\n+\n+ssize_t\n+_dl_writev (int fd, const struct iovec *iov, size_t niov)\n+{\n+ return INTERNAL_SYSCALL_CALL (writev, fd, iov, niov);\n+}\ndiff --git a/sysdeps/unix/sysv/linux/i386/dl-writev.h b/sysdeps/unix/sysv/linux/i386/dl-writev.h\nindex 8327d32374..d92c74d712 100644\n--- a/sysdeps/unix/sysv/linux/i386/dl-writev.h\n+++ b/sysdeps/unix/sysv/linux/i386/dl-writev.h\n@@ -16,9 +16,14 @@\n License along with the GNU C Library; if not, see\n <https://www.gnu.org/licenses/>. */\n \n-#if BUILD_PIE_DEFAULT\n-/* Can't use \"call *%gs:SYSINFO_OFFSET\" during startup in static PIE. */\n-# define I386_USE_SYSENTER 0\n-#endif\n+#ifndef _DL_WRITEV_H\n+#define _DL_WRITEV_H\n \n-#include <sysdeps/unix/sysv/linux/dl-writev.h>\n+#include <sys/uio.h>\n+\n+/* i386 requires out-of-line implementation because it sets\n+ I386_USE_SYSENTER to 0 to avoid use the vDSO. */\n+ssize_t _dl_writev (int fd, const struct iovec *iov, size_t niov)\n+ attribute_hidden;\n+\n+#endif\ndiff --git a/sysdeps/unix/sysv/linux/i386/raise_direct.c b/sysdeps/unix/sysv/linux/i386/raise_direct.c\nnew file mode 100644\nindex 0000000000..b23b8e5386\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/i386/raise_direct.c\n@@ -0,0 +1,26 @@\n+/* Internal function to send a signal to itself. Linux/i386 version.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+/* This is called from abort() (issued by assert()) before TLS setup is done,\n+ so it can not use \"call *%gs:SYSINFO_OFFSET\" during startup in static\n+ PIE. */\n+#if BUILD_PIE_DEFAULT\n+# define I386_USE_SYSENTER 0\n+#endif\n+\n+#include <sysdeps/unix/sysv/linux/raise_direct.c>\ndiff --git a/sysdeps/unix/sysv/linux/riscv/multiarch/Makefile b/sysdeps/unix/sysv/linux/riscv/multiarch/Makefile\nindex a865090a53..484ff77f7d 100644\n--- a/sysdeps/unix/sysv/linux/riscv/multiarch/Makefile\n+++ b/sysdeps/unix/sysv/linux/riscv/multiarch/Makefile\n@@ -8,6 +8,13 @@ sysdep_routines += \\\n memset-vector \\\n # sysdep_routines\n \n+# Called during static library initialization, so turn stack-protection\n+# off for non-shared builds.\n+CFLAGS-memset-generic.o = $(no-stack-protector)\n+CFLAGS-memset-generic.op = $(no-stack-protector)\n+CFLAGS-memcpy-generic.o = $(no-stack-protector)\n+CFLAGS-memcpy-generic.op = $(no-stack-protector)\n+\n CFLAGS-memcpy_noalignment.c += -mno-strict-align\n # Called during static initialization\n CFLAGS-memset-generic.c += $(no-stack-protector)\ndiff --git a/sysdeps/unix/sysv/linux/riscv/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/unix/sysv/linux/riscv/multiarch/dl-symbol-redir-ifunc.h\nnew file mode 100644\nindex 0000000000..4e18eb960f\n--- /dev/null\n+++ b/sysdeps/unix/sysv/linux/riscv/multiarch/dl-symbol-redir-ifunc.h\n@@ -0,0 +1,26 @@\n+/* Symbol rediretion for loader/static initialization code.\n+ Copyright (C) 2026 Free Software Foundation, Inc.\n+ This file is part of the GNU C Library.\n+\n+ The GNU C Library is free software; you can redistribute it and/or\n+ modify it under the terms of the GNU Lesser General Public\n+ License as published by the Free Software Foundation; either\n+ version 2.1 of the License, or (at your option) any later version.\n+\n+ The GNU C Library is distributed in the hope that it will be useful,\n+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ Lesser General Public License for more details.\n+\n+ You should have received a copy of the GNU Lesser General Public\n+ License along with the GNU C Library; if not, see\n+ <https://www.gnu.org/licenses/>. */\n+\n+#ifndef _DL_IFUNC_GENERIC_H\n+#define _DL_IFUNC_GENERIC_H\n+\n+#ifndef SHARED\n+asm (\"memcpy = __memcpy_generic\");\n+#endif\n+\n+#endif\ndiff --git a/sysdeps/x86_64/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/x86_64/multiarch/dl-symbol-redir-ifunc.h\nindex b607e525f2..15968896c0 100644\n--- a/sysdeps/x86_64/multiarch/dl-symbol-redir-ifunc.h\n+++ b/sysdeps/x86_64/multiarch/dl-symbol-redir-ifunc.h\n@@ -54,6 +54,38 @@ asm (\"memcmp = \" HAVE_MEMCMP_IFUNC_GENERIC);\n \n asm (\"strlen = \" HAVE_STRCMP_IFUNC_GENERIC);\n \n+#if MINIMUM_X86_ISA_LEVEL >= 4\n+# define HAVE_MEMPCPY_IFUNC_GENERIC \"__mempcpy_evex_unaligned\"\n+#elif MINIMUM_X86_ISA_LEVEL == 3\n+# define HAVE_MEMPCPY_IFUNC_GENERIC \"__mempcpy_avx_unaligned\"\n+#else\n+# define HAVE_MEMPCPY_IFUNC_GENERIC \"__mempcpy_sse2_unaligned\"\n+#endif\n+\n+asm (\"__mempcpy = \" HAVE_MEMPCPY_IFUNC_GENERIC);\n+\n+\n+#if MINIMUM_X86_ISA_LEVEL >= 4\n+# define HAVE_STRCHRNUL_IFUNC_GENERIC \"__strchrnul_evex\"\n+#elif MINIMUM_X86_ISA_LEVEL == 3\n+# define HAVE_STRCHRNUL_IFUNC_GENERIC \"__strchrnul_avx2\"\n+#else\n+# define HAVE_STRCHRNUL_IFUNC_GENERIC \"__strchrnul_sse2\"\n+#endif\n+\n+asm (\"__strchrnul = \" HAVE_STRCHRNUL_IFUNC_GENERIC);\n+\n+\n+#if MINIMUM_X86_ISA_LEVEL >= 4\n+# define HAVE_STRLEN_IFUNC_GENERIC \"__strlen_evex\"\n+#elif MINIMUM_X86_ISA_LEVEL == 3\n+# define HAVE_STRLEN_IFUNC_GENERIC \"__strlen_avx2\"\n+#else\n+# define HAVE_STRLEN_IFUNC_GENERIC \"__strlen_sse2\"\n+#endif\n+\n+asm (\"strlen = \" HAVE_STRLEN_IFUNC_GENERIC);\n+\n #endif /* SHARED */\n \n #endif\n", "prefixes": [ "v7", "4/5" ] }