[klibc] [PATCH] Kbuild for klibc and nfsmount: add -fcommon

Christophe Leroy christophe.leroy at csgroup.eu
Wed Jun 17 07:49:12 PDT 2020


-fcommon is not default anymore, with GCC 10 you get the following
failure without it:

  KLIBCLD usr/klibc/libc.so
ppc-linux-ld: usr/klibc/globals.o:/root/packages/klibc-2.0.7/usr/klibc/../include/unistd.h:15: multiple definition of `environ'; usr/klibc/__shared_init.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/libc_init.c:42: first defined here
ppc-linux-ld: usr/klibc/sbrk.o:(.sbss+0x0): multiple definition of `__current_brk'; usr/klibc/brk.o:(.sbss+0x0): first defined here
ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x8): multiple definition of `optind'; usr/klibc/getopt.o:(.sbss+0x8): first defined here
ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0xc): multiple definition of `optarg'; usr/klibc/getopt.o:(.sbss+0xc): first defined here
ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x0): multiple definition of `optopt'; usr/klibc/getopt.o:(.sbss+0x0): first defined here
ppc-linux-ld: usr/klibc/getopt_long.o:(.sbss+0x4): multiple definition of `opterr'; usr/klibc/getopt.o:(.sbss+0x4): first defined here
ppc-linux-ld: usr/klibc/mrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/mrand48.c:8: multiple definition of `__rand48_seed'; usr/klibc/lrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/lrand48.c:8: first defined here
ppc-linux-ld: usr/klibc/srand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/srand48.c:8: multiple definition of `__rand48_seed'; usr/klibc/lrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/lrand48.c:8: first defined here
ppc-linux-ld: usr/klibc/seed48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/seed48.c:9: multiple definition of `__rand48_seed'; usr/klibc/lrand48.o:/root/ldb_base/ofl/packages/klibc-2.0.7/usr/klibc/lrand48.c:8: first defined here
make[2]: *** [usr/klibc/libc.so] Error 1

Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
---
 usr/kinit/nfsmount/Kbuild | 1 +
 usr/klibc/Kbuild          | 1 +
 2 files changed, 2 insertions(+)

diff --git a/usr/kinit/nfsmount/Kbuild b/usr/kinit/nfsmount/Kbuild
index 5f349500bf2d..83af8a253510 100644
--- a/usr/kinit/nfsmount/Kbuild
+++ b/usr/kinit/nfsmount/Kbuild
@@ -1,6 +1,7 @@
 #
 # kbuild file for nfsmount
 #
+EXTRA_KLIBCCFLAGS = -fcommon
 
 static-y := static/nfsmount
 #FIXME - build is broken static-y := dummypmap
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index 24bad07da14e..71b7582811a5 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -1,6 +1,7 @@
 #
 # Kbuild file for klibc
 #
+EXTRA_KLIBCCFLAGS = -fcommon
 
 # Tell that we are building klibc
 export klibc-build := y
-- 
2.25.0



More information about the klibc mailing list