bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/29376] New: multiple definition of weak symbols on MinGW toolcha


From: bmeng.cn at gmail dot com
Subject: [Bug ld/29376] New: multiple definition of weak symbols on MinGW toolchain
Date: Mon, 18 Jul 2022 14:08:18 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=29376

            Bug ID: 29376
           Summary: multiple definition of weak symbols on MinGW toolchain
           Product: binutils
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: bmeng.cn at gmail dot com
  Target Milestone: ---

Created attachment 14216
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14216&action=edit
a simplified case to show the linker problem of handling weak symbols for
Windows

Please use the attached test case to reproduce.

Using MinGW toolchain the test case fails to build:

$ CC=x86_64-w64-mingw32-gcc make
x86_64-w64-mingw32-gcc    -c -o a.o a.c
x86_64-w64-mingw32-gcc    -c -o b.o b.c
x86_64-w64-mingw32-gcc     main.c a.o b.o   -o main
/usr/lib/gcc/x86_64-w64-mingw32/11.2.1/../../../../x86_64-w64-mingw32/bin/ld:
b.o:b.c:(.bss+0x0): multiple definition of `.weak.weak.'; a.o:a.c:(.bss+0x0):
first defined here
collect2: error: ld returned 1 exit status
make: *** [<builtin>: main] Error 1

The native Linux GCC toolchain builds successfully:

$ CC=gcc make
gcc    -c -o a.o a.c
gcc    -c -o b.o b.c
gcc     main.c a.o b.o   -o main

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]