build-rust icon indicating copy to clipboard operation
build-rust copied to clipboard

Builds fail on IBT-capable machines

Open ltratt opened this issue 8 months ago • 4 comments

On AMD amd64, build-rust happily builds a fully functioning nightly. On Intel amd64, however, nightly dies with an "illegal instruction" which looks to me like an IBT related failure. I guess this relates to at least one of the patch-compiler_rustc_session_src_options_rs or patch-vendor_psm_src_arch_x86_64_s patches in ports for rustc?

Unfortunately, my naive attempt to patch those in leads to nightly failing to build, complaining that "directory sources are not intended to be edited, if modifications are required then it is recommended that [patch] is used with a forked copy of the source".

I wonder if build-rust can patch these things in itself, so that nightly (hopefully) builds on IBT machines (which I guess is modern Intel and some-modern Arm CPUs?).

ltratt avatar Aug 12 '25 07:08 ltratt

could you try if passing RUSTFLAGS="-C link-arg=-Wl,-z,nobtcfi" is enough to build rustc ?

semarie avatar Aug 13 '25 10:08 semarie

I just pushed 5e99532 to fix the issue. Please re-open if the problem is still here.

Please note that it should permit to build rustc/cargo binaries, but the nightly compiler will create binaries that will need explicit options to run on IBT.

semarie avatar Aug 13 '25 13:08 semarie

Hmm, now even the beta build is dying with SIGILL. I'm not sure if that's because of your patch or because (I think) a new beta was released in the last day or two?

ltratt avatar Aug 13 '25 21:08 ltratt

I don't have IBT hardware to properly test that -z nobtcfi is passed on all places where it is required. beta dying might be related to last update. the script doesn't rebuild it if not need.

semarie avatar Aug 14 '25 13:08 semarie