[klibc] [PATCH v2 4/5] Kbuild: Add "-fcommon" for clang builds

Bill Wendling morbo at google.com
Fri Mar 27 15:29:45 PDT 2020


Clang defaults to "-fno-common" which causes linking errors because of
duplicate symbols in the BSS section.

Signed-off-by: Bill Wendling <morbo at google.com>
---
 usr/klibc/arch/x86_64/MCONFIG | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/klibc/arch/x86_64/MCONFIG b/usr/klibc/arch/x86_64/MCONFIG
index a6ba7c85c68b..46d29985bfd6 100644
--- a/usr/klibc/arch/x86_64/MCONFIG
+++ b/usr/klibc/arch/x86_64/MCONFIG
@@ -27,7 +27,7 @@ ifneq ($(cc-name),clang)
 # so we can't use a cc-option test to filter them.
 KLIBCOPTFLAGS     += -falign-functions=1 -falign-jumps=1 -falign-loops=1
 else
-KLIBCOPTFLAGS     += -fno-builtin-bcmp
+KLIBCOPTFLAGS     += -fno-builtin-bcmp -fcommon
 endif
 
 KLIBCBITSIZE      = 64
-- 
2.26.0.rc2.310.g2932bb562d-goog



More information about the klibc mailing list