This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Mixing GNU C89 extern inline and C++ inline on Cygwin?
Jonathan Lennox <lennox@cs.columbia.edu> writes:
> Brian Dessent wrote:
> > Jonathan Lennox wrote:
> > > When optimization is turned on, and thus inline functions are actually
> > > inlined, everything works fine. However, on Cygwin, when functions are not
> > > inlined, I get link-time errors: the weak symbol emitted for the C++ code
> > > conflicts with the backup definition. (This problem does not occur on
> > > ELF-based systems, tested on GNU/Linux (RHEL 4) and Solaris 8.)
> > >
> > > Is this a gcc bug?
>
> > No, I think it's just a fact of life that PE/COFF has no concept of weak
> > symbol visibility in the way that ELF does. You may be able to find
> > more details on this in the binutils mailing list archives, but I think
> > it's a fundamental restriction of Windows. There might be a different
> > kind of workaround involving dllexport-type trickery, but I don't know.
>
> How does collect2 link multiply-defined C++ symbols on PE/COFF? Is there a
> way to "manually" mark symbols in the same way from C code?
Actually, PE/COFF does support weak symbols. They are recorded using
storage class C_NT_WEAK == 105. They should be fully supported by the
GNU binutils used on cygwin. The symbols should be reported as weak
when using nm or objdump -t on the .o file.
I don't know what is causing the problem here, but it's not the lack
of weak symbols.
Ian