Auto merge of #136728 - matthiaskrgr:rollup-x2qh9yt, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #136640 (Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit) - #136648 (Add a missing `//@ needs-symlink` to `tests/run-make/libs-through-symlinks`) - #136651 (Label mismatched parameters at the def site for foreign functions) - #136691 (Remove Linkage::Private and Linkage::Appending) - #136692 (add module level doc for bootstrap:utils:exec) - #136700 (i686-unknown-hurd-gnu: bump baseline CPU to Pentium 4) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
8ad2c9724d
25 changed files with 70 additions and 51 deletions
|
|
@ -49,9 +49,7 @@ pub fn global_linkage_to_gcc(linkage: Linkage) -> GlobalKind {
|
|||
Linkage::LinkOnceODR => unimplemented!(),
|
||||
Linkage::WeakAny => unimplemented!(),
|
||||
Linkage::WeakODR => unimplemented!(),
|
||||
Linkage::Appending => unimplemented!(),
|
||||
Linkage::Internal => GlobalKind::Internal,
|
||||
Linkage::Private => GlobalKind::Internal,
|
||||
Linkage::ExternalWeak => GlobalKind::Imported, // TODO(antoyo): should be weak linkage.
|
||||
Linkage::Common => unimplemented!(),
|
||||
}
|
||||
|
|
@ -66,9 +64,7 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
|
|||
Linkage::LinkOnceODR => unimplemented!(),
|
||||
Linkage::WeakAny => FunctionType::Exported, // FIXME(antoyo): should be similar to linkonce.
|
||||
Linkage::WeakODR => unimplemented!(),
|
||||
Linkage::Appending => unimplemented!(),
|
||||
Linkage::Internal => FunctionType::Internal,
|
||||
Linkage::Private => FunctionType::Internal,
|
||||
Linkage::ExternalWeak => unimplemented!(),
|
||||
Linkage::Common => unimplemented!(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,10 +61,7 @@ impl<'gcc, 'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||
// compiler-rt, then we want to implicitly compile everything with hidden
|
||||
// visibility as we're going to link this object all over the place but
|
||||
// don't want the symbols to get exported.
|
||||
if linkage != Linkage::Internal
|
||||
&& linkage != Linkage::Private
|
||||
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
|
||||
{
|
||||
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
|
||||
#[cfg(feature = "master")]
|
||||
decl.add_attribute(FnAttribute::Visibility(gccjit::Visibility::Hidden));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -157,9 +157,7 @@ pub(crate) fn linkage_to_llvm(linkage: Linkage) -> llvm::Linkage {
|
|||
Linkage::LinkOnceODR => llvm::Linkage::LinkOnceODRLinkage,
|
||||
Linkage::WeakAny => llvm::Linkage::WeakAnyLinkage,
|
||||
Linkage::WeakODR => llvm::Linkage::WeakODRLinkage,
|
||||
Linkage::Appending => llvm::Linkage::AppendingLinkage,
|
||||
Linkage::Internal => llvm::Linkage::InternalLinkage,
|
||||
Linkage::Private => llvm::Linkage::PrivateLinkage,
|
||||
Linkage::ExternalWeak => llvm::Linkage::ExternalWeakLinkage,
|
||||
Linkage::Common => llvm::Linkage::CommonLinkage,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,19 +319,16 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
|
|||
// This is actually a function pointer, so wrap it in pointer DI.
|
||||
let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
|
||||
let (size, align) = match fn_ty.kind() {
|
||||
ty::FnDef(..) => (0, 1),
|
||||
ty::FnPtr(..) => (
|
||||
cx.tcx.data_layout.pointer_size.bits(),
|
||||
cx.tcx.data_layout.pointer_align.abi.bits() as u32,
|
||||
),
|
||||
ty::FnDef(..) => (Size::ZERO, Align::ONE),
|
||||
ty::FnPtr(..) => (cx.tcx.data_layout.pointer_size, cx.tcx.data_layout.pointer_align.abi),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let di_node = unsafe {
|
||||
llvm::LLVMRustDIBuilderCreatePointerType(
|
||||
DIB(cx),
|
||||
fn_di_node,
|
||||
size,
|
||||
align,
|
||||
size.bits(),
|
||||
align.bits() as u32,
|
||||
0, // Ignore DWARF address space.
|
||||
name.as_c_char_ptr(),
|
||||
name.len(),
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
true,
|
||||
DIFlags::FlagZero,
|
||||
argument_index,
|
||||
align.bytes() as u32,
|
||||
align.bits() as u32,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,7 @@ impl<'tcx> PreDefineCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
|
|||
// compiler-rt, then we want to implicitly compile everything with hidden
|
||||
// visibility as we're going to link this object all over the place but
|
||||
// don't want the symbols to get exported.
|
||||
if linkage != Linkage::Internal
|
||||
&& linkage != Linkage::Private
|
||||
&& self.tcx.is_compiler_builtins(LOCAL_CRATE)
|
||||
{
|
||||
if linkage != Linkage::Internal && self.tcx.is_compiler_builtins(LOCAL_CRATE) {
|
||||
llvm::set_visibility(lldecl, llvm::Visibility::Hidden);
|
||||
} else {
|
||||
llvm::set_visibility(lldecl, base::visibility_to_llvm(visibility));
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
|
|||
// ghost, dllimport, dllexport and linkonce_odr_autohide are not supported
|
||||
// and don't have to be, LLVM treats them as no-ops.
|
||||
match name {
|
||||
"appending" => Appending,
|
||||
"available_externally" => AvailableExternally,
|
||||
"common" => Common,
|
||||
"extern_weak" => ExternalWeak,
|
||||
|
|
@ -49,7 +48,6 @@ fn linkage_by_name(tcx: TyCtxt<'_>, def_id: LocalDefId, name: &str) -> Linkage {
|
|||
"internal" => Internal,
|
||||
"linkonce" => LinkOnceAny,
|
||||
"linkonce_odr" => LinkOnceODR,
|
||||
"private" => Private,
|
||||
"weak" => WeakAny,
|
||||
"weak_odr" => WeakODR,
|
||||
_ => tcx.dcx().span_fatal(tcx.def_span(def_id), "invalid linkage specified"),
|
||||
|
|
|
|||
|
|
@ -187,10 +187,9 @@ fn prefix_and_suffix<'tcx>(
|
|||
}
|
||||
}
|
||||
}
|
||||
Linkage::Internal | Linkage::Private => {
|
||||
Linkage::Internal => {
|
||||
// write nothing
|
||||
}
|
||||
Linkage::Appending => emit_fatal("Only global variables can have appending linkage!"),
|
||||
Linkage::Common => emit_fatal("Functions may not have common linkage"),
|
||||
Linkage::AvailableExternally => {
|
||||
// this would make the function equal an extern definition
|
||||
|
|
|
|||
|
|
@ -2641,8 +2641,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// Returns the parameters of a function, with their generic parameters if those are the full
|
||||
/// type of that parameter. Returns `None` if the function has no generics or the body is
|
||||
/// unavailable (eg is an instrinsic).
|
||||
/// type of that parameter.
|
||||
///
|
||||
/// Returns `None` if the body is not a named function (e.g. a closure).
|
||||
fn get_hir_param_info(
|
||||
&self,
|
||||
def_id: DefId,
|
||||
|
|
@ -2667,6 +2668,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
kind: hir::ItemKind::Fn { sig, generics, body, .. },
|
||||
..
|
||||
}) => (sig, generics, Some(body), None),
|
||||
hir::Node::ForeignItem(&hir::ForeignItem {
|
||||
kind: hir::ForeignItemKind::Fn(sig, params, generics),
|
||||
..
|
||||
}) => (sig, generics, None, Some(params)),
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
|
|
@ -2700,7 +2705,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
))
|
||||
}
|
||||
(None, Some(params)) => {
|
||||
let params = params.get(is_method as usize..)?;
|
||||
let params =
|
||||
params.get(is_method as usize..params.len() - sig.decl.c_variadic as usize)?;
|
||||
debug_assert_eq!(params.len(), fn_inputs.len());
|
||||
Some((
|
||||
fn_inputs.zip(params.iter().map(|param| FnParam::Name(param))).collect(),
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ impl CodegenFnAttrs {
|
|||
|| match self.linkage {
|
||||
// These are private, so make sure we don't try to consider
|
||||
// them external.
|
||||
None | Some(Linkage::Internal | Linkage::Private) => false,
|
||||
None | Some(Linkage::Internal) => false,
|
||||
Some(_) => true,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,9 +327,7 @@ pub enum Linkage {
|
|||
LinkOnceODR,
|
||||
WeakAny,
|
||||
WeakODR,
|
||||
Appending,
|
||||
Internal,
|
||||
Private,
|
||||
ExternalWeak,
|
||||
Common,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1238,9 +1238,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitio
|
|||
Linkage::LinkOnceODR => "OnceODR",
|
||||
Linkage::WeakAny => "WeakAny",
|
||||
Linkage::WeakODR => "WeakODR",
|
||||
Linkage::Appending => "Appending",
|
||||
Linkage::Internal => "Internal",
|
||||
Linkage::Private => "Private",
|
||||
Linkage::ExternalWeak => "ExternalWeak",
|
||||
Linkage::Common => "Common",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
|
|||
|
||||
pub(crate) fn target() -> Target {
|
||||
let mut base = base::hurd_gnu::opts();
|
||||
base.cpu = "pentiumpro".into();
|
||||
base.cpu = "pentium4".into();
|
||||
base.max_atomic_width = Some(64);
|
||||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]);
|
||||
base.stack_probes = StackProbeType::Inline;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
//! Command Execution Module
|
||||
//!
|
||||
//! This module provides a structured way to execute and manage commands efficiently,
|
||||
//! ensuring controlled failure handling and output management.
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::path::Path;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ target | std | host | notes
|
|||
[`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86 (original Pentium) [^x86_32-floats-x87]
|
||||
[`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI]
|
||||
`i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (PentiumPro) [^x86_32-floats-x87]
|
||||
[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (Pentium 4) [^x86_32-floats-x87]
|
||||
[`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD (Pentium 4) [^x86_32-floats-return-ABI]
|
||||
[`i686-unknown-redox`](platform-support/redox.md) | ✓ | | i686 Redox OS (PentiumPro) [^x86_32-floats-x87]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
// Verify that `i32::cmp` FnDef type is declared with size 0 and align 1 in LLVM debuginfo.
|
||||
// Verify that `i32::cmp` FnDef type is declared with a size of 0 and an
|
||||
// alignment of 8 bits (1 byte) in LLVM debuginfo.
|
||||
|
||||
//@ compile-flags: -O -g -Cno-prepopulate-passes
|
||||
//@ ignore-msvc the types are mangled differently
|
||||
|
||||
|
|
@ -14,5 +16,5 @@ pub fn main() {
|
|||
|
||||
// CHECK: %compare.dbg.spill = alloca [0 x i8], align 1
|
||||
// CHECK: dbg{{.}}declare({{(metadata )?}}ptr %compare.dbg.spill, {{(metadata )?}}![[VAR:.*]], {{(metadata )?}}!DIExpression()
|
||||
// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 1, dwarfAddressSpace: {{.*}})
|
||||
// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 1)
|
||||
// CHECK: ![[TYPE:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "fn(&i32, &i32) -> core::cmp::Ordering", baseType: !{{.*}}, align: 8, dwarfAddressSpace: {{.*}})
|
||||
// CHECK: ![[VAR]] = !DILocalVariable(name: "compare", scope: !{{.*}}, file: !{{.*}}, line: {{.*}}, type: ![[TYPE]], align: 8)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//! <https://github.com/rust-lang/rust/pull/13903>.
|
||||
|
||||
//@ ignore-cross-compile
|
||||
//@ needs-symlink
|
||||
|
||||
use run_make_support::{bare_rustc, cwd, path, rfs, rust_lib_name};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ note: function defined here
|
|||
--> $DIR/extern-fn-arg-names.rs:2:8
|
||||
|
|
||||
LL | fn dstfn(src: i32, dst: err);
|
||||
| ^^^^^
|
||||
| ^^^^^ ---
|
||||
help: provide the argument
|
||||
|
|
||||
LL | dstfn(1, /* dst */);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ note: function defined here
|
|||
--> $DIR/variadic-ffi-1.rs:15:8
|
||||
|
|
||||
LL | fn foo(f: isize, x: u8, ...);
|
||||
| ^^^
|
||||
| ^^^ - -
|
||||
help: provide the arguments
|
||||
|
|
||||
LL | foo(/* isize */, /* u8 */);
|
||||
|
|
@ -30,7 +30,7 @@ note: function defined here
|
|||
--> $DIR/variadic-ffi-1.rs:15:8
|
||||
|
|
||||
LL | fn foo(f: isize, x: u8, ...);
|
||||
| ^^^
|
||||
| ^^^ -
|
||||
help: provide the argument
|
||||
|
|
||||
LL | foo(1, /* u8 */);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ note: function defined here
|
|||
--> $DIR/E0060.rs:2:8
|
||||
|
|
||||
LL | fn printf(_: *const u8, ...) -> u32;
|
||||
| ^^^^^^
|
||||
| ^^^^^^ -
|
||||
help: provide the argument
|
||||
|
|
||||
LL | unsafe { printf(/* *const u8 */); }
|
||||
|
|
|
|||
11
tests/ui/fn/param-mismatch-foreign.rs
Normal file
11
tests/ui/fn/param-mismatch-foreign.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extern "C" {
|
||||
fn foo(x: i32, y: u32, z: i32);
|
||||
//~^ NOTE function defined here
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo(1i32, 2i32);
|
||||
//~^ ERROR this function takes 3 arguments but 2 arguments were supplied
|
||||
//~| NOTE argument #2 of type `u32` is missing
|
||||
//~| HELP provide the argument
|
||||
}
|
||||
19
tests/ui/fn/param-mismatch-foreign.stderr
Normal file
19
tests/ui/fn/param-mismatch-foreign.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0061]: this function takes 3 arguments but 2 arguments were supplied
|
||||
--> $DIR/param-mismatch-foreign.rs:7:5
|
||||
|
|
||||
LL | foo(1i32, 2i32);
|
||||
| ^^^ ---- argument #2 of type `u32` is missing
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/param-mismatch-foreign.rs:2:8
|
||||
|
|
||||
LL | fn foo(x: i32, y: u32, z: i32);
|
||||
| ^^^ -
|
||||
help: provide the argument
|
||||
|
|
||||
LL | foo(1i32, /* u32 */, 2i32);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0061`.
|
||||
|
|
@ -18,9 +18,6 @@ pub static TEST4: bool = true;
|
|||
#[linkage = "linkonce_odr"]
|
||||
pub static TEST5: bool = true;
|
||||
|
||||
#[linkage = "private"]
|
||||
pub static TEST6: bool = true;
|
||||
|
||||
#[linkage = "weak"]
|
||||
pub static TEST7: bool = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ note: function defined here
|
|||
--> $DIR/issue-26480.rs:2:8
|
||||
|
|
||||
LL | fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64;
|
||||
| ^^^^^
|
||||
| ^^^^^ -----
|
||||
= note: this error originates in the macro `write` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
||||
|
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ note: function defined here
|
|||
--> $DIR/suggest-null-ptr.rs:7:8
|
||||
|
|
||||
LL | fn foo(ptr: *const u8);
|
||||
| ^^^
|
||||
| ^^^ ---
|
||||
help: if you meant to create a null pointer, use `std::ptr::null()`
|
||||
|
|
||||
LL | foo(std::ptr::null());
|
||||
|
|
@ -32,7 +32,7 @@ note: function defined here
|
|||
--> $DIR/suggest-null-ptr.rs:9:8
|
||||
|
|
||||
LL | fn foo_mut(ptr: *mut u8);
|
||||
| ^^^^^^^
|
||||
| ^^^^^^^ ---
|
||||
help: if you meant to create a null pointer, use `std::ptr::null_mut()`
|
||||
|
|
||||
LL | foo_mut(std::ptr::null_mut());
|
||||
|
|
@ -52,7 +52,7 @@ note: function defined here
|
|||
--> $DIR/suggest-null-ptr.rs:11:8
|
||||
|
|
||||
LL | fn usize(ptr: *const usize);
|
||||
| ^^^^^
|
||||
| ^^^^^ ---
|
||||
help: if you meant to create a null pointer, use `std::ptr::null()`
|
||||
|
|
||||
LL | usize(std::ptr::null());
|
||||
|
|
@ -72,7 +72,7 @@ note: function defined here
|
|||
--> $DIR/suggest-null-ptr.rs:13:8
|
||||
|
|
||||
LL | fn usize_mut(ptr: *mut usize);
|
||||
| ^^^^^^^^^
|
||||
| ^^^^^^^^^ ---
|
||||
help: if you meant to create a null pointer, use `std::ptr::null_mut()`
|
||||
|
|
||||
LL | usize_mut(std::ptr::null_mut());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue