Re: /stable/12 future

From: Ed Maste <emaste_at_freebsd.org>
Date: Tue, 21 Dec 2021 19:57:27 UTC
On Mon, 20 Dec 2021 at 15:54, Dimitry Andric <dim@freebsd.org> wrote:
>
> The obvious solution would seem to be to switch to lld as the default
> linker, however that also runs into a snag. Since lld uses the blx
> instruction for interworking, it prints a warning "lld uses blx
> instruction, no object with architecture supporting feature detected".
>
> And because we link with the --fatal-warnings option, this stops> buildworld dead in its tracks. Obviously, this warning could be ignored
> (by removing --fatal-warnings, or patching it out), but I think this
> might result in issues when the actual binaries are run.

I believe this warning is emitted in any environment that a blx
instruction might be necessary, not that the instruction is actually
used.

From ELF/InputFiles.cpp:
// The ARM support in lld makes some use of instructions that are not available
// on all ARM architectures. Namely:
// - Use of BLX instruction for interworking between ARM and Thumb state.
// - Use of the extended Thumb branch encoding in relocation.
// - Use of the MOVT/MOVW instructions in Thumb Thunks.

I wonder if we could remove the warning from ELF/Driver.cpp in the
case that config->armHasBlx == false, and replace it with an error in
ELF/Arch/ARM.cpp if we actually need to emit a blx instruction?