-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Upgrade to LLVM's 3.7 release branch #27076
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
r? @brson |
@bors r+ |
📌 Commit 181661f has been approved by |
🎊 |
@bors: r-, turns out there's still bugs on OSX and Windows, taking some time to fix those up. So far:
And probably one or two more on the way! |
There's a number of goodies in this LLVM update: * This contains a fix for https://llvm.org/bugs/show_bug.cgi?id=23957 which should help us bootstrap farther on 32-bit MSVC targets. * There is better support for writing multiple flavors of archives, allowing us to use the built-in LLVM support instead of the system `ar` on all current platforms of the compiler. * A number of other minor bug fixes and performance improvements to unblock various other pieces of work.
This is for llvm/cc714e214298cfbf11de65b46de31900d51422cf
The C API of this function changed so it no longer takes a personality function. A shim was introduced to call the right LLVM function (depending on which version we're compiled against) to set the personality function on the outer function. The compiler only ever sets one personality function for all generated functions, so this should be equivalent.
Updates our LLVM bindings to be able to write out multiple kinds of archives. This commit also enables using LLVM instead of the system ar on all current targets.
Turns out for OSX our data layout was subtly wrong and the LLVM update must have exposed this. Instead of fixing this I've removed all data layouts from the compiler to just use the defaults that LLVM provides for all targets. All data layouts (and a number of dead modules) are removed from the compiler here. Custom target specifications can still provide a custom data layout, but it is now an optional key as the default will be used if one isn't specified.
181661f
to
958d563
Compare
@bors force |
⌛ Testing commit 958d563 with merge 71fea82... |
💔 Test failed - auto-mac-32-opt |
Depends on #27070 |
Re-enabling it is tracked in rust-lang#27089
@bors: p=1 |
LLVM has recently created their 3.7 release branch, and this PR updates us to that point. This should hopefully mean that we're basically compatible with the upcoming 3.7 release. Additionally, there are a number of goodies on this branch. * This contains a fix for https://llvm.org/bugs/show_bug.cgi?id=23957 which should help us bootstrap farther on 32-bit MSVC targets. * There is better support for writing multiple flavors of archives, allowing us to use the built-in LLVM support instead of the system `ar` on all current platforms of the compiler. * This LLVM has SafeStack support * An [optimization patch](rust-lang/llvm@7cf5e26) by @pcwalton is included. * A number of other minor test fixes here and there. Due to problems dealing with the data layout we pass to LLVM, this PR also takes the time to clean up how we specific this. We no longer specify a data layout to LLVM by default and instead take the default for the target from LLVM to pass to the module that we're building. This should be more robust going into the future, and I'm also not sure we know what any of these arcane strings are any more...
\o/ Thanks for getting us onto a new llvm (I can finally play with safestacks!) and keeping my tiny commit intact ❤️ |
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
The fix for rust-lang#26468 was made upstream and landed with the LLVM update in rust-lang#27076. Closes rust-lang#26468
Compute LLVM-agnostic type layouts in rustc. Layout for monomorphic types, and some polymorphic ones (e.g. `&T` where `T: Sized`), can now be computed by rustc without involving LLVM in the actual process. This gives rustc the ability to evaluate `size_of` or `align_of`, as well as obtain field offsets. MIR-based CTFE will eventually make use of these layouts, as will MIR trans, shortly. Layout computation also comes with a `[breaking-change]`, or two: * `"data-layout"` is now mandatory in custom target specifications, reverting the decision from #27076. This string is needed because it describes endianness, pointer size and alignments for various types. We have the first two and we could allow tweaking alignments in target specifications. Or we could also extract the data layout from LLVM and feed it back into rustc. However, that can vary with the LLVM version, which is fragile and undermines stability. For built-in targets, I've added a check that the hardcoded data-layout matches LLVM defaults. * `transmute` calls are checked in a stricter fashion, which fixes #32377 To expand on `transmute`, there are only 2 allowed patterns: between types with statically known sizes and between pointers with the same potentially-unsized "tail" (which determines the type of unsized metadata they use, if any). If you're affected, my suggestions are: * try to use casts (and raw pointer deref) instead of transmutes * *really* try to avoid `transmute` where possible * if you have a structure, try working on individual fields and unpack/repack the structure instead of transmuting it whole, e.g. `transmute::<RefCell<Box<T>>, RefCell<*mut T>>(x)` doesn't work, but `RefCell::new(Box::into_raw(x.into_inner()))` does (and `Box::into_raw` is just a `transmute`)
LLVM has recently created their 3.7 release branch, and this PR updates us to that point. This should hopefully mean that we're basically compatible with the upcoming 3.7 release. Additionally, there are a number of goodies on this branch.
which should help us bootstrap farther on 32-bit MSVC targets.
to use the built-in LLVM support instead of the system
ar
on all currentplatforms of the compiler.
Due to problems dealing with the data layout we pass to LLVM, this PR also takes the time to clean up how we specific this. We no longer specify a data layout to LLVM by default and instead take the default for the target from LLVM to pass to the module that we're building. This should be more robust going into the future, and I'm also not sure we know what any of these arcane strings are any more...