Skip to content

Commit d255d70

Browse files
committed
Update LLVM and add Unsupported diagnostic
Secure entry functions do not support if arguments are passed on the stack. An "unsupported" diagnostic will be emitted by LLVM if that is the case. This commits adds support in Rust for that diagnostic so that an error will be output if that is the case! Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
1 parent 511ed9f commit d255d70

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

Diff for: compiler/rustc_codegen_llvm/src/back/write.rs

+7
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,13 @@ unsafe extern "C" fn diagnostic_handler(info: &DiagnosticInfo, user: *mut c_void
344344
.expect("non-UTF8 diagnostic");
345345
diag_handler.warn(&msg);
346346
}
347+
llvm::diagnostic::Unsupported(diagnostic_ref) => {
348+
let msg = llvm::build_string(|s| {
349+
llvm::LLVMRustWriteDiagnosticInfoToString(diagnostic_ref, s)
350+
})
351+
.expect("non-UTF8 diagnostic");
352+
diag_handler.err(&msg);
353+
}
347354
llvm::diagnostic::UnknownDiagnostic(..) => {}
348355
}
349356
}

Diff for: compiler/rustc_codegen_llvm/src/llvm/diagnostic.rs

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ pub enum Diagnostic<'ll> {
118118
InlineAsm(InlineAsmDiagnostic<'ll>),
119119
PGO(&'ll DiagnosticInfo),
120120
Linker(&'ll DiagnosticInfo),
121+
Unsupported(&'ll DiagnosticInfo),
121122

122123
/// LLVM has other types that we do not wrap here.
123124
UnknownDiagnostic(&'ll DiagnosticInfo),
@@ -159,6 +160,7 @@ impl Diagnostic<'ll> {
159160

160161
Dk::PGOProfile => PGO(di),
161162
Dk::Linker => Linker(di),
163+
Dk::Unsupported => Unsupported(di),
162164

163165
_ => UnknownDiagnostic(di),
164166
}

Diff for: compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ pub enum DiagnosticKind {
483483
OptimizationFailure,
484484
PGOProfile,
485485
Linker,
486+
Unsupported,
486487
}
487488

488489
/// LLVMRustDiagnosticLevel

Diff for: compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,7 @@ enum class LLVMRustDiagnosticKind {
11711171
OptimizationFailure,
11721172
PGOProfile,
11731173
Linker,
1174+
Unsupported,
11741175
};
11751176

11761177
static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) {
@@ -1197,6 +1198,8 @@ static LLVMRustDiagnosticKind toRust(DiagnosticKind Kind) {
11971198
return LLVMRustDiagnosticKind::PGOProfile;
11981199
case DK_Linker:
11991200
return LLVMRustDiagnosticKind::Linker;
1201+
case DK_Unsupported:
1202+
return LLVMRustDiagnosticKind::Unsupported;
12001203
default:
12011204
return (Kind >= DK_FirstRemark && Kind <= DK_LastRemark)
12021205
? LLVMRustDiagnosticKind::OptimizationRemarkOther

0 commit comments

Comments
 (0)