From f864345521176c30d7e54fbc0f29dff8a9962305 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Wed, 28 Oct 2020 14:30:53 +0800 Subject: [PATCH] Fix gcc10 -fno-common compile issue until upstream fixes this change has given better compatible with gcc10 toolchain, should be maintained util upstream fixes 'multiple definition ...' warnings Default to -fno-common A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. If tentative definitions of particular variables need to be placed in a common block, __attribute__((__common__)) can be used to force that behavior even in code compiled without -fcommon. As a workaround, legacy C code where all tentative definitions should be placed into a common block can be compiled with -fcommon. int x; // tentative definition - avoid in header files extern int y; // correct declaration in a header file refer url: https://gcc.gnu.org/gcc-10/porting_to.html Signed-off-by: Liwei Ge Signed-off-by: weitao zhou --- rpm.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpm.spec b/rpm.spec index a6dd2c3..ba1afd6 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,4 +1,5 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 +%define _legacy_common_support 1 # build against xz? %bcond_without xz # just for giggles, option to build with internal Berkeley DB @@ -690,6 +691,9 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog +* Thu Jan 20 2022 Weitao Zhou - 4.14.3-19.0.2 +- Fix gcc10 -fno-common compile issue for compatible with gcc10 build + * Wed Dec 15 2021 zhangbinchen - 4.14.3-19.0.1 - Rebrand for Anolis OS -- Gitee