'Cygwin: why POSIX symbols in libc.a are strong symbols?

On Cygwin POSIX symbols in libc.a are strong symbols (e.g. accept):

$ nm /usr/lib/libc.a | grep 'accept' -w
0000000000000000 T accept

while on Linux they are weak symbols (e.g. accept):

$ nm /usr/lib/x86_64-linux-gnu/libc.a |& grep 'accept' -w
accept.o:
0000000000000000 W accept
                 U accept
                 U accept
                 U accept
                 U accept

Note: having POSIX symbols in libc.a may be a bit unexpected.

However, why in Cygwin's libc.a POSIX symbols are strong symbols?

Example: If user has mylib.a containing the definition of accept and the mylib.a goes after the libc.a in the list of command line arguments, then the accept from the libc.a may be (and usually is) selected.


UPD. https://stackoverflow.com/a/2290838/1778275:

MSVC++ has __declspec(selectany) which covers part of the functionality of weak symbols.



Solution 1:[1]

https://en.wikipedia.org/wiki/Weak_symbol

Weak Symbol are not available on COFF PE binary. It is also one of the reason why all symbols must be defined at compilation time.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 matzeri