summary refs log tree commit diff
path: root/src/test/run-make
AgeCommit message (Collapse)AuthorLines
2017-07-17Auto merge of #42711 - Firstyear:san-on-dylib, r=alexcrichtonbors-9/+162
Add support for dylibs with Address Sanitizer Many applications use address sanitizer to assert correct behaviour of their programs. When using Rust with C, it's much more important to assert correct programs with tools like asan/lsan due to the unsafe nature of the access across an ffi boundary. However, previously only rust bin types could use asan. This posed a challenge for existing C applications that link or dlopen .so when the C application is compiled with asan. This PR enables asan to be linked to the dylib and cdylib crate type. We alter the test to check the proc-macro crate does not work with -Z sanitizer=address. Finally, we add a test that compiles a shared object in rust, then another rust program links it and demonstrates a crash through the call to the library. This PR is nearly complete, but I do require advice on the change to fix the -lasan that currently exists in the dylib test. This is required because the link statement is not being added correctly to the rustc build when -Z sanitizer=address is added (and I'm not 100% sure why) Thanks,
2017-07-15Add support for dylibs with Address Sanitizer. This supports cdylibs and ↵William Brown-9/+162
staticlibs on gnu-linux targets.
2017-07-12Rollup merge of #42826 - Yorwba:type-mismatch-same-absolute-paths, r=arielb1Mark Simulacrum-0/+94
Note different versions of same crate when absolute paths of different types match. The current check to address #22750 only works when the paths of the mismatched types relative to the current crate are equal, but this does not always work if one of the types is only included through an indirect dependency. If reexports are involved, the indirectly included path can e.g. [contain private modules](https://github.com/rust-lang/rust/issues/22750#issuecomment-302755516). This PR takes care of these cases by also comparing the *absolute* path, which is equal if the type hasn't moved in the module hierarchy between versions. A more coarse check would be to compare only the crate names instead of full paths, but that might lead to too many false positives. Additionally, I believe it would be helpful to show where the differing crates came from, i.e. the information in `rustc::middle::cstore::CrateSource`, but I'm not sure yet how to nicely display all of that, so I'm leaving it to a future PR.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-56/+30
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-07-02report the total number of errors on compilation failureAriel Ben-Yehuda-1/+1
Prior to this PR, when we aborted because a "critical pass" failed, we displayed the number of errors from that critical pass. While that's the number of errors that caused compilation to abort in *that place*, that's not what people really want to know. Instead, always report the total number of errors, and don't bother to track the number of errors from the last pass that failed. This changes the compiler driver API to handle errors more smoothly, and therefore is a compiler-api-[breaking-change]. Fixes #42793.
2017-06-29Replace `grep -z` by `tr -d '\r\n' | grep` for cross-compatibilityYorwba-1/+1
2017-06-22Note different versions of same crate when absolute paths of different types ↵Yorwba-0/+94
match.
2017-06-20Remove the in-tree `flate` crateAlex Crichton-8/+4
A long time coming this commit removes the `flate` crate in favor of the `flate2` crate on crates.io. The functionality in `flate2` originally flowered out of `flate` itself and is additionally the namesake for the crate. This will leave a gap in the naming (there's not `flate` crate), which will likely cause a particle collapse of some form somewhere.
2017-06-17Auto merge of #42650 - nrc:save-slim, r=eddybbors-1/+0
save-analysis: remove a lot of stuff This commits us to the JSON format and the more general def/ref style of output, rather than also supporting different data formats for different data structures. This does not affect the RLS at all, but will break any clients of the CSV form - AFAIK there are none (beyond a few of my own toy projects) - DXR stopped working long ago. r? @eddyb
2017-06-14Auto merge of #42433 - marco-c:profiling, r=alexcrichtonbors-0/+20
Build instruction profiler runtime as part of compiler-rt r? @alexcrichton This is #38608 with some fixes. Still missing: - [x] testing with profiler enabled on some builders (on which ones? Should I add the option to some of the already existing configurations, or create a new configuration?); - [x] enabling distribution (on which builders?); - [x] documentation.
2017-06-14Remove CSV format of save-analysis dataNick Cameron-1/+0
2017-06-09rustdoc: Use `create_dir_all` to create output directoryOliver Middleton-0/+15
Currently rustdoc will fail if passed `-o foo/doc` if the `foo` directory doesn't exist. Also remove unneeded `mkdir` as `create_dir_all` can now handle concurrent invocations.
2017-06-05Add run-make test for Command::spawn on WindowsOliver Middleton-0/+49
Make sure args aren't interpreted as part of the program name.
2017-06-04Run profiler test only if built with profiler supportMarco Castelluccio-0/+2
2017-06-04Merge branch 'profiling' of github.com:whitequark/rust into profilingMarco Castelluccio-0/+18
2017-05-22fix `atomic_lock_free` test caseNiko Matsakis-0/+2
2017-05-15Fix run-make/llvm-passRobin Kruppe-0/+1
2017-05-15Remove rustc_llvm dependency from librustcRobin Kruppe-0/+1
Consequently, session creation can no longer initialize LLVM. The few places that use the compiler without going through rustc_driver/CompilerCalls thus need to be careful to manually initialize LLVM (via rustc_trans!) immediately after session creation. This means librustc is not rebuilt when LLVM changes.
2017-05-14Remove rustc_llvm dependency from rustc_metadataRobin Kruppe-1/+2
Move the code for loading metadata from rlibs and dylibs from rustc_metadata into rustc_trans, and introduce a trait to avoid introducing a direct dependency on rustc_trans. This means rustc_metadata is no longer rebuilt when LLVM changes.
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-24/+0
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-24/+0
2017-05-04Reload nameserver information on lookup failureJon Gjengset-0/+1
As discussed in #41570, UNIX systems often cache the contents of /etc/resolv.conf, which can cause lookup failures to persist even after a network connection becomes available. This patch modifies lookup_host to force a reload of the nameserver entries following a lookup failure. This is in line with what many C programs already do (see #41570 for details). On systems with nscd, this should not be necessary, but not all systems run nscd. Introduces an std linkage dependency on libresolv on macOS/iOS (which also makes it necessary to update run-make/tools.mk). Fixes #41570. Depends on rust-lang/libc#585.
2017-05-01Add profiling support, through the rustc -Z profile flag.whitequark-0/+18
When -Z profile is passed, the GCDAProfiling LLVM pass is added to the pipeline, which uses debug information to instrument the IR. After compiling with -Z profile, the $(OUT_DIR)/$(CRATE_NAME).gcno file is created, containing initial profiling information. After running the program built, the $(OUT_DIR)/$(CRATE_NAME).gcda file is created, containing branch counters. The created *.gcno and *.gcda files can be processed using the "llvm-cov gcov" and "lcov" tools. The profiling data LLVM generates does not faithfully follow the GCC's format for *.gcno and *.gcda files, and so it will probably not work with other tools (such as gcov itself) that consume these files.
2017-04-25Do not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate.kennytm-3/+4
These are not even crates...
2017-04-25Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.kennytm-15/+23
ASan and TSan are supported on macOS, and this commit enables their support. The sanitizers are always built as *.dylib on Apple platforms, so they cannot be statically linked into the corresponding `rustc_?san.rlib`. The dylibs are directly copied to `lib/rustlib/x86_64-apple-darwin/lib/` instead. Note, although Xcode also ships with their own copies of ASan/TSan dylibs, we cannot use them due to version mismatch. There is a caveat: the sanitizer libraries are linked as @rpath, so the user needs to additionally pass `-C rpath`: rustc -Z sanitizer=address -C rpath file.rs ^~~~~~~~ Otherwise there will be a runtime error: dyld: Library not loaded: @rpath/libclang_rt.asan_osx_dynamic.dylib Referenced from: /path/to/executable Reason: image not found Abort trap: 6 The next commit includes a temporary change in compiler to force the linker to emit a usable @rpath.
2017-04-21Update #[no_core] users with the "freeze" lang item.Eduard-Mihai Burtescu-2/+10
2017-04-19rustc_trans: do not treat byval as using up registers.Eduard-Mihai Burtescu-0/+23
2017-04-11Fix pairs of doubles using an illegal <8 x i8> vector.Eduard-Mihai Burtescu-0/+30
2017-04-07-Z linker-flavorJorge Aparicio-0/+3
This patch adds a `-Z linker-flavor` flag to rustc which can be used to invoke the linker using a different interface. For example, by default rustc assumes that all the Linux targets will be linked using GCC. This makes it impossible to use LLD as a linker using just `-C linker=ld.lld` because that will invoke LLD with invalid command line arguments. (e.g. rustc will pass -Wl,--gc-sections to LLD but LLD doesn't understand that; --gc-sections would be the right argument) With this patch one can pass `-Z linker-flavor=ld` to rustc to invoke the linker using a LD-like interface. This way, `rustc -C linker=ld.lld -Z linker-flavor=ld` will invoke LLD with the right arguments. `-Z linker-flavor` accepts 4 different arguments: `em` (emcc), `ld`, `gcc`, `msvc` (link.exe). `em`, `gnu` and `msvc` cover all the existing linker interfaces. `ld` is a new flavor for interfacing GNU's ld and LLD. This patch also changes target specifications. `linker-flavor` is now a mandatory field that specifies the *default* linker flavor that the target will use. This change also makes the linker interface *explicit*; before, it used to be derived from other fields like linker-is-gnu, is-like-msvc, is-like-emscripten, etc. Another change to target specifications is that the fields `pre-link-args`, `post-link-args` and `late-link-args` now expect a map from flavor to linker arguments. ``` diff - "pre-link-args": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "pre-link-args": { + "gcc": ["-Wl,--as-needed", "-Wl,-z,-noexecstack"], + "ld": ["--as-needed", "-z,-noexecstack"], + }, ``` [breaking-change] for users of custom targets specifications
2017-04-07Auto merge of #39987 - japaric:used, r=arielb1bors-0/+28
#[used] attribute (For an explanation of what this feature does, read the commit message) I'd like to propose landing this as an experimental feature (experimental as in: no clear stabilization path -- like `asm!`, `#[linkage]`) as it's low maintenance (I think) and relevant to the "Usage in resource-constrained environments" exploration area. The main use case I see is running code before `main`. This could be used, for instance, to cheaply initialize an allocator before `main` where the alternative is to use `lazy_static` to initialize the allocator on its first use which it's more expensive (atomics) and doesn't work on ARM Cortex-M0 microcontrollers (no `AtomicUsize` on that platform) Here's a `std` example of that: ``` rust unsafe extern "C" fn before_main_1() { println!("Hello"); } unsafe extern "C" fn before_main_2() { println!("World"); } #[link_section = ".init_arary"] #[used] static INIT_ARRAY: [unsafe extern "C" fn(); 2] = [before_main_1, before_main_2]; fn main() { println!("Goodbye"); } ``` ``` $ rustc -C lto -C opt-level=3 before_main.rs $ ./before_main Hello World Goodbye ``` In general, this pattern could be used to let *dependencies* run code before `main` (which sounds like it could go very wrong in some cases). There are probably other use cases; I hope that the people I have cc-ed can comment on those. Note that I'm personally unsure if the above pattern is something we want to promote / allow and that's why I'm proposing this feature as experimental. If this leads to more footguns than benefits then we can just axe the feature. cc @nikomatsakis ^ I know you have some thoughts on having a process for experimental features though I'm fine with writing an RFC before landing this. - `dead_code` lint will have to be updated to special case `#[used]` symbols. - Should we extend `#[used]` to work on non-generic functions? cc rust-lang/rfcs#1002 cc rust-lang/rfcs#1459 cc @dpc @JinShil
2017-04-06don't pass -C to nmJorge Aparicio-1/+1
the nm in our macOS bots don't support that flag and it's not really required
2017-04-05don't test for the absence of BAR in the rmake testJorge Aparicio-1/+0
it's not related to this feature
2017-04-05Auto merge of #40348 - nrc:save-extern-fn, r=eddybbors-0/+5
Handle extern functions and statics in save-analysis r? @eddyb
2017-04-05fix location of the emitted object fileJorge Aparicio-2/+2
2017-04-05add tracking issue and feature-gate and run-make testsJorge Aparicio-0/+29
2017-04-05Rollup merge of #41085 - nagisa:fix-output-properg, r=alexcrichtonCorey Farwell-0/+18
Properly adjust filenames when multiple emissions Fixes #40993 Should backport just fine to beta but not sure if we want to do this since this is quite old stable regression.
2017-04-05Rollup merge of #40870 - alexcrichton:stabilize-windows-subsystem, r=aturonCorey Farwell-2/+0
rustc: Stabilize the `#![windows_subsystem]` attribute This commit stabilizes the `#![windows_subsystem]` attribute which is a conservative exposure of the `/SUBSYSTEM` linker flag on Widnows platforms. This is useful for creating applications as well as console programs. Closes #37499
2017-04-05Properly adjust filenames when multiple emissionsSimonas Kazlauskas-0/+18
Fixes #40993
2017-04-04save-analysis: index extern blocksNick Cameron-0/+5
2017-04-03Auto merge of #40915 - nrc:save-assoc, r=eddybbors-0/+17
save-analysis: track associated types r? @eddyb
2017-04-01rustc: Stabilize the `#![windows_subsystem]` attributeAlex Crichton-2/+0
This commit stabilizes the `#![windows_subsystem]` attribute which is a conservative exposure of the `/SUBSYSTEM` linker flag on Widnows platforms. This is useful for creating applications as well as console programs. Closes #37499
2017-03-30kill the graphviz-flowgraph testsNiko Matsakis-1963/+0
They are so annoying to update, and haven't caught any bugs afaik.
2017-03-30save-analysis: track associated typesNick Cameron-0/+17
2017-03-21Regression test for rust-lang/rust#40535Austin Bonander-0/+49
2017-03-12Auto merge of #40446 - arielb1:rollup, r=alexcrichtonbors-1/+23
Rollup of 12 pull requests - Successful merges: #40146, #40299, #40315, #40319, #40344, #40345, #40372, #40373, #40400, #40404, #40419, #40431 - Failed merges:
2017-03-11Auto merge of #40220 - jseyfried:ast_macro_def, r=nrcbors-0/+1
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info This PR - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items, - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today), - removes `ast::MacroDef`, and - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions. - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter. r? @nrc
2017-03-11Rollup merge of #40373 - TimNN:test-ub-packed, r=arielb1Ariel Ben-Yehuda-1/+23
Fix UB in repr(packed) tests r? @arielb1 cc #37609 and #27060
2017-03-10rustc: Exit quickly on only `--emit dep-info`Alex Crichton-0/+19
This commit alters the compiler to exit quickly if the only output being emitted is `dep-info`, which doesn't need a lot of other information to generate. Closes #40328
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-0/+1
2017-03-08fix UB in repr(packed) testsTim Neumann-1/+23