Possible bug in binutils for MinGW-w64 related to linking weak symbols

Jan Beulich jbeulich@suse.com
Thu Mar 19 13:54:06 GMT 2026


On 19.03.2026 14:48, Eric Botcazou wrote:
>> We had that discussion on the mingw list already, but in my opinion
>> both foo and bar are properly defined, so not being able to link foo
>> looks like a bug to me. It works with clang/llvm.
> 
> __attribute__((weak))__ is a GNU extension so the GNU toolchain is the de 
> facto reference implementation for it.  Requiring that the attribute be used 
> consistently on all the declarations seems fairly reasonable to me.

As you say "on all the" - if the declaration has it, and if the file
defining the symbol properly includes the respective header, there
shouldn't be a need to repeat the attribute on the definition. (And
there generally better wouldn't be multiple declarations.)

Jan


More information about the Binutils mailing list