From 2d476222e8458aa873e6760aac189b5e9d0a9930 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Wed, 18 Oct 2023 16:58:17 +0200 Subject: Add `-Zfunction-return={keep,thunk-extern}` option This is intended to be used for Linux kernel RETHUNK builds. With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module. Signed-off-by: Miguel Ojeda --- compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp') diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index bf870e28acd..b227dd76f02 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -278,6 +278,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { return Attribute::AllocAlign; case SanitizeSafeStack: return Attribute::SafeStack; + case FnRetThunkExtern: + return Attribute::FnRetThunkExtern; } report_fatal_error("bad AttributeKind"); } -- cgit 1.4.1-3-g733a5