[09/21] asprintf_chk: Ensure compatibility for both s390x and ppc64le
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
If ldbl_* macros are used for asprintf, ABI gets broken on s390x,
if it isn't, ppc64le isn't building due to multiple asm redirections.
This is due to the inclusion of bits/stdio-lbdl.h for ppc64le whereas it
isn't for s390x. This header creates redirections, which are not
compatible with the ones generated using libc_hidden_builtin_def.
Yet, we can't use libc_hidden_ldbl_proto on s390x since it will not
create a simple strong alias (e.g. as done on x86_64), but a versioned
alias, leading to ABI breakage.
---
debug/asprintf_chk.c | 12 ++++++++++++
include/stdio.h | 5 +++++
2 files changed, 17 insertions(+)
@@ -36,5 +36,17 @@ ___asprintf_chk (char **result_ptr, int flag, const char *format, ...)
return ret;
}
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+/* This is needed since <bits/stdio-lbdl.h> is included in this case, leading to
+ * multiple asm redirection of the same symbol
+ */
ldbl_hidden_def (___asprintf_chk, __asprintf_chk)
ldbl_strong_alias (___asprintf_chk, __asprintf_chk)
+#else
+/* Yet, we can't use ldbl_* macros on some systems, even if they don't fall in
+ * the first case as this leads to ABI breakage due to the long_double_symbol
+ * aliasing, which is versionned.
+ */
+strong_alias (___asprintf_chk, __asprintf_chk)
+libc_hidden_builtin_def (__asprintf_chk)
+#endif
@@ -279,7 +279,12 @@ rtld_hidden_proto (__libc_fatal)
libc_hidden_proto (__fgets_unlocked_chk)
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
libc_hidden_ldbl_proto (__asprintf_chk)
+#else
+libc_hidden_proto (__asprintf_chk)
+#endif
+
libc_hidden_ldbl_proto (__fprintf_chk)
libc_hidden_ldbl_proto (__sprintf_chk)
libc_hidden_ldbl_proto (__vsprintf_chk)