[PATCH] stdio: Move include of bits/stdio-ldbl.h before bits/stdio.h

John Paul Adrian Glaubitz glaubitz@physik.fu-berlin.de
Mon Mar 22 11:15:31 GMT 2021


On targets where long double math is optional and the architecture
does not support support long double, glibc defines a number of
redirection macros which alias "foo" with "__nldbl_foo" while
applying an __asm__ label.

As a result, the __asm__ label gets applied after vfprintf() has
already been used which is not allowed. Moving bits/stdio-ldbl.h
bits/stdio.h in libio/stdio.h avoids this problem.

Fixes bug 27558.
---
 libio/stdio.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libio/stdio.h b/libio/stdio.h
index 144137cf67..ae5337e855 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -857,6 +857,11 @@ extern void funlockfile (FILE *__stream) __THROW;
 extern int __uflow (FILE *);
 extern int __overflow (FILE *, int);
 
+#include <bits/floatn.h>
+#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
+# include <bits/stdio-ldbl.h>
+#endif
+
 /* If we are compiling with optimizing read this file.  It contains
    several optimizing inline functions and macros.  */
 #ifdef __USE_EXTERN_INLINES
@@ -866,11 +871,6 @@ extern int __overflow (FILE *, int);
 # include <bits/stdio2.h>
 #endif
 
-#include <bits/floatn.h>
-#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
-# include <bits/stdio-ldbl.h>
-#endif
-
 __END_DECLS
 
 #endif /* <stdio.h> included.  */
-- 
2.31.0



More information about the Libc-alpha mailing list