Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
60a7cab
Use fstatat() in DirEntry::metadata on Apple platforms
jesseschalken Oct 22, 2025
fe4c2a2
typo
jesseschalken Oct 22, 2025
63bb238
implement VecDeque extend_from_within and prepend_from_within, add tests
antonilol Oct 23, 2025
73b734b
Pass `debuginfo_compression` through FFI as an enum
Zalathar Oct 23, 2025
d5839f9
Enable regression labeling aliases
apiraino Oct 21, 2025
c5b30c3
docs: Fix argument names for `carrying_mul_add`
sorairolake Oct 31, 2025
761ae9a
add tier 3 HelenOS compiler targets
mvolfik Jun 5, 2025
3d9c69b
enable flock for illumos
pietroalbini Oct 31, 2025
06a2e72
Implement VecDeque::extract_if
tisonkun Oct 16, 2025
bf7b05c
refactor: move runtime functions to core
Kmeakin Oct 11, 2025
c8ab427
refactor: format `unicode_data`
Kmeakin Oct 11, 2025
6d75cd2
refactor: remove check that `first_code_point` is non-ascii
Kmeakin Oct 11, 2025
9a80731
refactor: make string formatting more readable
Kmeakin Oct 11, 2025
0e6131c
refactor: make `unicode_data` tests normal tests
Kmeakin Oct 19, 2025
652e5cb
Rollup merge of #139310 - mvolfik:helenos-compiler, r=wesleywiser
matthiaskrgr Oct 31, 2025
53c52a2
Rollup merge of #147161 - antonilol:vec-deque-extend-from-within, r=j…
matthiaskrgr Oct 31, 2025
75fbbd3
Rollup merge of #147622 - Kmeakin:km/unicode-data/refactors, r=joboet
matthiaskrgr Oct 31, 2025
c42f8eb
Rollup merge of #147780 - tisonkun:vec-deque-extract-if, r=joboet
matthiaskrgr Oct 31, 2025
a289ae4
Rollup merge of #147942 - apiraino:enable-label-aliases, r=Urgau
matthiaskrgr Oct 31, 2025
c438dbd
Rollup merge of #147986 - jesseschalken:use-fstatat-macos, r=joboet
matthiaskrgr Oct 31, 2025
3d671c0
Rollup merge of #148103 - Zalathar:compression, r=wesleywiser
matthiaskrgr Oct 31, 2025
3605e14
Rollup merge of #148319 - sorairolake:fix-carrying_mul_add-docs, r=Am…
matthiaskrgr Oct 31, 2025
eaa283d
Rollup merge of #148322 - oxidecomputer:ea-flock-illumos, r=ChrisDenton
matthiaskrgr Oct 31, 2025
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
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl OwnedTargetMachine {
use_init_array: bool,
split_dwarf_file: &CStr,
output_obj_file: &CStr,
debug_info_compression: &CStr,
debug_info_compression: llvm::CompressionKind,
use_emulated_tls: bool,
use_wasm_eh: bool,
) -> Result<Self, LlvmError<'static>> {
Expand All @@ -62,7 +62,7 @@ impl OwnedTargetMachine {
use_init_array,
split_dwarf_file.as_ptr(),
output_obj_file.as_ptr(),
debug_info_compression.as_ptr(),
debug_info_compression,
use_emulated_tls,
use_wasm_eh,
)
Expand Down
25 changes: 13 additions & 12 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use std::sync::Arc;
use std::{fs, slice, str};

use libc::{c_char, c_int, c_void, size_t};
use llvm::{
LLVMRustLLVMHasZlibCompressionForDebugSymbols, LLVMRustLLVMHasZstdCompressionForDebugSymbols,
};
use rustc_codegen_ssa::back::link::ensure_removed;
use rustc_codegen_ssa::back::versioned_llvm_target;
use rustc_codegen_ssa::back::write::{
Expand Down Expand Up @@ -252,21 +249,25 @@ pub(crate) fn target_machine_factory(

let use_emulated_tls = matches!(sess.tls_model(), TlsModel::Emulated);

let debuginfo_compression = sess.opts.debuginfo_compression.to_string();
match sess.opts.debuginfo_compression {
rustc_session::config::DebugInfoCompression::Zlib => {
if !unsafe { LLVMRustLLVMHasZlibCompressionForDebugSymbols() } {
let debuginfo_compression = match sess.opts.debuginfo_compression {
config::DebugInfoCompression::None => llvm::CompressionKind::None,
config::DebugInfoCompression::Zlib => {
if llvm::LLVMRustLLVMHasZlibCompression() {
llvm::CompressionKind::Zlib
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
llvm::CompressionKind::None
}
}
rustc_session::config::DebugInfoCompression::Zstd => {
if !unsafe { LLVMRustLLVMHasZstdCompressionForDebugSymbols() } {
config::DebugInfoCompression::Zstd => {
if llvm::LLVMRustLLVMHasZstdCompression() {
llvm::CompressionKind::Zstd
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
llvm::CompressionKind::None
}
}
rustc_session::config::DebugInfoCompression::None => {}
};
let debuginfo_compression = SmallCStr::new(&debuginfo_compression);

let file_name_display_preference =
sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);
Expand Down Expand Up @@ -310,7 +311,7 @@ pub(crate) fn target_machine_factory(
use_init_array,
&split_dwarf_file,
&output_obj_file,
&debuginfo_compression,
debuginfo_compression,
use_emulated_tls,
use_wasm_eh,
)
Expand Down
16 changes: 12 additions & 4 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,15 @@ pub(crate) enum Opcode {
CatchSwitch = 65,
}

/// Must match the layout of `LLVMRustCompressionKind`.
#[derive(Copy, Clone)]
#[repr(C)]
pub(crate) enum CompressionKind {
None = 0,
Zlib = 1,
Zstd = 2,
}

unsafe extern "C" {
type Opaque;
}
Expand Down Expand Up @@ -2329,7 +2338,7 @@ unsafe extern "C" {
UseInitArray: bool,
SplitDwarfFile: *const c_char,
OutputObjFile: *const c_char,
DebugInfoCompression: *const c_char,
DebugInfoCompression: CompressionKind,
UseEmulatedTls: bool,
UseWasmEH: bool,
) -> *mut TargetMachine;
Expand Down Expand Up @@ -2517,9 +2526,8 @@ unsafe extern "C" {

pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;

pub(crate) fn LLVMRustLLVMHasZlibCompressionForDebugSymbols() -> bool;

pub(crate) fn LLVMRustLLVMHasZstdCompressionForDebugSymbols() -> bool;
pub(crate) safe fn LLVMRustLLVMHasZlibCompression() -> bool;
pub(crate) safe fn LLVMRustLLVMHasZstdCompression() -> bool;

pub(crate) fn LLVMRustGetSymbols(
buf_ptr: *const u8,
Expand Down
42 changes: 31 additions & 11 deletions compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,31 @@ static FloatABI::ABIType fromRust(LLVMRustFloatABI RustFloatAbi) {
report_fatal_error("Bad FloatABI.");
}

// Must match the layout of `rustc_codegen_llvm::llvm::ffi::CompressionKind`.
enum class LLVMRustCompressionKind {
None = 0,
Zlib = 1,
Zstd = 2,
};

static llvm::DebugCompressionType fromRust(LLVMRustCompressionKind Kind) {
switch (Kind) {
case LLVMRustCompressionKind::None:
return llvm::DebugCompressionType::None;
case LLVMRustCompressionKind::Zlib:
if (!llvm::compression::zlib::isAvailable()) {
report_fatal_error("LLVMRustCompressionKind::Zlib not available");
}
return llvm::DebugCompressionType::Zlib;
case LLVMRustCompressionKind::Zstd:
if (!llvm::compression::zstd::isAvailable()) {
report_fatal_error("LLVMRustCompressionKind::Zstd not available");
}
return llvm::DebugCompressionType::Zstd;
}
report_fatal_error("bad LLVMRustCompressionKind");
}

extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
RustStringRef OutStr) {
ArrayRef<SubtargetSubTypeKV> CPUTable =
Expand Down Expand Up @@ -271,7 +296,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
bool TrapUnreachable, bool Singlethread, bool VerboseAsm,
bool EmitStackSizeSection, bool RelaxELFRelocations, bool UseInitArray,
const char *SplitDwarfFile, const char *OutputObjFile,
const char *DebugInfoCompression, bool UseEmulatedTls, bool UseWasmEH) {
LLVMRustCompressionKind DebugInfoCompression, bool UseEmulatedTls,
bool UseWasmEH) {

auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
Expand Down Expand Up @@ -307,16 +333,10 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
if (OutputObjFile) {
Options.ObjectFilenameForDebug = OutputObjFile;
}
if (!strcmp("zlib", DebugInfoCompression) &&
llvm::compression::zlib::isAvailable()) {
Options.MCOptions.CompressDebugSections = DebugCompressionType::Zlib;
} else if (!strcmp("zstd", DebugInfoCompression) &&
llvm::compression::zstd::isAvailable()) {
Options.MCOptions.CompressDebugSections = DebugCompressionType::Zstd;
} else if (!strcmp("none", DebugInfoCompression)) {
Options.MCOptions.CompressDebugSections = DebugCompressionType::None;
}

// To avoid fatal errors, make sure the Rust-side code only passes a
// compression kind that is known to be supported by this build of LLVM, via
// `LLVMRustLLVMHasZlibCompression` and `LLVMRustLLVMHasZstdCompression`.
Options.MCOptions.CompressDebugSections = fromRust(DebugInfoCompression);
Options.MCOptions.X86RelaxRelocations = RelaxELFRelocations;
Options.UseInitArray = UseInitArray;
Options.EmulatedTLS = UseEmulatedTls;
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1645,11 +1645,11 @@ extern "C" bool LLVMRustIsNonGVFunctionPointerTy(LLVMValueRef V) {
return false;
}

extern "C" bool LLVMRustLLVMHasZlibCompressionForDebugSymbols() {
extern "C" bool LLVMRustLLVMHasZlibCompression() {
return llvm::compression::zlib::isAvailable();
}

extern "C" bool LLVMRustLLVMHasZstdCompressionForDebugSymbols() {
extern "C" bool LLVMRustLLVMHasZstdCompression() {
return llvm::compression::zstd::isAvailable();
}

Expand Down
11 changes: 0 additions & 11 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,17 +583,6 @@ pub enum DebugInfoCompression {
Zstd,
}

impl ToString for DebugInfoCompression {
fn to_string(&self) -> String {
match self {
DebugInfoCompression::None => "none",
DebugInfoCompression::Zlib => "zlib",
DebugInfoCompression::Zstd => "zstd",
}
.to_owned()
}
}

#[derive(Clone, Copy, Debug, PartialEq, Hash)]
pub enum MirStripDebugInfo {
None,
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_target/src/spec/base/helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use crate::spec::{PanicStrategy, RelroLevel, StackProbeType, TargetOptions};

pub(crate) fn opts() -> TargetOptions {
TargetOptions {
os: "helenos".into(),

dynamic_linking: true,
// we need the linker to keep libgcc and friends
no_default_libraries: false,
has_rpath: true,
relro_level: RelroLevel::Full,
panic_strategy: PanicStrategy::Abort,
stack_probes: StackProbeType::Inline,

..Default::default()
}
}
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/base/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub(crate) mod dragonfly;
pub(crate) mod freebsd;
pub(crate) mod fuchsia;
pub(crate) mod haiku;
pub(crate) mod helenos;
pub(crate) mod hermit;
pub(crate) mod hurd;
pub(crate) mod hurd_gnu;
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,12 @@ supported_targets! {
("i686-unknown-haiku", i686_unknown_haiku),
("x86_64-unknown-haiku", x86_64_unknown_haiku),

("aarch64-unknown-helenos", aarch64_unknown_helenos),
("i686-unknown-helenos", i686_unknown_helenos),
("powerpc-unknown-helenos", powerpc_unknown_helenos),
("sparc64-unknown-helenos", sparc64_unknown_helenos),
("x86_64-unknown-helenos", x86_64_unknown_helenos),

("i686-unknown-hurd-gnu", i686_unknown_hurd_gnu),
("x86_64-unknown-hurd-gnu", x86_64_unknown_hurd_gnu),

Expand Down
22 changes: 22 additions & 0 deletions compiler/rustc_target/src/spec/targets/aarch64_unknown_helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use crate::spec::{Target, base};

pub(crate) fn target() -> Target {
let mut base = base::helenos::opts();
base.max_atomic_width = Some(128);
base.features = "+v8a".into();
base.linker = Some("aarch64-helenos-gcc".into());

Target {
llvm_target: "aarch64-unknown-helenos".into(),
metadata: crate::spec::TargetMetadata {
description: Some("ARM64 HelenOS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
arch: "aarch64".into(),
options: base,
}
}
26 changes: 26 additions & 0 deletions compiler/rustc_target/src/spec/targets/i686_unknown_helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use crate::spec::{Cc, LinkerFlavor, Lld, RustcAbi, Target, base};

pub(crate) fn target() -> Target {
let mut base = base::helenos::opts();
base.cpu = "pentium4".into();
base.max_atomic_width = Some(64);
base.linker = Some("i686-helenos-gcc".into());
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
base.rustc_abi = Some(RustcAbi::X86Sse2);

Target {
llvm_target: "i686-unknown-helenos".into(),
metadata: crate::spec::TargetMetadata {
description: Some("IA-32 (i686) HelenOS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
i128:128-f64:32:64-f80:32-n8:16:32-S128"
.into(),
arch: "x86".into(),
options: base,
}
}
24 changes: 24 additions & 0 deletions compiler/rustc_target/src/spec/targets/powerpc_unknown_helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use rustc_abi::Endian;

use crate::spec::{Target, TargetMetadata, base};

pub(crate) fn target() -> Target {
let mut base = base::helenos::opts();
base.endian = Endian::Big;
base.max_atomic_width = Some(32);
base.linker = Some("ppc-helenos-gcc".into());

Target {
llvm_target: "powerpc-unknown-helenos".into(),
metadata: TargetMetadata {
description: Some("PowerPC HelenOS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "E-m:e-p:32:32-Fn32-i64:64-n32".into(),
arch: "powerpc".into(),
options: base,
}
}
26 changes: 26 additions & 0 deletions compiler/rustc_target/src/spec/targets/sparc64_unknown_helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use rustc_abi::Endian;

use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetMetadata, base};

pub(crate) fn target() -> Target {
let mut base = base::helenos::opts();
base.endian = Endian::Big;
base.cpu = "v9".into();
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
base.max_atomic_width = Some(64);
base.linker = Some("sparc64-helenos-gcc".into());

Target {
llvm_target: "sparc64-unknown-helenos".into(),
metadata: TargetMetadata {
description: Some("SPARC HelenOS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout: "E-m:e-i64:64-i128:128-n32:64-S128".into(),
arch: "sparc64".into(),
options: base,
}
}
25 changes: 25 additions & 0 deletions compiler/rustc_target/src/spec/targets/x86_64_unknown_helenos.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};

pub(crate) fn target() -> Target {
let mut base = base::helenos::opts();
base.cpu = "x86-64".into();
base.plt_by_default = false;
base.max_atomic_width = Some(64);
base.linker = Some("amd64-helenos-gcc".into());
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);

Target {
llvm_target: "x86_64-unknown-helenos".into(),
metadata: crate::spec::TargetMetadata {
description: Some("64-bit HelenOS".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout:
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128".into(),
arch: "x86_64".into(),
options: base,
}
}
Loading
Loading