From a27663f2886cf8d088c3ac248406cacd046fa2bc Mon Sep 17 00:00:00 2001 From: liqingqing_1229 Date: Wed, 6 Jul 2022 15:32:10 +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 d075d32..d6b1f84 100644 --- a/glibc.spec +++ b/glibc.spec @@ -29,7 +29,7 @@ %bcond_without testsuite %bcond_with benchtests %bcond_with bootstrap -%bcond_with werror +%bcond_without werror %bcond_without docs %ifarch x86_64 aarch64 %bcond_with compat_2_17 @@ -65,7 +65,7 @@ ############################################################################## Name: glibc Version: 2.35 -Release: 14 +Release: 15 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -84,6 +84,7 @@ Source8: testsuite_whitelist.%{_target_cpu} %endif Patch0: glibc-1070416.patch +Patch1: 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 @@ -1257,6 +1258,9 @@ fi %endif %changelog +* Wed Jul 7 2022 Qingqing Li - 2.35-15 +- enable -werror by default + * Tue Jul 5 2022 Yang Yanchao - 2.35-14 - add libpthread_nonshared.a in glibc-compat-2.17 for old applications