From 3300f1534a8b2c2f8b185ee2aa0847605f4e3dd8 Mon Sep 17 00:00:00 2001 From: liqingqing_1229 Date: Wed, 6 Jul 2022 15:18:20 +0800 Subject: [PATCH] enable -werror by default --- ...ompile-error-with-Werror-and-DNDEBUG.patch | 36 +++++++++++++++++++ glibc.spec | 8 +++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch diff --git a/elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch b/elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch new file mode 100644 index 0000000..dcfa41f --- /dev/null +++ b/elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch @@ -0,0 +1,36 @@ +From 5e89ed42fd8997414732525c9460878d65363b3f Mon Sep 17 00:00:00 2001 +From: Yang Yanchao +Date: Fri, 15 Apr 2022 17:25:05 +0800 +Subject: [PATCH] elf: Fix compile error with -Werror and -DNDEBUG + +Using -Werror and -DNDEBUG at the same time will trigger the +following compiler error: + +cache.c: In function 'save_cache': +cache.c:758:15: error: unused variable 'old_offset' [-Werror=unused-variable] + 758 | off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET); + | ^~~~~~~~~~ + +-DNDEBUG disables the assertion, making old_offset unused. +Use __attribute__ ((unused)) to disable this warning. +--- + elf/cache.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/elf/cache.c b/elf/cache.c +index abe2e49..3d7d3a6 100644 +--- a/elf/cache.c ++++ b/elf/cache.c +@@ -727,7 +727,8 @@ save_cache (const char *cache_name) + if (opt_format != opt_format_old) + { + /* Align file position to 4. */ +- off64_t old_offset = lseek64 (fd, extension_offset, SEEK_SET); ++ __attribute__ ((unused)) off64_t old_offset ++ = lseek64 (fd, extension_offset, SEEK_SET); + assert ((unsigned long long int) (extension_offset - old_offset) < 4); + write_extensions (fd, str_offset, extension_offset); + } +-- +1.8.3.1 + diff --git a/glibc.spec b/glibc.spec index 7feb28f..e9a741b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -30,7 +30,7 @@ %bcond_without testsuite %bcond_with benchtests %bcond_with bootstrap -%bcond_with werror +%bcond_without werror %bcond_without docs %ifarch x86_64 aarch64 %bcond_without compat_2_17 @@ -66,7 +66,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 89 +Release: 90 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -225,6 +225,7 @@ Patch137: realpath-Avoid-overwriting-preexisting-error-CVE-2021-3998.patch Patch138: Linux-Avoid-closing-1-on-failure-in-__closefrom_fall.patch Patch139: Fix-deadlock-when-pthread_atfork-handler-calls-pthre.patch Patch140: linux-Fix-mq_timereceive-check-for-32-bit-fallback-c.patch +Patch141: elf-Fix-compile-error-with-Werror-and-DNDEBUG.patch Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch @@ -1400,6 +1401,9 @@ fi %endif %changelog +* Wed Jul 6 2022 Qingqing Li - 2.34-90 +- enable -werror by default + * Fri Jul 1 2022 Qingqing Li - 2.34-89 - Fix mq_timereceive check for 32 bit fallback code (BZ 29304)