diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2019-01-03 15:51:37 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2019-01-08 21:06:25 +0100 |
commit | 198bfee8085fcc63d6401fec0c542b62aea711a5 (patch) | |
tree | 8bd8d60478b61c67a09c58f496a8571afba0ade7 /NEWS | |
parent | 1e5c5303a522764d7e9d2302a60e4a32cdb902f1 (diff) | |
download | glibc-198bfee8085fcc63d6401fec0c542b62aea711a5.tar.gz |
Only build libm with -fno-math-errno (bug 24024)
Commit 1294b1892e ("Add support for sqrt asm redirects") added the
-fno-math-errno flag to build most of the glibc in order to enable GCC
to inline math functions. Due to GCC bug #88576, saving and restoring
errno around calls to malloc are optimized-out. In turn this causes
strerror to set errno to ENOMEM if it get passed an invalid error number
and if malloc sets errno to ENOMEM (which might happen even if it
succeeds). This is not allowed by POSIX.
This patch changes the build flags, building only libm with
-fno-math-errno and all the remaining code with -fno-math-errno. This
should be safe as libm doesn't contain any code saving and restoring
errno around malloc. This patch can probably be reverted once the GCC
bug is fixed and available in stable releases.
Tested on x86-64, no regression in the testsuite.
Changelog:
[BZ #24024]
* Makeconfig: Build libm with -fno-math-errno but build the remaining
code with -fmath-errno.
* string/Makefile [$(build-shared)] (tests): Add test-strerror-errno.
[$(build-shared)] (LDLIBS-test-strerror-errno): New variable.
* string/test-strerror-errno.c: New file.
(cherry picked from commit 2ef427168818ce04b03cecb7b739f9db0156e3e4)
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -31,6 +31,7 @@ The following bugs are resolved with this release: [23972] __old_getdents64 uses wrong d_off value on overflow [24018] gettext may return NULL [24022] riscv may lack <asm/syscalls.h> + [24024] strerror() might set errno to ENOMEM due to -fno-math-error [24027] malloc: Integer overflow in realloc [24034] tst-cancel21-static fails with SIGBUS on pre-ARMv7 when using GCC 8 |