[PATCH v1] ldbl-128ibm-compat: Add local aliases for printf family symbols

Sachin Monga smonga@linux.ibm.com
Tue Dec 16 16:07:59 GMT 2025


When the compiler selects IEEE-128 long double ABI(-mabi=ieeelongdouble),
calls to printf, fprintf, sprintf and snprintf are redirected to the
__printfieee128, __fprintfieee128, __sprintfieee128 and __snprintfieee128
symbols respectively.  This causes "break printf" (and others) in
GDB to fail because the original symbol names do not exist as global
symbols in libc.so.6.

Fix this by adding local symbol aliases in the ieee128 compatibility
files so that the original symbol names are present in the symbol table
again.  This restores the expected GDB behavior ("break printf" works)
without requiring dynamic symbols or versioned compatibility symbols.

Thanks to Adhemerval Zanella Netto for proposing this solution.

Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
---
This patch is reg tested.
 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c  | 1 +
 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c   | 1 +
 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c | 1 +
 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c  | 1 +
 4 files changed, 4 insertions(+)

diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
index f9a5213b37..1f9e91c140 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-fprintf.c
@@ -33,3 +33,4 @@ ___ieee128_fprintf (FILE *fp, const char *format, ...)
 }
 strong_alias (___ieee128_fprintf, __fprintfieee128)
 hidden_def (___ieee128_fprintf)
+asm (".local fprintf\n" ".set fprintf, __fprintfieee128");
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
index 7b1640ceac..44b49c600c 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-printf.c
@@ -33,3 +33,4 @@ ___ieee128_printf (const char *format, ...)
   return done;
 }
 strong_alias (___ieee128_printf, __printfieee128)
+asm (".local printf\n" ".set printf, __printfieee128");
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
index f880a55e0b..8522b2d4fa 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-snprintf.c
@@ -37,3 +37,4 @@ ldbl_hidden_def (___ieee128_snprintf, ___ieee128_snprintf)
 #ifdef SHARED
 strong_alias (___ieee128_snprintf, __GI____ieee128___snprintf)
 #endif
+asm (".local snprintf\n" ".set snprintf, __snprintfieee128");
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
index 00651862a5..86aff75260 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-sprintf.c
@@ -34,3 +34,4 @@ ___ieee128_sprintf (char *s, const char *format, ...)
 }
 strong_alias (___ieee128_sprintf, __sprintfieee128)
 hidden_def (___ieee128_sprintf)
+asm (".local sprintf\n" ".set sprintf, __sprintfieee128");
-- 
2.47.3



More information about the Libc-alpha mailing list