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.
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.
This change is needed to build Gentoo's dev-lang/gprolog-1.4.5,
which is the GNU Forth package. GNU Forth creates ELF objects
itself, and it still uses .ctors and .dtors as opposed to .init_array
and .fini_array.
Previously, mold couldn't handle an object file which contains
versioned symbol `foo@@SOME_VERSION` that also has an undefined
symbol `foo`. Now, `foo` is resolved to `foo@@SOME_VERSION`.
This change is required to build Gentoo's media-libs/alsa-lib-1.2.3.2-r1
package.