Bug 17480

Summary: Failed to create shared library on Windows with __attribute__((__dllexport__, weak))
Product: binutils Reporter: Antony Polukhin <antoshkka>
Component: ldAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 2.23   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Antony Polukhin 2014-10-13 17:25:17 UTC
Compiling the following 1 line program:

    __attribute__((__dllexport__, weak)) void* p = 0;

with the following command:

    g++ -shared ld_test.c -LD:\mingw64\lib

produces error:

    Cannot export p: symbol wrong type (2 vs 3)
    collect2.exe: error: ld returned 1 exit status


Mixing same attributes on Windows+MSVC and Clang+Linux, GCC+Linux work well.