Re: [PATCH v3] kbuild: rust: add PROCMACROLDFLAGS

From: Miguel Ojeda
Date: Tue Jan 14 2025 - 17:47:26 EST


On Tue, Dec 10, 2024 at 1:51 AM Hong, Yifan <elsk@xxxxxxxxxx> wrote:
>
> With https://github.com/rust-lang/compiler-team/issues/731 fixed and
> this idea of appending flags, our --sysroot flag should be able to be
> properly overridden. But the -L and -Wl,-rpath's remains, and could
> potentially be disturbing.

On second thought, #731 probably only applies to `rustc` native flags
only, rather than those that are passed to the linker (e.g. if I pass
a dummy flag, it is passed as-is, so I doubt they will start checking,
and probably they shouldn't), so it may not help here after all.

> So if I understand what you mean correctly, with this:
> KBUILD_PROCMACROLDFLAGS := $(HOSTLDFLAGS) $(PROCMACROLDFLAGS)
> Android might need a separate mechanism (another variable?) to filter
> out our -L/-Wl,-rpath from HOSTLDFLAGS. (Dumb question: We can't take
> -L/-Wl,-rpath away by prepending/appending more flags, right?)

Yeah, we would need a variable to provide the filters, but it would be
more complex and possibly less flexible. I think it may be best to
keep things simple and use the v3 here, which already works for your
use case.

Cheers,
Miguel