In GNU ld and ld.lld, -dc is used with -r to allocate space to COMMON symbols.
It is presumably to work around legacy code which cannot handle COMMON symbols
in relocatable output. -dc is not needed if -fno-common is used.
The original -dc comment is wrong. By using -dc -r, two relocatable output may
have duplicate STB_GLOBAL definitions which will lead to a duplicate definition
error in the final link. By keeping COMMON symbols in the relocatable output,
one can actually link the pieces together without an error.
See https://maskray.me/blog/2022-02-06-all-about-common-symbols for detail.
ld.lld may remove -dc or make it a no-op for the 15.0.0 release.
---
Hope that someone tests this for me.
Note: -nostdlib can be removed if FreeBSD Clang picks https://reviews.llvm.org/D117388