summary refs log tree commit diff
path: root/src/test/run-make
AgeCommit message (Collapse)AuthorLines
2018-02-23Encode linker arguments as UTF-16 on MSVC platformsMark Simulacrum-9/+37
2018-01-23rustc: Lower link args to `@`-files on Windows moreAlex Crichton-0/+103
When spawning a linker rustc has historically been known to blow OS limits for the command line being too large, notably on Windows. This is especially true of incremental compilation where there can be dozens of object files per compilation. The compiler currently has logic for detecting a failure to spawn and instead passing arguments via a file instead, but this failure detection only triggers if a process actually fails to spawn. Unfortunately on Windows we've got something else to worry about which is `cmd.exe`. The compiler may be running a linker through `cmd.exe` where `cmd.exe` has a limit of 8192 on the command line vs 32k on `CreateProcess`. Moreso rustc actually succeeds in spawning `cmd.exe` today, it's just that after it's running `cmd.exe` fails to spawn its child, which rustc doesn't currently detect. Consequently this commit updates the logic for the spawning the linker on Windows to instead have a heuristic to see if we need to pass arguments via a file. This heuristic is an overly pessimistic and "inaccurate" calculation which just calls `len` on a bunch of `OsString` instances (where `len` is not precisely the length in u16 elements). This number, when exceeding the 6k threshold, will force rustc to always pass arguments through a file. This strategy should avoid us trying to parse the output on Windows of the linker to see if it successfully spawned yet failed to actually sub-spawn the linker. We may just be passing arguments through files a little more commonly now... The motivation for this commit was a recent bug in Gecko [1] when beta testing, notably when incremental compilation was enabled it blew out the limit on `cmd.exe`. This commit will also fix #46999 as well though as emscripten uses a bat script as well (and we're blowing the limit there). [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1430886 Closes #46999 (cherry picked from commit 66366f9)
2017-12-30Remove excessive trailing newlines.kennytm-4/+0
2017-12-26Revert "Just compare the symbol names and types, not the addresses"Bastian Köcher-6/+6
This reverts commit 7d4d98e5c870a2dcdca8ea3aa47ecee680a35e60.
2017-12-26Use `start` for the `sepcomp-inlining` testBastian Köcher-3/+8
2017-12-26The test functions are now in the same compile unitBastian Köcher-2/+2
2017-12-26Just compare the symbol names and types, not the addressesBastian Köcher-6/+6
2017-12-22Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebankkennytm-1/+7
tweaks and fixes for doc(include) This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732): * Turns errors when loading files into full errors. This matches the original RFC text. * Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes. * Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends. * Adds or modifies tests to check for all of these.
2017-12-19add files loaded through doc(include) into dep-infoQuietMisdreavus-1/+7
2017-12-19Fix a `compile_input` testvarkor-1/+1
2017-12-18Prevent rustc overwriting input filesvarkor-2/+23
If rustc is invoked on a file that would be overwritten by the compilation, the compilation now fails, to avoid accidental loss. This resolves #13019.
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-5/+5
2017-12-04rustc_back: move dynamic_lib to rustc_metadata.Irina-Gabriela Popa-2/+2
2017-11-28Disable the cdylib-fewer-symbols test for all Windows (test was broken).kennytm-1/+3
2017-11-28Replace most call to grep in run-make by a script that cat the input.kennytm-119/+152
Introduced a new src/etc/cat-and-grep.sh script (called in run-make as $(CGREP)), which prints the input and do a grep simultaneously. This is mainly used to debug spurious failures in run-make, such as the sanitizer error in #45810, as well as real errors such as #46126.
2017-11-27Auto merge of #46273 - semarie:openbsd-libc++, r=alexcrichtonbors-1/+1
make OpenBSD to use libc++ instead of (e)stdc++
2017-11-26make OpenBSD to use libc++ instead of (e)stdc++Sébastien Marie-1/+1
2017-11-25rustc_trans: don't apply noalias on returned references.Eduard-Mihai Burtescu-0/+23
2017-11-24rustbuild: Update LLVM and enable ThinLTOAlex Crichton-1/+10
This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also opportunistically enables ThinLTO for libstd which was previously blocked (#45661) on test failures related to debuginfo with a presumed cause of #45511. Closes #45511
2017-11-24Auto merge of #45946 - estebank:crate-conflict-diag, r=arielb1bors-3/+2
Use multiline text for crate conflict diagnostics After: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib ``` Before: ``` error[E0464]: multiple matching crates for `libc` --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1 | 1 | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = note: candidates: = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib = note: crate name: libc = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib = note: crate name: libc ```
2017-11-22Use multiline text for crate conflict diagnosticsEsteban Küber-3/+2
2017-11-23Auto merge of #45721 - nikomatsakis:hir-tree, r=arielb1bors-0/+22
add -Zunpretty=hir-tree This uses the debug impls to dump the raw HIR. Particularly useful when learning how the compiler works. cc @qmx
2017-11-20add a simple test that running with hir-tree doesn't go bonkersNiko Matsakis-0/+22
Akin to the existing expanded test.
2017-11-19Revert "tests: Update run-make/issue-25581 to reflect how fat pointers are ↵Eduard-Mihai Burtescu-4/+9
passed." This reverts commit b12dcdef4fae5e3856e6911fd6cfbeedadcf3821.
2017-11-16Auto merge of #45920 - sunfishcode:trap-on-unreachable, r=Zoxcbors-2/+12
Enable TrapUnreachable in LLVM. This patch enables LLVM's TrapUnreachable flag, which tells it to translate `unreachable` instructions into hardware trap instructions, rather than allowing control flow to "fall through" into whatever code happens to follow it in memory. This follows up on https://github.com/rust-lang/rust/issues/28728#issuecomment-332581533. For example, for @zackw's testcase [here](https://github.com/rust-lang/rust/issues/42009#issue-228745924), the output function contains a `ud2` instead of no code, so it won't "fall through" into whatever happens to be next in memory. (I'm also working on the problem of LLVM optimizing away infinite loops, but the patch here is useful independently.) I tested this patch on a few different codebases, and the code size increase ranged from 0.0% to 0.1%.
2017-11-13Auto merge of #45824 - dotdash:stack_pop, r=alexcrichtonbors-0/+34
Update LLVM to fix miscompiles with -Copt-level=z on Windows Fixes #45034
2017-11-13Auto merge of #45810 - SimonSapin:ac-dc, r=aturonbors-2/+4
Disable LLVM assertions on Nightly, enable them in "alt" builds. Per IRC discussion https://mozilla.logbot.info/rust-infra/20171106#c13812170-c13812204 Background: https://internals.rust-lang.org/t/disabling-llvm-assertions-in-nightly-builds/5388/14
2017-11-12Update LLVM to fix miscompiles with -Copt-level=z on WindowsBjörn Steinbrink-0/+34
Fixes #45034
2017-11-12Do not silence output in run-make/sanitizer-memorySimon Sapin-2/+4
2017-11-11Add comments to the intrinsic-unreachable test programs.Dan Gohman-0/+6
The return value in these tests is just being used to generate extra code so that it can be detected in the test script, which is just counting lines in the assembly output.
2017-11-10Update the "[run-make] run-make/intrinsic-unreachable" test.Dan Gohman-2/+6
With rustc now emitting "ud2" on unreachable code, a "return nothing" sequence may take the same number of lines as an "unreachable" sequence in assembly code. This test is testing that intrinsics::unreachable() works by testing that it reduces the number of lines in the assembly code. Fix it by adding a return value, which requires an extra instruction in the reachable case, which provides the test what it's looking for.
2017-11-07Update run-make tests.Michael Woerister-2/+16
2017-11-05Auto merge of #45748 - petrochenkov:short, r=alexcrichtonbors-1/+1
Shorten paths to auxiliary files created by tests I'm hitting issues with long file paths to object files created by the test suite, similar to https://github.com/rust-lang/rust/issues/45103#issuecomment-335622075. If we look at the object file path in https://github.com/rust-lang/rust/issues/45103 we can see that the patch contains of few components: ``` specialization-cross-crate-defaults.stage2-x86_64-pc-windows-gnu.run-pass.libaux\specialization_cross_crate_defaults.specialization_cross_crate_defaults0.rust-cgu.o ``` => 1. specialization-cross-crate-defaults // test name, required 2. stage2 // stage disambiguator, required 3. x86_64-pc-windows-gnu // target disambiguator, required 4. run-pass // mode disambiguator, rarely required 5. libaux // suffix, can be shortened 6. specialization_cross_crate_defaults // required, there may be several libraries in the directory 7. specialization_cross_crate_defaults0 // codegen unit name, can be shortened? 8. rust-cgu // suffix, can be shortened? 9. o // object file extension This patch addresses items `4`, `5` and `8`. `libaux` is shortened to `aux`, `rust-cgu` is shortened to `rcgu`, mode disambiguator is omitted unless it's necessary (for pretty-printing and debuginfo tests, see https://github.com/rust-lang/rust/pull/24537/commits/38d26d811a44ba93637c84ce77a58af88c47f0ac) I haven't touched names of codegen units though (`specialization_cross_crate_defaults0`). Is it useful for them to have descriptive names including the crate name, as opposed to just `0` or `cgu0` or something?
2017-11-04rustc: Handle some libstd symbole exports betterAlex Crichton-0/+33
Right now symbol exports, particularly in a cdylib, are handled by assuming that `pub extern` combined with `#[no_mangle]` means "export this". This isn't actually what we want for some symbols that the standard library uses to implement itself, for example symbols related to allocation. Additionally other special symbols like `rust_eh_personallity` have no need to be exported from cdylib crate types (only needed in dylib crate types). This commit updates how rustc handles these special symbols by adding to the hardcoded logic of symbols like `rust_eh_personallity` but also adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the export level to be considered the same as all other Rust functions instead of looking like a C function. The eventual goal here is to prevent functions like `__rdl_alloc` from showing up as part of a Rust cdylib as it's just an internal implementation detail. This then further allows such symbols to get gc'd by the linker when creating a cdylib.
2017-11-03Shorten paths to auxiliary files created by testsVadim Petrochenkov-1/+1
2017-11-03auto trait future compatibility lintleonardo.yvens-0/+2
2017-11-02Auto merge of #45647 - nrc:rls-bugs, r=eddybbors-0/+5
save-analysis: support unions r? @eddyb
2017-10-31Add regression test for symbol visibility when compiling rlib+cdylib in one ↵Michael Woerister-2/+12
session.
2017-10-31save-analysis: support unionsNick Cameron-0/+5
2017-10-27Implement RFC 1861: Extern typesPaul Lietar-0/+49
2017-10-16Auto merge of #45202 - alexcrichton:fix-inline-always, r=michaelwoeristerbors-0/+33
rustc: Handle #[inline(always)] at -O0 This commit updates the handling of `#[inline(always)]` functions at -O0 to ensure that it's always inlined regardless of the number of codegen units used. Closes #45201
2017-10-15rustbuild: Support specifying archiver and linker explicitlyVadim Petrochenkov-13/+20
2017-10-11rustc: Handle #[inline(always)] at -O0Alex Crichton-0/+33
This commit updates the handling of `#[inline(always)]` functions at -O0 to ensure that it's always inlined regardless of the number of codegen units used. Closes #45201
2017-10-10Rollup merge of #45108 - phil-opp:patch-2, r=japarickennytm-2/+2
Fix data-layout field in x86_64-unknown-linux-gnu.json test file The current data-layout causes the following error: > rustc: /checkout/src/llvm/lib/CodeGen/MachineFunction.cpp:151: void llvm::MachineFunction::init(): Assertion `Target.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"' failed. The new value was generated according to [this comment by @japaric](https://github.com/rust-lang/rust/issues/31367#issuecomment-213595571).
2017-10-10Rename test Linux target to avoid conflict with built-in targetPhilipp Oppermann-1/+1
It seems like the file wasn't actually used, since there is a built-in target with the same name. See https://github.com/rust-lang/rust/pull/45108#issuecomment-335173165 for more details.
2017-10-08Fix data-layout fieldPhilipp Oppermann-1/+1
The value was generated according to [this comment by @japaric](https://github.com/rust-lang/rust/issues/31367#issuecomment-213595571).
2017-10-07rustc: Don't inline in CGUs at -O0Alex Crichton-2/+4
This commit tweaks the behavior of inlining functions into multiple codegen units when rustc is compiling in debug mode. Today rustc will unconditionally treat `#[inline]` functions by translating them into all codegen units that they're needed within, marking the linkage as `internal`. This commit changes the behavior so that in debug mode (compiling at `-O0`) rustc will instead only translate `#[inline]` functions into *one* codegen unit, forcing all other codegen units to reference this one copy. The goal here is to improve debug compile times by reducing the amount of translation that happens on behalf of multiple codegen units. It was discovered in #44941 that increasing the number of codegen units had the adverse side effect of increasing the overal work done by the compiler, and the suspicion here was that the compiler was inlining, translating, and codegen'ing more functions with more codegen units (for example `String` would be basically inlined into all codegen units if used). The strategy in this commit should reduce the cost of `#[inline]` functions to being equivalent to one codegen unit, which is only translating and codegen'ing inline functions once. Collected [data] shows that this does indeed improve the situation from [before] as the overall cpu-clock time increases at a much slower rate and when pinned to one core rustc does not consume significantly more wall clock time than with one codegen unit. One caveat of this commit is that the symbol names for inlined functions that are only translated once needed some slight tweaking. These inline functions could be translated into multiple crates and we need to make sure the symbols don't collideA so the crate name/disambiguator is mixed in to the symbol name hash in these situations. [data]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334880911 [before]: https://github.com/rust-lang/rust/issues/44941#issuecomment-334583384
2017-10-07rustc: Implement ThinLTOAlex Crichton-7/+7
This commit is an implementation of LLVM's ThinLTO for consumption in rustc itself. Currently today LTO works by merging all relevant LLVM modules into one and then running optimization passes. "Thin" LTO operates differently by having more sharded work and allowing parallelism opportunities between optimizing codegen units. Further down the road Thin LTO also allows *incremental* LTO which should enable even faster release builds without compromising on the performance we have today. This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then also implements two forms of ThinLTO: * In one mode we'll *only* perform ThinLTO over the codegen units produced in a single compilation. That is, we won't load upstream rlibs, but we'll instead just perform ThinLTO amongst all codegen units produced by the compiler for the local crate. This is intended to emulate a desired end point where we have codegen units turned on by default for all crates and ThinLTO allows us to do this without performance loss. * In anther mode, like full LTO today, we'll optimize all upstream dependencies in "thin" mode. Unlike today, however, this LTO step is fully parallelized so should finish much more quickly. There's a good bit of comments about what the implementation is doing and where it came from, but the tl;dr; is that currently most of the support here is copied from upstream LLVM. This code duplication is done for a number of reasons: * Controlling parallelism means we can use the existing jobserver support to avoid overloading machines. * We will likely want a slightly different form of incremental caching which integrates with our own incremental strategy, but this is yet to be determined. * This buys us some flexibility about when/where we run ThinLTO, as well as having it tailored to fit our needs for the time being. * Finally this allows us to reuse some artifacts such as our `TargetMachine` creation, where all our options we used today aren't necessarily supported by upstream LLVM yet. My hope is that we can get some experience with this copy/paste in tree and then eventually upstream some work to LLVM itself to avoid the duplication while still ensuring our needs are met. Otherwise I fear that maintaining these bindings may be quite costly over the years with LLVM updates!
2017-10-01Auto merge of #44906 - dkl:main-signature, r=nagisabors-0/+3
Fix native main() signature on 64bit Hello, in LLVM-IR produced by rustc on x86_64-linux-gnu, the native main() function had incorrect types for the function result and argc parameter: i64, while it should be i32 (really c_int). See also #20064, #29633. So I've attempted a fix here. I tested it by checking the LLVM IR produced with --target x86_64-unknown-linux-gnu and i686-unknown-linux-gnu. Also I tried running the tests (`./x.py test`), however I'm getting two failures with and without the patch, which I'm guessing is unrelated.
2017-09-30test: Update target specs test for new target-c-int-width fieldDaniel Klauer-0/+3