Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
3d40189
Hermit: Don't cast `i32` to `i32`
mkroening Jun 30, 2026
87900d9
Hermit: Inline `InnerReadDir::new`
mkroening Jun 30, 2026
149dc77
Hermit: Avoid unsoundness around dirent64
mkroening Jun 30, 2026
736fa96
Hermit: Avoid cloning `InnerReadDir::root`
mkroening Jun 30, 2026
5b4b02e
avoid ICE in From/TryFrom cast diag
sjwang05 Jul 9, 2026
576d1bd
Hermit: Rework `getdents64` implementation
jounathaen Jun 26, 2026
0229444
Hermit: Filter out `.` and `..` from `getdents64`
mkroening Jul 1, 2026
8aafa5e
[rustdoc] Correctly handle output options with `--show-coverage`
GuillaumeGomez Jul 16, 2026
f545db6
Add regression test for `--show-coverage` output
GuillaumeGomez Jul 16, 2026
65b6e98
Add small message to say where the output was generated
GuillaumeGomez Jul 16, 2026
854bbe7
Fix `tests/run-make/rustdoc-show-coverage/rmake.rs` by requiring `nee…
GuillaumeGomez Jul 23, 2026
098056a
Move `rustdoc-ui` `--show-coverage` tests into the `coverage` folder
GuillaumeGomez Jul 24, 2026
c680b50
Mention how the `-o` option behaves with the `--show-coverage` option
GuillaumeGomez Jul 24, 2026
41704bd
Only run `rustdoc-show-coverage/rmake.rs` test on linux to make thing…
GuillaumeGomez Jul 26, 2026
ab3e64f
test: add test suite for the 85681 issue
SzilvasiPeter Jul 28, 2026
067a5f6
Add missing `needs-unwind` annotation to `tests/ui/std/add-spawn-hook…
fs-rachel Jul 28, 2026
aea0662
cfi: add diag mode support
1c3t3a Jun 9, 2026
3955b03
Refactor to -Zsanitizer-cfi-diag={false,true} and -Zsanitizer-cfi-rec…
1c3t3a Jun 15, 2026
66f3da0
Refactor `missing_items_err`: factor out function to find suggestion …
joshtriplett Jul 28, 2026
6640449
Refactor `missing_items_err`: factor out function to find suggestions
joshtriplett Jul 28, 2026
740230b
Remove unnecessary format
gkamathe Jul 29, 2026
bf8708e
Add suggestions for `must_implement_one_of`
joshtriplett Jul 28, 2026
50d66b9
Work around Wine bug 60084 by calling WSAStartup at most once
tbu- Jul 29, 2026
51b4904
bootstrap: remove use-lld config alias
kn1g78 Jul 29, 2026
31918e4
Rename `rustc_codegen_gcc/errors.rs` into `rustc_codegen_gcc/diagnost…
GuillaumeGomez Jul 29, 2026
6229545
Rename `rustc_codegen_llvm/errors.rs` into `rustc_codegen_llvm/diagno…
GuillaumeGomez Jul 29, 2026
580253e
split module resolutions into local and external types, with external…
LorrensP-2158466 Jul 28, 2026
c430395
Add regression test for nested associated-type projection ICE
zakrad Jul 28, 2026
d3be642
Mark a doctest as requiring unwinding
fs-rachel Jul 29, 2026
3d0b63d
hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`
mkroening Jun 22, 2026
6b2608e
rustc_resolve: Further reduce mutability in resolver
petrochenkov Jul 28, 2026
c9f7b96
rustc_resolve: Turn `RefOrMut` into an enum
petrochenkov Jul 28, 2026
d800217
iter: specialize Take::count using advance_by
Rachit2323 Jul 29, 2026
953e83e
Use correct feature gates for `f16`/`f128` `From` impls
beetrees Jul 29, 2026
9ce1973
add offload intrinsic typecheck
Sa4dUs Jun 18, 2026
f6e39fb
fix and add tests
Sa4dUs Jun 29, 2026
a6776aa
proper location
Sa4dUs Jul 2, 2026
5f61402
multiple arg type mismatch
Sa4dUs Jul 8, 2026
43ebcda
fix
Sa4dUs Jul 29, 2026
24fefc3
Remove unused `va_start` intrinsic
beetrees Jul 29, 2026
acb7f30
Rollup merge of #157669 - 1c3t3a:cfi-diag-mode, r=rcvalle
jhpratt Jul 30, 2026
34eff12
Rollup merge of #158247 - hermit-os:hermit-fs-unsupported, r=clarfonthey
jhpratt Jul 30, 2026
b014a91
Rollup merge of #158649 - hermit-os:hermit-readdir, r=joboet
jhpratt Jul 30, 2026
f25db1a
Rollup merge of #158693 - Sa4dUs:offload-typeck, r=ZuseZ4
jhpratt Jul 30, 2026
4a525d9
Rollup merge of #159049 - sjwang05:issue-158967, r=lcnr
jhpratt Jul 30, 2026
f0a77d9
Rollup merge of #159411 - GuillaumeGomez:show-coverage, r=Urgau,aDotI…
jhpratt Jul 30, 2026
663ecf6
Rollup merge of #160053 - SzilvasiPeter:main, r=ShoyuVanilla
jhpratt Jul 30, 2026
246800c
Rollup merge of #160087 - zakrad:regr-test-109864, r=oli-obk
jhpratt Jul 30, 2026
f0fea75
Rollup merge of #160090 - petrochenkov:cmonst, r=mu001999
jhpratt Jul 30, 2026
03de096
Rollup merge of #160099 - LorrensP-2158466:split-module-resolutions, …
jhpratt Jul 30, 2026
521159c
Rollup merge of #160101 - fs-rachel:missing-needs-unwind, r=jhpratt
jhpratt Jul 30, 2026
e56dd19
Rollup merge of #160106 - joshtriplett:must-implement-one-of-suggesti…
jhpratt Jul 30, 2026
6a92f83
Rollup merge of #160117 - gkamathe:remove-unnecessary-format, r=mu001999
jhpratt Jul 30, 2026
e13b684
Rollup merge of #160134 - tbu-:pr_wine_60084_wsastartup, r=ChrisDenton
jhpratt Jul 30, 2026
d1e43eb
Rollup merge of #160139 - Rachit2323:take-count-specialization, r=joboet
jhpratt Jul 30, 2026
0b33fc0
Rollup merge of #160142 - kn1g78:remove-use-lld-config-alias, r=Kobzol
jhpratt Jul 30, 2026
504ee5c
Rollup merge of #160148 - GuillaumeGomez:rename-errors, r=JonathanBro…
jhpratt Jul 30, 2026
3d57477
Rollup merge of #160151 - fs-rachel:unwind-in-alloc-doctest, r=clarfo…
jhpratt Jul 30, 2026
131b40d
Rollup merge of #160166 - beetrees:f16-f128-from-feature-gates, r=tgr…
jhpratt Jul 30, 2026
f4797c0
Rollup merge of #160178 - beetrees:remove-unused-va-start, r=folkertdev
jhpratt Jul 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_target::asm::*;
use crate::builder::Builder;
use crate::callee::get_fn;
use crate::context::CodegenCx;
use crate::errors::{NulBytesInAsm, UnwindingInlineAsm};
use crate::diagnostics::{NulBytesInAsm, UnwindingInlineAsm};
use crate::type_of::LayoutGccExt;

// Rust asm! and GCC Extended Asm semantics differ substantially.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use rustc_log::tracing::info;
use tempfile::{TempDir, tempdir};

use crate::back::write::{codegen, save_temp_bitcode};
use crate::errors::LtoBitcodeFromRlib;
use crate::diagnostics::LtoBitcodeFromRlib;
use crate::{GccCodegenBackend, GccContext, LtoMode, to_gcc_opt_level};

struct LtoData {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_session::config::OutputType;
use rustc_target::spec::SplitDebuginfo;

use crate::base::add_pic_option;
use crate::errors::CopyBitcode;
use crate::diagnostics::CopyBitcode;
use crate::{GccContext, LtoMode};

pub(crate) fn codegen(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, X86Abi};
use crate::abi::FnAbiGccExt;
use crate::common::{SignType, TypeReflection, type_is_pointer};
use crate::context::CodegenCx;
use crate::errors;
use crate::diagnostics;
use crate::intrinsic::llvm;
use crate::type_of::LayoutGccExt;

Expand Down Expand Up @@ -1803,7 +1803,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
_instance: Option<Instance<'tcx>>,
) {
// FIXME: implement support for explicit tail calls like rustc_codegen_llvm.
self.tcx.dcx().emit_fatal(errors::ExplicitTailCallsUnsupported);
self.tcx.dcx().emit_fatal(diagnostics::ExplicitTailCallsUnsupported);
}

fn zext(&mut self, value: RValue<'gcc>, dest_typ: Type<'gcc>) -> RValue<'gcc> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod context;
mod coverageinfo;
mod debuginfo;
mod declare;
mod errors;
mod diagnostics;
mod gcc_util;
mod int;
mod intrinsic;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_target::spec::{Arch, FramePointer, SanitizerSet, StackProbeType, Stack
use smallvec::SmallVec;

use crate::context::SimpleCx;
use crate::errors::{PackedStackBackchainNeedsSoftfloat, SanitizerMemtagRequiresMte};
use crate::diagnostics::{PackedStackBackchainNeedsSoftfloat, SanitizerMemtagRequiresMte};
use crate::llvm::AttributePlace::Function;
use crate::llvm::{
self, AllocKindFlags, Attribute, AttributeKind, AttributePlace, MemoryEffects, Value,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::back::write::{
self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, codegen,
save_temp_bitcode,
};
use crate::errors::{LlvmError, LtoBitcodeFromRlib};
use crate::diagnostics::{LlvmError, LtoBitcodeFromRlib};
use crate::llvm::{self, build_string};
use crate::{LlvmCodegenBackend, ModuleLlvm};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ptr::NonNull;

use rustc_data_structures::small_c_str::SmallCStr;

use crate::errors::LlvmError;
use crate::diagnostics::LlvmError;
use crate::llvm;

/// Responsible for safely creating and disposing llvm::TargetMachine via ffi functions.
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::back::profiling::{
use crate::builder::SBuilder;
use crate::builder::gpu_offload::scalar_width;
use crate::common::AsCCharPtr;
use crate::errors::{
use crate::diagnostics::{
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
UnsupportedCompression, WithLlvmError, WriteBytecode,
};
Expand Down Expand Up @@ -819,7 +819,7 @@ pub(crate) unsafe fn llvm_optimize(
device_out_c.as_ptr(),
);
if !ok || !device_out.exists() {
dcx.emit_err(crate::errors::OffloadBundleImagesFailed);
dcx.emit_err(crate::diagnostics::OffloadBundleImagesFailed);
}
}
}
Expand All @@ -837,15 +837,15 @@ pub(crate) unsafe fn llvm_optimize(
{
let device_pathbuf = PathBuf::from(device_path);
if device_pathbuf.is_relative() {
dcx.emit_err(crate::errors::OffloadWithoutAbsPath);
dcx.emit_err(crate::diagnostics::OffloadWithoutAbsPath);
} else if device_pathbuf
.file_name()
.and_then(|n| n.to_str())
.is_some_and(|n| n != "device.bin")
{
dcx.emit_err(crate::errors::OffloadWrongFileName);
dcx.emit_err(crate::diagnostics::OffloadWrongFileName);
} else if !device_pathbuf.exists() {
dcx.emit_err(crate::errors::OffloadNonexistingPath);
dcx.emit_err(crate::diagnostics::OffloadNonexistingPath);
}
let host_path = cgcx.output_filenames.path(OutputType::Object);
let host_dir = host_path.parent().unwrap();
Expand All @@ -859,7 +859,7 @@ pub(crate) unsafe fn llvm_optimize(
let ok =
unsafe { llvm::LLVMRustOffloadEmbedBufferInModule(llmod2, device_bin_c.as_ptr()) };
if !ok {
dcx.emit_err(crate::errors::OffloadEmbedFailed);
dcx.emit_err(crate::diagnostics::OffloadEmbedFailed);
}
write_output_file(
dcx,
Expand Down
112 changes: 108 additions & 4 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use crate::type_of::LayoutLlvmExt;
pub(crate) struct GenericBuilder<'a, 'll, CX: Borrow<SCx<'ll>>> {
pub llbuilder: &'ll mut llvm::Builder<'ll>,
pub cx: &'a GenericCx<'ll, CX>,
pub span: rustc_span::Span,
}

pub(crate) type SBuilder<'a, 'll> = GenericBuilder<'a, 'll, SCx<'ll>>;
Expand Down Expand Up @@ -94,7 +95,7 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
fn with_cx(scx: &'a GenericCx<'ll, CX>) -> Self {
// Create a fresh builder from the simple context.
let llbuilder = unsafe { llvm::LLVMCreateBuilderInContext(scx.deref().borrow().llcx) };
GenericBuilder { llbuilder, cx: scx }
GenericBuilder { llbuilder, cx: scx, span: rustc_span::DUMMY_SP }
}

pub(crate) fn append_block(
Expand Down Expand Up @@ -304,7 +305,9 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
unsafe { llvm::LLVMGetInsertBlock(self.llbuilder) }
}

fn set_span(&mut self, _span: Span) {}
fn set_span(&mut self, span: rustc_span::Span) {
self.span = span;
}

fn append_block(cx: &'a CodegenCx<'ll, 'tcx>, llfn: &'ll Value, name: &str) -> &'ll BasicBlock {
unsafe {
Expand Down Expand Up @@ -1564,6 +1567,51 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
pub(crate) fn llfn(&self) -> &'ll Value {
unsafe { llvm::LLVMGetBasicBlockParent(self.llbb()) }
}

fn generate_ubsan_cfi_diag_data(
&mut self,
span: rustc_span::Span,
expected_ty: String,
check_kind: u8,
) -> &'ll Value {
let cx = self.cx();
let tcx = cx.tcx;

let loc = tcx.sess.source_map().lookup_char_pos(span.lo());

let filename_str = format!("{}\0", loc.file.name.prefer_local_unconditionally());
let filename_val = cx.const_bytes(filename_str.as_bytes());
let filename_ptr = cx.static_addr_of_impl(filename_val, Align::ONE, None);

// SourceLocation UBSan struct: { const char *filename, uint32_t line, uint32_t column }
let source_location = cx.const_struct(
&[
filename_ptr,
cx.const_u32(loc.line as u32),
// UBSan columns are 1-based
cx.const_u32(loc.col.0 as u32 + 1),
],
false, // packed = false
);

let ty_name = format!("{}\0", expected_ty);
let ty_name_val = cx.const_bytes(ty_name.as_bytes());

// TypeDescriptor UBSan struct: { uint16_t TypeKind, uint16_t TypeInfo, const char *TypeName }
let type_descriptor =
cx.const_struct(&[cx.const_i16(0xffffu16 as i16), cx.const_i16(0), ty_name_val], false);

let type_descriptor_ptr =
cx.static_addr_of_impl(type_descriptor, Align::from_bytes(2).unwrap(), None);

// CFICheckFailData UBSan struct: { uint8_t CheckKind, SourceLocation Loc, TypeDescriptor *Type }
let cfi_check_fail_data = cx
.const_struct(&[cx.const_u8(check_kind), source_location, type_descriptor_ptr], false);
let align = tcx.data_layout.aggregate_align;

// Returns the final opaque pointer to the struct to be passed to __ubsan_handle_cfi_check_fail
cx.static_addr_of_mut(cfi_check_fail_data, align, Some("__ubsan_cfi_check_fail_data"))
}
}

impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
Expand Down Expand Up @@ -1983,8 +2031,64 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
if let Some(dbg_loc) = dbg_loc {
self.set_dbg_loc(dbg_loc);
}
self.abort();
self.unreachable();

let is_diag = self.tcx.sess.opts.unstable_opts.sanitizer_cfi_diag.unwrap_or(false);
let is_recover =
self.tcx.sess.opts.unstable_opts.sanitizer_cfi_recover.unwrap_or(false);

if is_diag || is_recover {
let fty = self.cx.type_func(
&[self.cx.type_ptr(), self.cx.type_isize(), self.cx.type_isize()],
self.cx.type_void(),
);
let ubsan_handler = self.declare_cfn(
if is_recover {
"__ubsan_handle_cfi_check_fail"
} else {
"__ubsan_handle_cfi_check_fail_abort"
},
llvm::UnnamedAddr::Global,
fty,
);

let mut expected_ty = String::from("fn(");
for (i, arg) in fn_abi.args.iter().enumerate() {
if i > 0 {
expected_ty.push_str(", ");
}
use std::fmt::Write;
write!(&mut expected_ty, "{}", arg.layout.ty).unwrap();
}
expected_ty.push(')');
if !fn_abi.ret.layout.ty.is_unit() {
use std::fmt::Write;
write!(&mut expected_ty, " -> {}", fn_abi.ret.layout.ty).unwrap();
}

// 4 for cfi-icall (indirect call)
let check_kind = 4;
let diag_data =
self.generate_ubsan_cfi_diag_data(self.span, expected_ty, check_kind);

let function_address = self.ptrtoint(llfn, self.cx.type_isize());
self.call(
fty,
None,
None,
ubsan_handler,
&[diag_data, function_address, self.const_usize(0)],
None,
None,
);
if is_recover {
self.br(bb_pass);
} else {
self.unreachable();
}
} else {
self.abort();
self.unreachable();
}

self.switch_to_block(bb_pass);
if let Some(dbg_loc) = dbg_loc {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_target::spec::Arch;
use tracing::{debug, instrument, trace};

use crate::common::CodegenCx;
use crate::errors::SymbolAlreadyDefined;
use crate::diagnostics::SymbolAlreadyDefined;
use crate::llvm::{self, Type, Value, const_ptr_auth};
use crate::type_of::LayoutLlvmExt;
use crate::{base, debuginfo};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub(crate) unsafe fn create_module<'ll>(
.expect("got a non-UTF8 data-layout from LLVM");

if target_data_layout != llvm_data_layout {
tcx.dcx().emit_err(crate::errors::MismatchedDataLayout {
tcx.dcx().emit_err(crate::diagnostics::MismatchedDataLayout {
rustc_target: sess.opts.target_triple.to_string().as_str(),
rustc_layout: target_data_layout.as_str(),
llvm_target: sess.target.llvm_target.borrow(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::builder::gpu_offload::{
};
use crate::context::CodegenCx;
use crate::declare::declare_raw_fn;
use crate::errors::{
use crate::diagnostics::{
AutoDiffWithoutEnable, AutoDiffWithoutLto, IntrinsicSignatureMismatch, IntrinsicWrongArch,
OffloadWithoutEnable, OffloadWithoutFatLTO, UnknownIntrinsic,
};
Expand Down
7 changes: 4 additions & 3 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mod context;
mod coverageinfo;
mod debuginfo;
mod declare;
mod errors;
mod diagnostics;
mod intrinsic;
mod llvm;
mod llvm_util;
Expand Down Expand Up @@ -233,10 +233,11 @@ impl CodegenBackend for LlvmCodegenBackend {
match llvm::EnzymeWrapper::get_or_init(&sess.opts.sysroot) {
Ok(_) => {}
Err(llvm::EnzymeLibraryError::NotFound { err }) => {
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentMissing { err });
sess.dcx().emit_fatal(crate::diagnostics::AutoDiffComponentMissing { err });
}
Err(llvm::EnzymeLibraryError::LoadFailed { err }) => {
sess.dcx().emit_fatal(crate::errors::AutoDiffComponentUnavailable { err });
sess.dcx()
.emit_fatal(crate::diagnostics::AutoDiffComponentUnavailable { err });
}
}
enable_autodiff_settings(&sess.opts.unstable_opts.autodiff);
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_target::spec::{
use smallvec::{SmallVec, smallvec};

use crate::back::write::create_informational_target_machine;
use crate::{errors, llvm};
use crate::{diagnostics, llvm};

static INIT: Once = Once::new();

Expand Down Expand Up @@ -636,7 +636,8 @@ fn llvm_features_by_flags(sess: &Session, features: &mut Vec<String>) {
// -Zfixed-x18
if sess.opts.unstable_opts.fixed_x18 {
if sess.target.arch != Arch::AArch64 {
sess.dcx().emit_fatal(errors::FixedX18InvalidArch { arch: sess.target.arch.desc() });
sess.dcx()
.emit_fatal(diagnostics::FixedX18InvalidArch { arch: sess.target.arch.desc() });
} else {
features.push("+reserve-x18".into());
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/mono_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use tracing::debug;
use crate::abi::FnAbiLlvmExt;
use crate::builder::Builder;
use crate::context::CodegenCx;
use crate::errors::SymbolAlreadyDefined;
use crate::diagnostics::SymbolAlreadyDefined;
use crate::type_of::LayoutLlvmExt;
use crate::{base, llvm};

Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,12 @@ fn add_sanitizer_libraries(
if sanitizer.contains(SanitizerSet::REALTIME) {
link_sanitizer_runtime(sess, flavor, linker, "rtsan");
}
if sanitizer.contains(SanitizerSet::CFI)
&& (sess.opts.unstable_opts.sanitizer_cfi_diag.unwrap_or(false)
|| sess.opts.unstable_opts.sanitizer_cfi_recover.unwrap_or(false))
{
link_sanitizer_runtime(sess, flavor, linker, "ubsan");
}
}

fn link_sanitizer_runtime(
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ pub struct ModuleConfig {
pub instrument_coverage: bool,

pub sanitizer: SanitizerSet,
pub sanitizer_cfi_diag: Option<bool>,
pub sanitizer_cfi_recover: Option<bool>,
pub sanitizer_recover: SanitizerSet,
pub sanitizer_dataflow_abilist: Vec<String>,
pub sanitizer_memory_track_origins: usize,
Expand Down Expand Up @@ -182,6 +184,8 @@ impl ModuleConfig {
instrument_coverage: if_regular!(sess.instrument_coverage(), false),

sanitizer: if_regular!(sess.sanitizers(), SanitizerSet::empty()),
sanitizer_cfi_diag: if_regular!(sess.opts.unstable_opts.sanitizer_cfi_diag, None),
sanitizer_cfi_recover: if_regular!(sess.opts.unstable_opts.sanitizer_cfi_recover, None),
sanitizer_dataflow_abilist: if_regular!(
sess.opts.unstable_opts.sanitizer_dataflow_abilist.clone(),
Vec::new()
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
location.val
}

// va_end uses the fallback body (a no-op).
sym::va_start => {
bx.va_start(args[0].immediate());
OperandValue::ZeroSized
}

sym::size_of_val => {
let tp_ty = fn_args.type_at(0);
let (_, meta) = args[0].val.pointer_parts();
Expand Down
Loading
Loading