[ELF] --fortran-common: prefer STB_WEAK to COMMON
authorFangrui Song <i@maskray.me>
Wed, 14 Jul 2021 17:18:30 +0000 (10:18 -0700)
committerFangrui Song <i@maskray.me>
Wed, 14 Jul 2021 17:18:30 +0000 (10:18 -0700)
commit7de2173c2a4c45711831cfee3ccf53690c76ff07
tree70b23340352cbc59297f7b444590fc57a70915a3
parent338314f9c26d4594d49fdd3a7656d71c77255c54
[ELF] --fortran-common: prefer STB_WEAK to COMMON

The ELF specification says "The link editor honors the common definition and
ignores the weak ones." GNU ld and our Symbol::compare follow this, but the
--fortran-common code (D86142) made a mistake on the precedence.

Fixes https://bugs.llvm.org/show_bug.cgi?id=51082

Reviewed By: peter.smith, sfertile

Differential Revision: https://reviews.llvm.org/D105945
lld/ELF/InputFiles.cpp
lld/test/ELF/common-archive-lookup.s