]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Enable --enable-fortify-source with clang
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 8 Feb 2024 13:56:30 +0000 (10:56 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 28 Oct 2025 16:54:52 +0000 (13:54 -0300)
clang generates internal calls for some _chk symbol, so add internal
aliases for them, and stub some with rtld-stubbed-symbols to avoid
ld.so linker issues.

sysdeps/generic/symbol-hacks.h

index cd5589db9da44a197cea1422c9cf2c3a97939c47..6d8289c002ceae8f7cae4c477f54e89ba760ab5f 100644 (file)
@@ -30,6 +30,21 @@ asm ("strcat = __GI_strcat");
 asm ("abort = __GI_abort");
 #endif
 
+/* clang might generate the internal fortfify calls when it is enabled,
+   through the buitintin.  */
+asm ("__vfprintf_chk = __GI___vfprintf_chk");
+asm ("__vsprintf_chk = __GI___vsprintf_chk");
+asm ("__vsyslog_chk = __GI___vsyslog_chk");
+asm ("__memcpy_chk = __GI___memcpy_chk");
+asm ("__memmove_chk = __GI___memmove_chk");
+asm ("__memset_chk = __GI___memset_chk");
+asm ("__mempcpy_chk = __GI___mempcpy_chk");
+asm ("__stpcpy_chk = __GI___stpcpy_chk");
+asm ("__strcpy_chk = __GI___strcpy_chk");
+asm ("strcpy = __GI_strcpy");
+asm ("strncpy = __GI_strncpy");
+asm ("strcat = __GI_strcat");
+
 /* Some targets do not use __stack_chk_fail_local.  In libc.so,
    redirect __stack_chk_fail to a hidden reference
    __stack_chk_fail_local, to avoid the PLT reference.