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

Built in llvm #22

Closed
wants to merge 69 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
3887b33
[beta] 1.39 is now beta
Mark-Simulacrum Sep 24, 2019
9689670
Auto merge of #64740 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors Sep 24, 2019
f0f6d31
Bootstrap from released rust
Mark-Simulacrum Sep 26, 2019
ab71728
Fix #64744 -- handle zero sub-pats case.
Centril Sep 24, 2019
1a5c963
relnotes: make compatibility section more sterile and fix rustc version
pietroalbini Sep 24, 2019
2ff6c65
Backport #64599 to beta: rustdoc render async function re-export
csmoe Sep 19, 2019
75f6517
[BETA] Update cargo
alexcrichton Sep 25, 2019
5752b63
Auto merge of #64814 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
bors Sep 27, 2019
0e22a3f
[BETA] Update cargo
alexcrichton Oct 1, 2019
0f89371
update rtpSpawn's parameters type(It's prototype has been updated in …
bpangWR Sep 26, 2019
3449c45
Fix div_duration() marked as stable by mistake
JMS55 Sep 26, 2019
4ba72ad
Use https for curl when building for linux
tmandry Sep 28, 2019
f36b555
remove rtp.rs, and move rtpSpawn and RTP_ID_ERROR to libc
bpangWR Sep 23, 2019
845f486
Rollup merge of #64956 - alexcrichton:update-beta-cargo, r=ehuss
tmandry Oct 2, 2019
6d9465a
Rollup merge of #64982 - tmandry:beta-backport, r=tmandry
tmandry Oct 2, 2019
fa5c2f3
Auto merge of #64983 - tmandry:rollup-28hyqet, r=tmandry
bors Oct 2, 2019
8aacf98
Backport rust-lang/rust-clippy#4590 to rustc beta
flip1995 Oct 11, 2019
224f0bc
Auto merge of #65305 - flip1995:clippy-beta-backport, r=pietroalbini
bors Oct 15, 2019
d45ca22
Add troubleshooting section to PGO chapter in rustc book.
michaelwoerister Oct 14, 2019
edcc7af
Auto merge of #65302 - msizanoen1:fix-armv7-segfault, r=alexcrichton
bors Oct 20, 2019
36ef9d7
Add expanded type cache to OpaqueTypeExpander
tmandry Oct 10, 2019
e9978cf
Only expand types that contain projections
tmandry Oct 10, 2019
cf05730
use precalculated dominators in explain_borrow
tanriol Oct 6, 2019
42c5024
Ensure that associated `async fn`s have unique fresh param names
matthewjasper Oct 5, 2019
2b88722
Account for macro invocation in `let mut $pat` diagnostic.
Centril Oct 5, 2019
8bf21c1
Auto merge of #65020 - pnkfelix:targetted-fix-for-always-marking-rust…
bors Oct 12, 2019
da27cc9
typeck: silence unreachable code from await
davidtwco Sep 30, 2019
3455abb
async/await: improve obligation errors
davidtwco Sep 25, 2019
22694dc
syntax: fix #64682.
Centril Sep 29, 2019
e31afd3
Upgrade async/await to "used" keywords.
ehuss Sep 28, 2019
db3b85c
Filter out stmts made for the redundant_semicolon lint when pretty-pr…
nathanwhit Sep 12, 2019
c2bf2ca
Add test for redundant_semicolon lint interaction with proc macro attrs
nathanwhit Sep 28, 2019
6031a8a
Fix async/await ICE #64964
sinkuu Oct 2, 2019
f7b45be
Do not collect to vec for debug output
sinkuu Oct 2, 2019
de58c33
Pacify tidy
Mark-Simulacrum Oct 24, 2019
336464a
workaround msys2 bug
mati865 Oct 24, 2019
ba9b8be
Revert "Auto merge of #62948 - matklad:failable-file-loading, r=petro…
matklad Oct 10, 2019
6bd9305
Use empty typeck tables when nesting on items without those
Xanewok Oct 4, 2019
f17c36e
Test an assoc. type in struct member def inside fn
Xanewok Oct 12, 2019
6b753f6
Nest typeck tables when processing struct member types
Xanewok Oct 12, 2019
b561cd1
save-analysis: Nest tables when processing impl items
Xanewok Oct 17, 2019
da12236
save-analysis: Add a relevant test case
Xanewok Oct 17, 2019
4377d2e
Avoid ICE when checking `Destination` of `break` inside a closure
estebank Oct 17, 2019
4aa1e7a
Avoid ICE when adjusting bad self ty
estebank Oct 24, 2019
23f8f65
Auto merge of #65708 - Mark-Simulacrum:beta-backports, r=pietroalbini
bors Oct 26, 2019
b606402
ci: revert msys2 ca-certificates hack
pietroalbini Oct 30, 2019
f6404c5
Auto merge of #65956 - pietroalbini:beta-revert-msys2-hack, r=Mark-Si…
bors Oct 30, 2019
43ceeb2
save-analysis: Account for async desugaring in async fn return types
Xanewok Oct 29, 2019
a541c36
changing non-empty glob must import something to a lint
traxys Oct 27, 2019
559ebaf
Updated RELEASES.md for 1.39.0
XAMPPRocky Sep 28, 2019
710e468
This disables the asmjs builder for beta
Mark-Simulacrum Nov 2, 2019
5242afe
Auto merge of #66011 - Mark-Simulacrum:beta-backport, r=pietroalbini
bors Nov 2, 2019
4810c25
1.39.0 release
Mark-Simulacrum Nov 4, 2019
4560ea7
Auto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
bors Nov 4, 2019
37c2a66
The xtensa triples are recognized by the compiler. Need to implement …
MabezDev Mar 5, 2019
9eca2e2
Preliminary call abi for xtensa, it almost certainly has mistakes/ mi…
MabezDev Mar 5, 2019
4e8903b
Tweaks to the xtensa call abi, small arrays arguments still need to b…
MabezDev Mar 7, 2019
b401dfc
Add built in target, based on msp430. This uses external gcc to gener…
MabezDev Mar 12, 2019
aa441cb
Add xtensa-esp32-none-elf, xtensa-esp8266-none-elf targets. Remove xt…
MabezDev May 27, 2019
76041e3
Update README.md
MabezDev May 31, 2019
8e18ddb
Merge pull request #3 from 0ndorio/fix/register_calculation
MabezDev Jul 25, 2019
dd8b6ad
Merge pull request #10 from chocol4te/tidy_fix
MabezDev Nov 11, 2019
4d9271c
Merge pull request #12 from chocol4te/xtensa_1.39
MabezDev Dec 7, 2019
728fd70
Fix ESP8266 linker.
reitermarkus Dec 4, 2019
cf75e7f
Merge pull request #15 from reitermarkus/esp8266-linker
MabezDev Dec 7, 2019
f130b0a
Changes for the new 9.x llvm fork
MabezDev Jan 18, 2020
ef5e2cb
Swap llvm submodule for the fork. Switch back to gcc default linker
MabezDev Jan 25, 2020
2d78a7f
xtensa:llvm:
MabezDev Jan 25, 2020
5482137
Update llvm-fork
MabezDev Feb 17, 2020
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
Prev Previous commit
Next Next commit
Auto merge of rust-lang#65020 - pnkfelix:targetted-fix-for-always-mar…
…king-rust-abi-unwind-issue-64655, r=alexcrichton

Always mark rust and rust-call abi's as unwind

PR rust-lang#63909 identified a bug that had been injected by PR rust-lang#55982. As discussed on rust-lang#64655 (comment) , we started marking extern items as nounwind, *even* extern items that said they were using "Rust" or "rust-call" ABI.

This is a more targeted variant of PR rust-lang#63909 that fixes the above bug.

Fix rust-lang#64655

----

I personally suspect we will want PR rust-lang#63909 to land in the long-term

But:
 *  it is not certain that PR rust-lang#63909 *will* land,
 * more importantly, PR rust-lang#63909 almost certainly will not be backported to beta/stable.

The identified bug was more severe than I think anyone realized (apart from perhaps @gnzlbg, as noted [here](rust-lang#63909 (comment))).

Thus, I was motivated to write this PR, which fixes *just* the issue with extern rust/rust-call functions, and deliberately avoids injecting further deviation from current behavior (you can see further notes on this in the comments of the code added here).
bors authored and Mark-Simulacrum committed Oct 22, 2019
commit 8bf21c1c230a7070d928e187f4319bf8b74c6141
52 changes: 39 additions & 13 deletions src/librustc_codegen_llvm/attributes.rs
Original file line number Diff line number Diff line change
@@ -273,25 +273,51 @@ pub fn from_fn_attrs(
} else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) {
// Special attribute for allocator functions, which can't unwind
false
} else if let Some(id) = id {
} else if let Some(_) = id {
// rust-lang/rust#64655, rust-lang/rust#63909: to minimize
// risk associated with changing cases where nounwind
// attribute is attached, this code is deliberately mimicking
// old control flow based on whether `id` is `Some` or `None`.
//
// However, in the long term we should either:
// - fold this into final else (i.e. stop inspecting `id`)
// - or, adopt Rust PR #63909.
//
// see also Rust RFC 2753.

let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);
if cx.tcx.is_foreign_item(id) {
// Foreign items like `extern "C" { fn foo(); }` are assumed not to
// unwind
false
} else if sig.abi != Abi::Rust && sig.abi != Abi::RustCall {
// Any items defined in Rust that *don't* have the `extern` ABI are
// defined to not unwind. We insert shims to abort if an unwind
// happens to enforce this.
false
} else {
// Anything else defined in Rust is assumed that it can possibly
// unwind
if sig.abi == Abi::Rust || sig.abi == Abi::RustCall {
// Any Rust method (or `extern "Rust" fn` or `extern
// "rust-call" fn`) is explicitly allowed to unwind
// (unless it has no-unwind attribute, handled above).
true
} else {
// Anything else is either:
//
// 1. A foreign item using a non-Rust ABI (like `extern "C" { fn foo(); }`), or
//
// 2. A Rust item using a non-Rust ABI (like `extern "C" fn foo() { ... }`).
//
// Foreign items (case 1) are assumed to not unwind; it is
// UB otherwise. (At least for now; see also
// rust-lang/rust#63909 and Rust RFC 2753.)
//
// Items defined in Rust with non-Rust ABIs (case 2) are also
// not supposed to unwind. Whether this should be enforced
// (versus stating it is UB) and *how* it would be enforced
// is currently under discussion; see rust-lang/rust#58794.
//
// In either case, we mark item as explicitly nounwind.
false
}
} else {
// assume this can possibly unwind, avoiding the application of a
// `nounwind` attribute below.
//
// (But: See comments in previous branch. Specifically, it is
// unclear whether there is real value in the assumption this
// can unwind. The conservatism here may just be papering over
// a real problem by making some UB a bit harder to hit.)
true
});

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
// ignore-emscripten no threads support

// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine
// should still run destructors as it unwinds the stack. However,
// bugs with how the nounwind LLVM attribute was applied led to this
// simple case being mishandled *if* you had fat LTO turned on.

// Unlike issue-64655-extern-rust-must-allow-unwind.rs, the issue
// embodied in this test cropped up regardless of optimization level.
// Therefore it seemed worthy of being enshrined as a dedicated unit
// test.

// LTO settings cannot be combined with -C prefer-dynamic
// no-prefer-dynamic

// The revisions just enumerate lto settings (the opt-level appeared irrelevant in practice)

// revisions: no thin fat
//[no]compile-flags: -C lto=no
//[thin]compile-flags: -C lto=thin
//[fat]compile-flags: -C lto=fat

#![feature(core_panic)]

// (For some reason, reproducing the LTO issue requires pulling in std
// explicitly this way.)
#![no_std]
extern crate std;

fn main() {
use std::sync::atomic::{AtomicUsize, Ordering};
use std::boxed::Box;

static SHARED: AtomicUsize = AtomicUsize::new(0);

assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 0);

let old_hook = std::panic::take_hook();

std::panic::set_hook(Box::new(|_| { } )); // no-op on panic.

let handle = std::thread::spawn(|| {
struct Droppable;
impl Drop for Droppable {
fn drop(&mut self) {
SHARED.fetch_add(1, Ordering::SeqCst);
}
}

let _guard = Droppable;
let s = "issue-64655-allow-unwind-when-calling-panic-directly.rs";
core::panicking::panic(&("???", s, 17, 4));
});

let wait = handle.join();

// Reinstate handler to ease observation of assertion failures.
std::panic::set_hook(old_hook);

assert!(wait.is_err());

assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 1);
}
83 changes: 83 additions & 0 deletions src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// run-pass
// ignore-wasm32-bare compiled with panic=abort by default
// ignore-emscripten no threads support

// rust-lang/rust#64655: with panic=unwind, a panic from a subroutine
// should still run destructors as it unwinds the stack. However,
// bugs with how the nounwind LLVM attribute was applied led to this
// simple case being mishandled *if* you had optimization *and* fat
// LTO turned on.

// This test is the closest thing to a "regression test" we can do
// without actually spawning subprocesses and comparing stderr
// results.
//
// This test takes the code from the above issue and adapts it to
// better fit our test infrastructure:
//
// * Instead of relying on `println!` to observe whether the destructor
// is run, we instead run the code in a spawned thread and
// communicate the destructor's operation via a synchronous atomic
// in static memory.
//
// * To keep the output from confusing a casual user, we override the
// panic hook to be a no-op (rather than printing a message to
// stderr).
//
// (pnkfelix has confirmed by hand that these additions do not mask
// the underlying bug.)

// LTO settings cannot be combined with -C prefer-dynamic
// no-prefer-dynamic

// The revisions combine each lto setting with each optimization
// setting; pnkfelix observed three differing behaviors at opt-levels
// 0/1/2+3 for this test, so it seems prudent to be thorough.

// revisions: no0 no1 no2 no3 thin0 thin1 thin2 thin3 fat0 fat1 fat2 fat3

//[no0]compile-flags: -C opt-level=0 -C lto=no
//[no1]compile-flags: -C opt-level=1 -C lto=no
//[no2]compile-flags: -C opt-level=2 -C lto=no
//[no3]compile-flags: -C opt-level=3 -C lto=no
//[thin0]compile-flags: -C opt-level=0 -C lto=thin
//[thin1]compile-flags: -C opt-level=1 -C lto=thin
//[thin2]compile-flags: -C opt-level=2 -C lto=thin
//[thin3]compile-flags: -C opt-level=3 -C lto=thin
//[fat0]compile-flags: -C opt-level=0 -C lto=fat
//[fat1]compile-flags: -C opt-level=1 -C lto=fat
//[fat2]compile-flags: -C opt-level=2 -C lto=fat
//[fat3]compile-flags: -C opt-level=3 -C lto=fat

fn main() {
use std::sync::atomic::{AtomicUsize, Ordering};

static SHARED: AtomicUsize = AtomicUsize::new(0);

assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 0);

let old_hook = std::panic::take_hook();

std::panic::set_hook(Box::new(|_| { } )); // no-op on panic.

let handle = std::thread::spawn(|| {
struct Droppable;
impl Drop for Droppable {
fn drop(&mut self) {
SHARED.fetch_add(1, Ordering::SeqCst);
}
}

let _guard = Droppable;
None::<()>.expect("???");
});

let wait = handle.join();

// reinstate handler to ease observation of assertion failures.
std::panic::set_hook(old_hook);

assert!(wait.is_err());

assert_eq!(SHARED.fetch_add(0, Ordering::SeqCst), 1);
}