diff options
author | Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> | 2022-07-07 18:12:58 -0300 |
---|---|---|
committer | Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> | 2022-07-14 16:01:14 -0300 |
commit | d0fa09a7701956036ff36f8ca188e9fff81553d8 (patch) | |
tree | 26e7f93e4d5bd5a291ee139cced70688751d2c03 /libio/stdio.h | |
parent | 779aa039fc4151bdc0d79ef2e141604863856a60 (diff) | |
download | glibc-d0fa09a7701956036ff36f8ca188e9fff81553d8.zip glibc-d0fa09a7701956036ff36f8ca188e9fff81553d8.tar.gz glibc-d0fa09a7701956036ff36f8ca188e9fff81553d8.tar.bz2 |
Apply asm redirections in stdio.h before first use [BZ #27087]
Compilers may not be able to apply asm redirections to functions after
these functions are used for the first time, e.g. clang 13.
Fix [BZ #27087] by applying all long double-related asm redirections
before using functions in bits/stdio.h.
However, as these asm redirections depend on the declarations provided
by libio/bits/stdio2.h, this header was split in 2:
- libio/bits/stdio2-decl.h contains all function declarations;
- libio/bits/stdio2.h remains with the remaining contents, including
redirections.
This also adds the access attribute to __vsnprintf_chk that was missing.
Tested with build-many-glibcs.py.
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
Diffstat (limited to 'libio/stdio.h')
-rw-r--r-- | libio/stdio.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libio/stdio.h b/libio/stdio.h index e642534..0e0f16b 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -885,20 +885,27 @@ extern void funlockfile (FILE *__stream) __THROW; extern int __uflow (FILE *); extern int __overflow (FILE *, int); +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Declare all functions from bits/stdio2-decl.h first. */ +# include <bits/stdio2-decl.h> +#endif + +/* The following headers provide asm redirections. These redirections must + appear before the first usage of these functions, e.g. in bits/stdio.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 # include <bits/stdio.h> #endif #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Now include the function definitions and redirects too. */ # 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. */ |