This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: multiple definition of symbols" when linking executables on ARM32 and AArch64


On Mon, Jan 6, 2020 at 1:52 AM Matthias Klose <> wrote:
> In an archive test rebuild with binutils and GCC trunk, I see a lot of build
> failures on both aarch64-linux-gnu and arm-linux-gnueabihf failing with
> "multiple definition of symbols" when linking executables, e.g.

GCC changed the default to -fno-common.
It seems like for some reason, your non-aarch64/arm builds had changed
the default back to being with -fcommon turned on.
The error message is clear too that there packages out there that
depends on common symbols in C.

Andrew Pinski

> arm-linux-gnueabihf-gcc  tftp.o main.o ../common/libcommon.a
> /<<BUILDDIR>>/tftp-hpa-5.2+20150808/lib/libxtra.a  -o tftp
> /usr/bin/ld: main.o:/<<BUILDDIR>>/tftp-hpa-5.2+20150808/tftp/main.c:98: multiple
> definition of `toplevel';
> tftp.o:/<<BUILDDIR>>/tftp-hpa-5.2+20150808/tftp/tftp.c:51: first defined here
> collect2: error: ld returned 1 exit status
> make[2]: *** [Makefile:12: tftp] Error 1
> gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -o mail version.o aux.o
> cmd1.o cmd2.o cmd3.o cmdtab.o collect.o edit.o fio.o getname.o head.o v7.local.o
> lex.o list.o main.o names.o popen.o quit.o send.o strings.o temp.o tty.o vars.o
> -llockfile -lbsd
> /usr/bin/ld: cmd1.o:./glob.h:77: multiple definition of `screenheight';
> aux.o:./glob.h:77: first defined here
> /usr/bin/ld: cmd1.o:./glob.h:66: multiple definition of `message';
> aux.o:./glob.h:66: first defined here
> /usr/bin/ld: cmd1.o:./glob.h:65: multiple definition of `dot';
> aux.o:./glob.h:65: first defined here
> /usr/bin/ld: cmd1.o:./glob.h:57: multiple definition of `myname';
> aux.o:./glob.h:57: first defined here
> /usr/bin/ld: cmd1.o:./glob.h:74: multiple definition of `altnames';
> aux.o:./glob.h:74: first defined here
> The compiler defaults to the usual hardening settings, PIE, stack-protector,
> stack-collision, etc.  The failures are not seen on x86, powerpc64le, s390x.
> Matthias

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]