Make `--no-undefined-version` a hard error
In lld this is flagged as an error, and the default recently changed in https://reviews.llvm.org/D135402.
In comparison, mold's current behavior is a warning:
--undefined-version, --no-undefined-version: By default, mold warns on a symbol specified by a version script or by --export-dynamic-symbol if it is not defined. You can silence the warning by --undefined-version.
I've now seen several issues in projects where people think using mold instead of lld "fixes" their issue, when its actually just that mold's warnings are easier to overlook than a hard error. (e.g. https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8437 and https://github.com/llvm/llvm-project/issues/60859)
Down the line this then manifests in issues where users suddenly have issues with e.g. LTO and don't know what's causing it.
I think it might be a good idea to also make --no-undefined-version violations a hard error in mold so that users don't get confused. Forcing people to fix their linker scripts seems like the right way to go.
cc @MaskRay
Source: rui314/mold