Previously, if a weak undefined symbol cannot be resolved within
an output of the linker, mold turned it into an absolute symbol
with value 0. However, other linkers export such symbols as a
weak dynamic symbol, so that the symbol gets another chance to be
resolved at runtime.
This patch implements the behavior.
This is needed by Gentoo's dev-libs/nsync-1.20.1 package.
This is needed by Gentoo's dev-lang/spidermonkey-78.10.1 package,
as its configure script assumes that the linker exit normally
even if extra options are given after `--version`.
We should not set STT_GNU_IFUNC to symbols in .dynsym because
from the other ELF module's point of view, it doens't matter
whether a symbol is IFUNC or not.
This is needed by Gentoo's sci-mathematics/nauty-2.6.7 package.
mmap(2) fails if you pass 0 as an argument for `length` parameter,
so this case has to be handled as a special case.
This is needed by Gentoo's media-plugins/calf-0.90.3-r1 package.
In other words, a linker shouldn't pull out an object file from an
archive to resolve an existing undefined or a common symbol with a
common symbol.
This is needed by Gentoo's app-arch/dump-0.4.47 package.
This is not logically correct, because PC-relative offsets
make sense only against allocated sections. However,
this is needed by Gentoo's dev-lang/gnat-gpl-2018-r3 package.
Previously, we turned unresolved undefined symbols into dynamic
symbols. This patch changed the behavior so that such symbols
are turned into non-dynamic absolute symbols with value zero.
This change is needed by Gentoo's dev-libs/wayland-protocols-1.21
package.
If an object file in an static archive contains a common symbol
that can be used to resolve an undefined symbol, mold now pulls
out that object file from the archive. Previously, we ignore such
common symbols.
Object files generated by a Fortran compiler often contain a lot of
common symbols, and this change makes a difference.
Fixes Gentoo's sci-astronomy/wcslib-7.3 package, which contains a
program written in Fortran.