[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHmTWEAS/QjX++w4@hirez.programming.kicks-ass.net>
Date: Fri, 16 Apr 2021 15:38:32 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: ojeda@...nel.org
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Alex Gaynor <alex.gaynor@...il.com>,
Geoffrey Thomas <geofft@...reload.com>,
Finn Behrens <me@...enk.de>,
Adam Bratschi-Kaye <ark.email@...il.com>,
Wedson Almeida Filho <wedsonaf@...gle.com>,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH 04/13] Kbuild: Rust support
On Wed, Apr 14, 2021 at 08:45:55PM +0200, ojeda@...nel.org wrote:
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 1b6094a13034..3665c49c4dcf 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -26,6 +26,7 @@ EXTRA_CPPFLAGS :=
> EXTRA_LDFLAGS :=
> asflags-y :=
> ccflags-y :=
> +rustcflags-y :=
> cppflags-y :=
> ldflags-y :=
>
> @@ -287,6 +288,24 @@ quiet_cmd_cc_lst_c = MKLST $@
> $(obj)/%.lst: $(src)/%.c FORCE
> $(call if_changed_dep,cc_lst_c)
>
> +# Compile Rust sources (.rs)
> +# ---------------------------------------------------------------------------
> +
> +rustc_cross_flags := --target=$(srctree)/arch/$(SRCARCH)/rust/target.json
> +
> +quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
> + cmd_rustc_o_rs = \
> + RUST_MODFILE=$(modfile) \
> + $(RUSTC_OR_CLIPPY) $(rustc_flags) $(rustc_cross_flags) \
> + --extern alloc --extern kernel \
> + --crate-type rlib --out-dir $(obj) -L $(objtree)/rust/ \
> + --crate-name $(patsubst %.o,%,$(notdir $@)) $<; \
> + mv $(obj)/$(subst .o,,$(notdir $@)).d $(depfile); \
> + sed -i '/^\#/d' $(depfile)
> +
> +$(obj)/%.o: $(src)/%.rs FORCE
> + $(call if_changed_dep,rustc_o_rs)
> +
> # Compile assembler sources (.S)
> # ---------------------------------------------------------------------------
>
So if I read all this right, rust compiles to .o and, like any other .o
file is then fed into objtool (for x86_64). Did you have any problems
with objtool? Does it generate correct ORC unwind information?
AFAICT rust has try/throw/catch exception handling (like
C++/Java/others) which is typically implemented with stack unwinding of
its own.
Does all that interact sanely?
Powered by blists - more mailing lists