Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #93189

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
528c4f9
Add PanicInfo::can_unwind which indicates whether a panic handler is
Amanieu Dec 18, 2021
fe9dc6e
Change TerminatorKind::Abort to call the panic handler instead of
Amanieu Jan 12, 2022
ecd39aa
Update pulldown-cmark version to fix markdown list issue
GuillaumeGomez Jan 17, 2022
80b26bd
Update dependencies
GuillaumeGomez Jan 19, 2022
8d0d023
Simplify use of `map_or`
oli-obk Jan 20, 2022
1521b53
Increase the format version of rustdoc-json-types
Urgau Jan 20, 2022
c55819a
Make stability interning follow the usual pattern.
nnethercote Jan 20, 2022
d46ed5d
Clarify some code relating to interning and types.
nnethercote Jan 21, 2022
d984287
Add L4Bender as linker variant
humenda Apr 3, 2018
24588e6
Old versions of Android generate SIGSEGV from libc::abort
Amanieu Jan 21, 2022
660d993
adapt L4Bender implementation
atopia May 31, 2021
29d6235
Gate `l4-bender` linker flavor
petrochenkov Jan 7, 2022
888332f
Reject unsupported naked functions
tmiasko Jan 21, 2022
beeba4b
Reject may_unwind option in naked functions
tmiasko Jan 21, 2022
1309088
Disable drop range tracking in generators
eholk Jan 21, 2022
2c2deff
Add regression test for #93161
eholk Jan 21, 2022
f3cec54
update uclibc instructions for new toolchain, add link from platforms…
skrap Jan 21, 2022
ead84d0
Add reference to breakage this works around
eholk Jan 21, 2022
78cee22
Add missing GUI test explanations
GuillaumeGomez Jan 21, 2022
2eb8bfc
rustdoc: remove dashed underline under main heading
jsha Jan 21, 2022
2ad1c73
Rollup merge of #85967 - atopia:update-l4re-target, r=petrochenkov
matthiaskrgr Jan 22, 2022
af29394
Rollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay
matthiaskrgr Jan 22, 2022
d607f89
Rollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid
matthiaskrgr Jan 22, 2022
0706cd4
Rollup merge of #93116 - rust-lang:oli-obk-patch-1, r=jackh726
matthiaskrgr Jan 22, 2022
514723f
Rollup merge of #93132 - Urgau:fix-rustdoc-json-format-version, r=oli…
matthiaskrgr Jan 22, 2022
3fa1e2a
Rollup merge of #93147 - nnethercote:interner-cleanups, r=lcnr
matthiaskrgr Jan 22, 2022
86b4a3e
Rollup merge of #93153 - tmiasko:reject-unsupported-naked-functions, …
matthiaskrgr Jan 22, 2022
0f2488b
Rollup merge of #93165 - eholk:disable-generator-drop-tracking, r=nik…
matthiaskrgr Jan 22, 2022
f2ccb2c
Rollup merge of #93168 - skrap:master, r=Amanieu
matthiaskrgr Jan 22, 2022
a2e8749
Rollup merge of #93170 - GuillaumeGomez:gui-tests-explanations, r=jsha
matthiaskrgr Jan 22, 2022
b0a7732
Rollup merge of #93172 - jsha:re-remove-line, r=camelid
matthiaskrgr Jan 22, 2022
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
25 changes: 7 additions & 18 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ dependencies = [
"clippy_utils",
"if_chain",
"itertools 0.10.1",
"pulldown-cmark 0.9.0",
"pulldown-cmark",
"quine-mc_cluskey",
"regex-syntax",
"rustc-semver",
Expand Down Expand Up @@ -2186,9 +2186,9 @@ dependencies = [

[[package]]
name = "mdbook"
version = "0.4.14"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6e77253c46a90eb7e96b2807201dab941a4db5ea05eca5aaaf7027395f352b3"
checksum = "241f10687eb3b4e0634b3b4e423f97c5f1efbd69dc9522e24a8b94583eeec3c6"
dependencies = [
"ammonia",
"anyhow",
Expand All @@ -2201,7 +2201,7 @@ dependencies = [
"log",
"memchr",
"opener",
"pulldown-cmark 0.8.0",
"pulldown-cmark",
"regex",
"serde",
"serde_derive",
Expand Down Expand Up @@ -2865,27 +2865,16 @@ dependencies = [

[[package]]
name = "pulldown-cmark"
version = "0.8.0"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8"
checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6"
dependencies = [
"bitflags",
"getopts",
"memchr",
"unicase",
]

[[package]]
name = "pulldown-cmark"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acd16514d1af5f7a71f909a44ef253cdb712a376d7ebc8ae4a471a9be9743548"
dependencies = [
"bitflags",
"memchr",
"unicase",
]

[[package]]
name = "punycode"
version = "0.4.1"
Expand Down Expand Up @@ -4440,7 +4429,7 @@ dependencies = [
"expect-test",
"itertools 0.9.0",
"minifier",
"pulldown-cmark 0.9.0",
"pulldown-cmark",
"rayon",
"regex",
"rustdoc-json-types",
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
LinkerFlavor::Lld(_) => "lld",
LinkerFlavor::PtxLinker => "rust-ptx-linker",
LinkerFlavor::BpfLinker => "bpf-linker",
LinkerFlavor::L4Bender => "l4-bender",
}),
flavor,
)),
Expand Down
154 changes: 153 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub fn get_linker<'a>(
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
// to the linker args construction.
assert!(cmd.get_args().is_empty() || sess.target.vendor == "uwp");

match flavor {
LinkerFlavor::Lld(LldFlavor::Link) | LinkerFlavor::Msvc => {
Box::new(MsvcLinker { cmd, sess }) as Box<dyn Linker>
Expand All @@ -149,6 +148,8 @@ pub fn get_linker<'a>(
LinkerFlavor::PtxLinker => Box::new(PtxLinker { cmd, sess }) as Box<dyn Linker>,

LinkerFlavor::BpfLinker => Box::new(BpfLinker { cmd, sess }) as Box<dyn Linker>,

LinkerFlavor::L4Bender => Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>,
}
}

Expand Down Expand Up @@ -1355,6 +1356,157 @@ impl<'a> Linker for WasmLd<'a> {
}
}

/// Linker shepherd script for L4Re (Fiasco)
pub struct L4Bender<'a> {
cmd: Command,
sess: &'a Session,
hinted_static: bool,
}

impl<'a> Linker for L4Bender<'a> {
fn link_dylib(&mut self, _lib: Symbol, _verbatim: bool, _as_needed: bool) {
bug!("dylibs are not supported on L4Re");
}
fn link_staticlib(&mut self, lib: Symbol, _verbatim: bool) {
self.hint_static();
self.cmd.arg(format!("-PC{}", lib));
}
fn link_rlib(&mut self, lib: &Path) {
self.hint_static();
self.cmd.arg(lib);
}
fn include_path(&mut self, path: &Path) {
self.cmd.arg("-L").arg(path);
}
fn framework_path(&mut self, _: &Path) {
bug!("frameworks are not supported on L4Re");
}
fn output_filename(&mut self, path: &Path) {
self.cmd.arg("-o").arg(path);
}

fn add_object(&mut self, path: &Path) {
self.cmd.arg(path);
}

fn full_relro(&mut self) {
self.cmd.arg("-zrelro");
self.cmd.arg("-znow");
}

fn partial_relro(&mut self) {
self.cmd.arg("-zrelro");
}

fn no_relro(&mut self) {
self.cmd.arg("-znorelro");
}

fn cmd(&mut self) -> &mut Command {
&mut self.cmd
}

fn set_output_kind(&mut self, _output_kind: LinkOutputKind, _out_filename: &Path) {}

fn link_rust_dylib(&mut self, _: Symbol, _: &Path) {
panic!("Rust dylibs not supported");
}

fn link_framework(&mut self, _framework: Symbol, _as_needed: bool) {
bug!("frameworks not supported on L4Re");
}

fn link_whole_staticlib(&mut self, lib: Symbol, _verbatim: bool, _search_path: &[PathBuf]) {
self.hint_static();
self.cmd.arg("--whole-archive").arg(format!("-l{}", lib));
self.cmd.arg("--no-whole-archive");
}

fn link_whole_rlib(&mut self, lib: &Path) {
self.hint_static();
self.cmd.arg("--whole-archive").arg(lib).arg("--no-whole-archive");
}

fn gc_sections(&mut self, keep_metadata: bool) {
if !keep_metadata {
self.cmd.arg("--gc-sections");
}
}

fn no_gc_sections(&mut self) {
self.cmd.arg("--no-gc-sections");
}

fn optimize(&mut self) {
// GNU-style linkers support optimization with -O. GNU ld doesn't
// need a numeric argument, but other linkers do.
if self.sess.opts.optimize == config::OptLevel::Default
|| self.sess.opts.optimize == config::OptLevel::Aggressive
{
self.cmd.arg("-O1");
}
}

fn pgo_gen(&mut self) {}

fn debuginfo(&mut self, strip: Strip) {
match strip {
Strip::None => {}
Strip::Debuginfo => {
self.cmd().arg("--strip-debug");
}
Strip::Symbols => {
self.cmd().arg("--strip-all");
}
}
}

fn no_default_libraries(&mut self) {
self.cmd.arg("-nostdlib");
}

fn export_symbols(&mut self, _: &Path, _: CrateType, _: &[String]) {
// ToDo, not implemented, copy from GCC
self.sess.warn("exporting symbols not implemented yet for L4Bender");
return;
}

fn subsystem(&mut self, subsystem: &str) {
self.cmd.arg(&format!("--subsystem {}", subsystem));
}

fn reset_per_library_state(&mut self) {
self.hint_static(); // Reset to default before returning the composed command line.
}

fn group_start(&mut self) {
self.cmd.arg("--start-group");
}

fn group_end(&mut self) {
self.cmd.arg("--end-group");
}

fn linker_plugin_lto(&mut self) {}

fn control_flow_guard(&mut self) {}

fn no_crt_objects(&mut self) {}
}

impl<'a> L4Bender<'a> {
pub fn new(cmd: Command, sess: &'a Session) -> L4Bender<'a> {
L4Bender { cmd: cmd, sess: sess, hinted_static: false }
}

fn hint_static(&mut self) {
if !self.hinted_static {
self.cmd.arg("-static");
self.hinted_static = true;
}
}
}

pub(crate) fn exported_symbols(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> {
if let Some(ref exports) = tcx.sess.target.override_export_symbols {
return exports.clone();
Expand Down
27 changes: 23 additions & 4 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,28 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
helper.do_call(self, &mut bx, fn_abi, llfn, &args, None, cleanup);
}

fn codegen_abort_terminator(
&mut self,
helper: TerminatorCodegenHelper<'tcx>,
mut bx: Bx,
terminator: &mir::Terminator<'tcx>,
) {
let span = terminator.source_info.span;
self.set_debug_loc(&mut bx, terminator.source_info);

// Get the location information.
let location = self.get_caller_location(&mut bx, terminator.source_info).immediate();

// Obtain the panic entry point.
let def_id = common::langcall(bx.tcx(), Some(span), "", LangItem::PanicNoUnwind);
let instance = ty::Instance::mono(bx.tcx(), def_id);
let fn_abi = bx.fn_abi_of_instance(instance, ty::List::empty());
let llfn = bx.get_fn_addr(instance);

// Codegen the actual panic invoke/call.
helper.do_call(self, &mut bx, fn_abi, llfn, &[location], None, None);
}

/// Returns `true` if this is indeed a panic intrinsic and codegen is done.
fn codegen_panic_intrinsic(
&mut self,
Expand Down Expand Up @@ -1014,10 +1036,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::TerminatorKind::Resume => self.codegen_resume_terminator(helper, bx),

mir::TerminatorKind::Abort => {
bx.abort();
// `abort` does not terminate the block, so we still need to generate
// an `unreachable` terminator after it.
bx.unreachable();
self.codegen_abort_terminator(helper, bx, terminator);
}

mir::TerminatorKind::Goto { target } => {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ E0783: include_str!("./error_codes/E0783.md"),
E0784: include_str!("./error_codes/E0784.md"),
E0785: include_str!("./error_codes/E0785.md"),
E0786: include_str!("./error_codes/E0786.md"),
E0787: include_str!("./error_codes/E0787.md"),
;
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard
Expand Down
28 changes: 28 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0787.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
An unsupported naked function definition.

Erroneous code example:

```compile_fail,E0787
#![feature(naked_functions)]

#[naked]
pub extern "C" fn f() -> u32 {
42
}
```

The naked functions must be defined using a single inline assembly
block.

The execution must never fall through past the end of the assembly
code so the block must use `noreturn` option. The asm block can also
use `att_syntax` and `raw` options, but others options are not allowed.

The asm block must not contain any operands other than `const` and
`sym`.

### Additional information

For more information, please see [RFC 2972].

[RFC 2972]: https://github.com/rust-lang/rfcs/blob/master/text/2972-constrained-naked.md
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ language_item_table! {
PanicInfo, sym::panic_info, panic_info, Target::Struct, GenericRequirement::None;
PanicLocation, sym::panic_location, panic_location, Target::Struct, GenericRequirement::None;
PanicImpl, sym::panic_impl, panic_impl, Target::Fn, GenericRequirement::None;
PanicNoUnwind, sym::panic_no_unwind, panic_no_unwind, Target::Fn, GenericRequirement::Exact(0);
/// libstd panic entry point. Necessary for const eval to be able to catch it
BeginPanic, sym::begin_panic, begin_panic_fn, Target::Fn, GenericRequirement::None;

Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
<https://github.com/rust-lang/rust/issues/59014> for more information",
);
store.register_removed("plugin_as_library", "plugins have been deprecated and retired");
store.register_removed(
"unsupported_naked_functions",
"converted into hard error, see RFC 2972 \
<https://github.com/rust-lang/rfcs/blob/master/text/2972-constrained-naked.md> for more information",
);
}

fn register_internals(store: &mut LintStore) {
Expand Down
Loading