Skip to content

Commit 0208156

Browse files
committed
Auto merge of #147059 - matthiaskrgr:rollup-44mof1x, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #145113 (resolve: Do not finalize shadowed bindings) - #146523 (Demote both armebv7r-none-* targets.) - #146778 (Use standard attribute logic for allocator shim) - #147016 (fix doc comments to be more standard) - #147027 (Add new `tyalias` intra-doc link disambiguator) - #147031 (mbe: Simplify check_redundant_vis_repetition) - #147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5b9007b + 36ef512 commit 0208156

File tree

43 files changed

+392
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+392
-218
lines changed

bootstrap.example.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -768,16 +768,15 @@
768768
# make this default to false.
769769
#rust.lld = false in all cases, except on `x86_64-unknown-linux-gnu` as described above, where it is true
770770

771-
# Indicates whether LLD will be used to link Rust crates during bootstrap on
772-
# supported platforms.
771+
# Indicates if we should override the linker used to link Rust crates during bootstrap to be LLD.
773772
# If set to `true` or `"external"`, a global `lld` binary that has to be in $PATH
774773
# will be used.
775774
# If set to `"self-contained"`, rust-lld from the snapshot compiler will be used.
776775
#
777776
# On MSVC, LLD will not be used if we're cross linking.
778777
#
779778
# Explicitly setting the linker for a target will override this option when targeting MSVC.
780-
#rust.use-lld = false
779+
#rust.bootstrap-override-lld = false
781780

782781
# Indicates whether some LLVM tools, like llvm-objdump, will be made available in the
783782
# sysroot.
@@ -950,7 +949,7 @@
950949
# Linker to be used to bootstrap Rust code. Note that the
951950
# default value is platform specific, and if not specified it may also depend on
952951
# what platform is crossing to what platform.
953-
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
952+
# Setting this will override the `bootstrap-override-lld` option for Rust code when targeting MSVC.
954953
#linker = "cc" (path)
955954

956955
# Should rustc and the standard library be built with split debuginfo? Default

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,13 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
538538

539539
// If the declaration has an associated instance, compute extra attributes based on that.
540540
if let Some(instance) = instance {
541-
llfn_attrs_from_instance(cx, llfn, instance);
541+
llfn_attrs_from_instance(
542+
cx,
543+
cx.tcx,
544+
llfn,
545+
&cx.tcx.codegen_instance_attrs(instance.def),
546+
Some(instance),
547+
);
542548
}
543549
}
544550

compiler/rustc_codegen_llvm/src/allocator.rs

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ use rustc_ast::expand::allocator::{
55
};
66
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods as _;
77
use rustc_middle::bug;
8+
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
89
use rustc_middle::ty::TyCtxt;
910
use rustc_session::config::{DebugInfo, OomStrategy};
1011
use rustc_symbol_mangling::mangle_internal_symbol;
11-
use smallvec::SmallVec;
1212

13+
use crate::attributes::llfn_attrs_from_instance;
1314
use crate::builder::SBuilder;
1415
use crate::declare::declare_simple_fn;
1516
use crate::llvm::{self, FALSE, TRUE, Type, Value};
16-
use crate::{SimpleCx, attributes, debuginfo, llvm_util};
17+
use crate::{SimpleCx, attributes, debuginfo};
1718

1819
pub(crate) unsafe fn codegen(
1920
tcx: TyCtxt<'_>,
@@ -149,18 +150,8 @@ fn create_wrapper_function(
149150
ty,
150151
);
151152

152-
let mut attrs = SmallVec::<[_; 2]>::new();
153-
154-
let target_cpu = llvm_util::target_cpu(tcx.sess);
155-
let target_cpu_attr = llvm::CreateAttrStringValue(cx.llcx, "target-cpu", target_cpu);
156-
157-
let tune_cpu_attr = llvm_util::tune_cpu(tcx.sess)
158-
.map(|tune_cpu| llvm::CreateAttrStringValue(cx.llcx, "tune-cpu", tune_cpu));
159-
160-
attrs.push(target_cpu_attr);
161-
attrs.extend(tune_cpu_attr);
162-
163-
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &attrs);
153+
let attrs = CodegenFnAttrs::new();
154+
llfn_attrs_from_instance(cx, tcx, llfn, &attrs, None);
164155

165156
let no_return = if no_return {
166157
// -> ! DIFlagNoReturn
@@ -171,12 +162,6 @@ fn create_wrapper_function(
171162
None
172163
};
173164

174-
if tcx.sess.must_emit_unwind_tables() {
175-
let uwtable =
176-
attributes::uwtable_attr(cx.llcx, tcx.sess.opts.unstable_opts.use_sync_unwind);
177-
attributes::apply_to_llfn(llfn, llvm::AttributePlace::Function, &[uwtable]);
178-
}
179-
180165
let llbb = unsafe { llvm::LLVMAppendBasicBlockInContext(cx.llcx, llfn, c"entry".as_ptr()) };
181166
let mut bx = SBuilder::build(&cx, llbb);
182167

0 commit comments

Comments
 (0)