about summary refs log tree commit diff
path: root/src/librustc/session
AgeCommit message (Collapse)AuthorLines
2017-05-02Removal pass for anonymous parametersest31-1/+1
Removes occurences of anonymous parameters from the rustc codebase, as they are to be deprecated. See issue #41686 and RFC 1685.
2017-05-01Add profiling support, through the rustc -Z profile flag.whitequark-0/+2
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-28Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichtonbors-13/+48
Implement a file-path remapping feature in support of debuginfo and reproducible builds This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler. This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages. r? @alexcrichton
2017-04-26remap-path-prefix: Validate number of commandline arguments passed.Michael Woerister-0/+17
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-13/+31
reproducible builds.
2017-04-25Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.kennytm-1/+1
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-14add 'mir' as part of the --emit flag list in rustc --help menu and man doc.nate-1/+1
This is added because 'rustc' can now generate MIR (referencing to "Teach rustc --emit=mir #39891").
2017-04-13remove `LinkMeta` from `SharedCrateContext`Niko Matsakis-7/+5
A number of things were using `crate_hash` that really ought to be using `crate_disambiguator` (e.g., to create the plugin symbol names). They have been updated. It is important to remove `LinkMeta` from `SharedCrateContext` since it contains a hash of the entire crate, and hence it will change whenever **anything** changes (which would then require rebuilding **everything**).
2017-04-11Fix some nitsSimonas Kazlauskas-3/+2
2017-04-11Make a comment better.Austin Hicks-1/+1
2017-04-11Initial attempt at implementing optimization fuel and re-enabling struct ↵Austin Hicks-1/+1
field reordering.
2017-04-11Tests for -Z fuel=foo=nAustin Hicks-1/+1
2017-04-11Make a comment better.Austin Hicks-1/+1
2017-04-11Initial attempt at implementing optimization fuel and re-enabling struct ↵Austin Hicks-0/+76
field reordering.
2017-04-07-Z linker-flavorJorge Aparicio-3/+18
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-03-21Teach rustc --emit=mirJake Goulding-0/+6
2017-03-17Rollup merge of #40463 - tshepang:nit, r=nikomatsakisCorey Farwell-1/+4
some style fixes
2017-03-13some style fixesTshepang Lekhonkhobe-1/+4
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-1/+1
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-02-25rustc: introduce a query system for type information in ty::maps.Eduard Burtescu-4/+4
2017-02-25Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichtonEduard-Mihai Burtescu-0/+11
add `-C overflow-checks` option In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. I was seeing a [run-pass/issue-28950.rs](https://github.com/rust-lang/rust/blob/b1363a73ede57ae595f3a1be2bb75d308ba4f7f6/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler. We'll see what travis says. Fixes #33134. r? @alexcrichton
2017-02-25Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichtonEduard-Mihai Burtescu-29/+30
Better handling of lib defaults r? @alexcrichton
2017-02-23Better handling of lib defaultsPeter Wagenet-29/+30
2017-02-22add `-C overflow-checks` optionNathan Froyd-0/+11
In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks. Fixes #33134.
2017-02-20incr-comp: track the -Z sanitizer flagJorge Aparicio-3/+5
closes #39611
2017-02-08sanitizer supportJorge Aparicio-1/+24
2017-02-04Auto merge of #38426 - vadimcn:nobundle, r=alexcrichtonbors-0/+5
Implement kind="static-nobundle" (RFC 1717) This implements the "static-nobundle" library kind (last item from #37403). Rustc handles "static-nobundle" libs very similarly to dylibs, except that on Windows, uses of their symbols do not get marked with "dllimport". Which is the whole point of this feature.
2017-02-02introduce `LintTable`Niko Matsakis-14/+7
2017-01-24incr.comp.: Make cross-crate tracking for incr. comp. opt-in.Michael Woerister-0/+2
2017-01-19Feature gateVadim Chugunov-0/+4
2017-01-19Implement the "static-nobundle" library kind (RFC 1717).Vadim Chugunov-0/+1
These are static libraries that are not bundled (as the name implies) into rlibs and staticlibs that rustc generates, and must be present when the final binary artifact is being linked.
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-1/+2
2017-01-10Rollup merge of #38841 - F001:Fix, r=steveklabnikSeo Sanghyeon-1/+1
Update usage of rustc Add proc_macro crate type
2017-01-05Update usage of rustcF001-1/+1
Add proc_macro crate type
2017-01-03fix help for the --print optionDoug Goldstein-1/+2
Since 8285ab5c99, which was merged in with #38061, the help for the --print option is missing the surrounding [ ] around the possible options. Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-12-29Support --emit=foo,metadataNick Cameron-0/+13
2016-12-29Restore --crate-type=metadata as an alias for ↵Nick Cameron-4/+15
--crate-type=rlib,--emit=metadata + a warning
2016-12-29Change --crate-type metadata to --emit=metadataNick Cameron-6/+8
2016-12-24Add a min_atomic_width target option, like max_atomic_width.whitequark-1/+2
Rationale: some ISAs, e.g. OR1K, do not have atomic instructions for byte and halfword access, and at the same time do not have a fixed endianness, which makes it unreasonable to implement these through word-sized atomic accesses.
2016-12-23Auto merge of #38401 - redox-os:redox_cross, r=brsonbors-12/+6
Redox Cross Compilation I will admit - there are things here that I wish I did not have to do. This completes the ability to create a cross compiler from the rust repository for `x86_64-unknown-redox`. I will document this PR with inline comments explaining some things. [View this gist to see how a cross compiler is built](https://gist.github.com/jackpot51/6680ad973986e84d69c79854249f2b7e) Prior discussion of a smaller change is here: https://github.com/rust-lang/rust/pull/38366
2016-12-22Convert fam to SymbolJeremy Soller-3/+3
2016-12-22Correct target_family messJeremy Soller-12/+6
2016-12-20Rollup merge of #38418 - michaelwoerister:def_path_cleanup, r=eddybAlex Crichton-0/+5
Cleanup refactoring around DefPath handling This PR makes two big changes: * All DefPaths of a crate are now stored in metadata in their own table (as opposed to `DefKey`s as part of metadata `Entry`s. * The compiler will no longer allocate a pseudo-local DefId for inlined HIR nodes (because those are gross). Inlined HIR nodes will have a NodeId but they don't have there own DefId anymore. Turns out they were not needed anymore either. Hopefully HIR inlining will be gone completely one day but if until then we start needing to be able to map inlined NodeIds to original DefIds, we can add an additional table to metadata that allows for reconstructing this. Overall this makes for some nice simplifications and removal of special cases. r? @eddyb cc @rust-lang/compiler
2016-12-18Auto merge of #37429 - camlorn:univariant_layout_optimization, r=eddybbors-1/+6
struct field reordering and optimization This is work in progress. The goal is to divorce the order of fields in source code from the order of fields in the LLVM IR, then optimize structs (and tuples/enum variants)by always ordering fields from least to most aligned. It does not work yet. I intend to check compiler memory usage as a benchmark, and a crater run will probably be required. I don't know enough of the compiler to complete this work unaided. If you see places that still need updating, please mention them. The only one I know of currently is debuginfo, which I'm putting off intentionally until a bit later. r? @eddyb
2016-12-17rustbuild: Fix LC_ID_DYLIB directives on OSXAlex Crichton-0/+2
Currently libraries installed by rustbuild on OSX have an incorrect `LC_ID_DYLIB` directive located in the dynamic libraries that are installed. The directive we expect looks like: @rpath/libstd.dylib Which means that if you want to find that dynamic library you should look at the dylib's other `@rpath` directives. Typically our `@rpath` directives look like `@loader_path/../lib` for the compiler as that's where the installed libraries will be located. Currently, though, rustbuild produces dylibs with the directive that looks like: /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libstd-713ad88203512705.dylib In other words, the build directory is encoded erroneously. The compiler already [knows how] to change this directive, but it only passes that argument when `-C rpath` is also passed. The rustbuild system, however, explicitly [does not pass] this option explicitly and instead bakes its own. This logic then also erroneously didn't pass `-Wl,-install_name` like the compiler. [knows how]: https://github.com/rust-lang/rust/blob/4a008cccaabc8b3fe65ccf5868b9d16319c9ac58/src/librustc_trans/back/linker.rs#L210-L214 [does not pass]: https://github.com/rust-lang/rust/blob/4a008cccaabc8b3fe65ccf5868b9d16319c9ac58/src/bootstrap/bin/rustc.rs#L133-L158 To fix this regression this patch introduces a new `-Z` flag, `-Z osx-rpath-install-name` which basically just forces the compiler to take the previous `-install_name` branch when creating a dynamic library. Hopefully we can sort out a better rpath story in the future, but for now this "hack" should suffice in getting our nightly builds back to the same state as before. Closes #38430
2016-12-16definitions: Add some timing stats for DefPathTable decoding.Michael Woerister-0/+5
2016-12-14Fix -Z print-type-sizes and tests.Austin Hicks-1/+6
This was done by sorting the fields by increasing offset; as a consequence, the order of -Z print-type-sizes matches memory order not source order.
2016-12-11Simplify use of mir_opt_levelUlrik Sverdrup-8/+3
Remove the unused top level option by the same name, and retain the debug option. Use -Zmir-opt-level=1 as default. One pass is enabled by default but wants to be optional: - Instcombine requires mir_opt_level > 0 Copy propagation is not used by default, but used to be activated by explicit -Zmir-opt-level=1. It must move one higher to be off by default: - CopyPropagation requires mir_opt_level > 1 Deaggregate is not used by default, and used to be on a different level than CopyPropagation: - Deaggreate requires mir_opt_level > 2
2016-12-07add a -Z flag to guarantee that MIR is generated for all functionsOliver Schneider-0/+2
2016-12-06Auto merge of #37973 - vadimcn:dllimport, r=alexcrichtonbors-22/+50
Implement RFC 1717 Implement the first two points from #37403. r? @alexcrichton