Re: Migrating to LLVM binutils tools (ar, nm, addr2line, etc.)

From: Ed Maste <emaste_at_freebsd.org>
Date: Mon, 24 Apr 2023 18:19:01 UTC
On Tue, 11 Apr 2023 at 09:21, Ed Maste <emaste@freebsd.org> wrote:
>
> > - Iterate on exp-runs and call for testing
>
> The exp-run is open in 258872. Perl initially failed to build, which
> caused thousands of ports to be skipped. That issue was fixed by markj
> in 27f35b7dd418.

TCL and PostgreSQL are the next two ports that cause a significant
number of skipped dependencies. Both failures are due to the use of
"strip -x" against an archive (or static library). Strip -x is used to
strip all non-global symbols, but in both cases there are non-global
symbols that cannot be stripped, and so LLVM strip reports an error. I
am not sure why these two (and a few others) want to install a
stripped archive in the first place. TCL now has a patch in the ports
tree (thanks gahr@) while waiting on a more portable upstream fix, and
PostgreSQL has a fix committed upstream. The same issue affects
textproc/sxml, but isn't a dependency for much (i.e., does not cause
any significant number of skipped ports).

The next issue affects science/q and shells/bash-static, and is caused
by mixing GNU objcopy and LLVM strip. There's a good description of
the presumed issue in
https://github.com/llvm/llvm-project/issues/53948#issuecomment-1518486410.
A bug was introduced in GNU objcopy about a year and a half ago, and
fixed last month. Due to this bug GNU objcopy produced invalid ELF
objects, with relocation sections that linked to the wrong symbol
table. GNU objcopy and strip are permissive and silently ignore the
invalid input, white LLVM objcopy and strip reject it with an error.
The combination of GNU and LLVM tools is probably undesired; I suspect
what's happening here is the port USES binutils, that doesn't override
strip and so the system strip is still used (PR270663).

The remaining issue is in sysutils/stressdisk, PR270962. This appears
to be a problem between LLVM strip and code built by cgo, with an
upstream bug at https://github.com/llvm/llvm-project/issues/53999.

A couple of other leaf ports may be broken when WITH_LLVM_BINUTILS is set.