summary refs log tree commit diff
path: root/src/librustc/back
AgeCommit message (Collapse)AuthorLines
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-6/+6
2014-10-06auto merge of #17781 : P1start/rust/bitflags-lints, r=alexcrichtonbors-2/+2
Closes #17773.
2014-10-06Rename the file permission statics in std::io to be uppercaseP1start-2/+2
For example, this renames `GroupRWX` to `GROUP_RWX`, and deprecates the old name. Code using these statics should be updated accordingly.
2014-10-05work around yet another MinGW-w64 ASLR bugDaniel Micay-4/+4
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-6/+6
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-6/+6
2014-09-30librustc: Forbid `..` in range patterns.Patrick Walton-3/+3
This breaks code that looks like: match foo { 1..3 => { ... } } Instead, write: match foo { 1...3 => { ... } } Closes #17295. [breaking-change]
2014-09-29rollup merge of #17619 : wizeman/fix-permAlex Crichton-0/+12
2014-09-29rustc: Fix permission denied error in 'ar' when lto is enabledRicardo M. Correia-0/+12
The reason that 'ar' can fail with permission denied is that when link-time optimizations are enabled, rustc copies libraries into a temporary directory, preserving file permissions, and subsequently modifies them using 'ar'. The modification can fail because some package managers may install libraries in system directories as read-only files, which means the temporary file also becomes read-only when it is copied. I have fixed this by giving the temporary file's owner read+write permissions after the copy. I have also added a regression test for this issue.
2014-09-28Keep ExpnId abstract by providing conversionsKeegan McAllister-1/+1
2014-09-27Translate inline assembly errors back to source locationsKeegan McAllister-7/+36
Fixes #17552.
2014-09-24Remove dead code from librustcJakub Wieczorek-7/+0
2014-09-22Link libgcc statically on Win64.Vadim Chugunov-4/+9
Allow linking it statically on Win32 with an override.
2014-09-19rollup merge of #17363 : thestinger/aslrAlex Crichton-1/+3
2014-09-19rollup merge of #17358 : epdtry/pcg-ltoAlex Crichton-104/+118
2014-09-19Add enum variants to the type namespaceNick Cameron-4/+4
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-18stop disabling ASLR in normal Windows buildsDaniel Micay-1/+3
Closes #16514
2014-09-17support LTO against libraries built with codegen-units > 1Stuart Pernsteiner-104/+118
2014-09-16Fallout from renamingAaron Turon-5/+5
2014-09-15auto merge of #17208 : kmcallister/rust/llvm-diagnostics, r=thestingerbors-11/+56
I would like to map this information back to AST nodes, so that we can print remarks with spans, and so that remarks can be enabled on a per-function basis. Unfortunately, doing this would require a lot more code restructuring — for example, we currently throw away the AST map and lots of other information before LLVM optimizations run. So for the time being, we print the remarks with debug location strings from LLVM. There's a warning if you use `-C remark` without `--debuginfo`. Fixes #17116.
2014-09-15Only pass -fno-use-linker-plugin on WindowsFlorian Gilcher-1/+6
Only pass -fno-use-linker-plugin on Windows where it avoids pulling in dependencies. Passing it to clang on OS X and Linux would make it fail though.
2014-09-14auto merge of #17163 : pcwalton/rust/impls-next-to-struct, r=alexcrichtonbors-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Closes #17059. RFC #155. [breaking-change] r? @brson
2014-09-13auto merge of #17161 : vadimcn/rust/fix-debuginfo, r=alexcrichtonbors-1/+2
This PR fixes debuginfo tests on Windows.
2014-09-13librustc: Forbid inherent implementations that aren't adjacent to thePatrick Walton-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Additionally, if you used the I/O path extension methods `stat`, `lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have been moved to the the `std::io::fs::PathExtensions` trait. This breaks code like: fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Change this code to: use std::io::fs::PathExtensions; fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Closes #17059. RFC #155. [breaking-change]
2014-09-12Add -C remark for LLVM optimization remarksKeegan McAllister-11/+56
Fixes #17116.
2014-09-10Remove dependency on GCC's LTO linker plugin, since Rust does its' own LTO.Vadim Chugunov-0/+3
2014-09-10Disable ASLR on Windows, for now.Vadim Chugunov-1/+2
2014-09-08auto merge of #17053 : thestinger/rust/large_address_aware, r=sfackler,cmrbors-0/+6
By default, 32-bit Windows executables are restricted to 2GiB of address space even when running on 64-bit Windows when 4GiB is available. Closes #17043
2014-09-07Changed addl_lib_search_paths from HashSet to Vecinrustwetrust-5/+1
This makes the extra library paths given to the gcc linker come in the same order as the -L options on the rustc command line.
2014-09-06mark win32 binaries as large address awareDaniel Micay-0/+6
By default, 32-bit Windows executables are restricted to 2GiB of address space even when running on 64-bit Windows when 4GiB is available. Closes #17043
2014-09-06auto merge of #16907 : SimonSapin/rust/tempdir-result, r=huonwbors-2/+2
This allows using `try!()` [breaking-change] Fixes #16875
2014-09-05don't use `ld -r` with `-C codegen-units=1`Stuart Pernsteiner-0/+12
2014-09-05add workaround for mingw `ld --force-exe-suffix` behaviorStuart Pernsteiner-1/+25
2014-09-05don't leave unwanted temporary files with --emit=ir/asmStuart Pernsteiner-3/+6
2014-09-05use target-specific linker args when combining compilation unitsStuart Pernsteiner-2/+19
2014-09-05run optimization and codegen on worker threadsStuart Pernsteiner-249/+691
Refactor the code in `llvm::back` that invokes LLVM optimization and codegen passes so that it can be called from worker threads. (Previously, it used `&Session` extensively, and `Session` is not `Share`.) The new code can handle multiple compilation units, by compiling each unit to `crate.0.o`, `crate.1.o`, etc., and linking together all the `crate.N.o` files into a single `crate.o` using `ld -r`. The later linking steps can then be run unchanged. The new code preserves the behavior of `--emit`/`-o` when building a single compilation unit. With multiple compilation units, the `--emit=asm/ir/bc` options produce multiple files, so combinations like `--emit=ir -o foo.ll` will not actually produce `foo.ll` (they instead produce several `foo.N.ll` files). The new code supports `-Z lto` only when using a single compilation unit. Compiling with multiple compilation units and `-Z lto` will produce an error. (I can't think of any good reason to do such a thing.) Linking with `-Z lto` against a library that was built as multiple compilation units will also fail, because the rlib does not contain a `crate.bytecode.deflate` file. This could be supported in the future by linking together the `crate.N.bc` files produced when compiling the library into a single `crate.bc`, or by making the LTO code support multiple `crate.N.bytecode.deflate` files.
2014-09-05move back::link::write into a separate fileStuart Pernsteiner-479/+482
2014-09-05split CrateContext into shared and local piecesStuart Pernsteiner-0/+1
Break up `CrateContext` into `SharedCrateContext` and `LocalCrateContext`. The local piece corresponds to a single compilation unit, and contains all LLVM-related components. (LLVM data structures are tied to a specific `LLVMContext`, and we will need separate `LLVMContext`s to safely run multithreaded optimization.) The shared piece contains data structures that need to be shared across all compilation units, such as the `ty::ctxt` and some tables related to crate metadata.
2014-09-05make CrateContext fields privateStuart Pernsteiner-4/+4
2014-09-03Fix spelling errors and capitalization.Joseph Crail-2/+2
2014-08-31Have std::io::TempDir::new and new_in return IoResultSimon Sapin-2/+2
This allows using `try!()` [breaking-change] Fixes #16875
2014-08-25auto merge of #16694 : vadimcn/rust/debug-linker, r=alexcrichtonbors-0/+2
Shows linker spew even when linking succeeds. This is occasionally useful in order to see verbose linker output.
2014-08-24Enable the MergeFunc passBjörn Steinbrink-0/+7
Fixes #9536
2014-08-23Log linker stderr and stdout.Vadim Chugunov-0/+2
2014-08-23Complete renaming of win32 to windowsVadim Chugunov-1/+1
2014-08-17mark Windows binaries as compatible with ASLRDaniel Micay-0/+3
This is enough for dynamic libraries, but not executables because MinGW does not output a .reloc section even with `--dynamicbase`. It could either be worked around by exporting a DLL symbol from the executable or fixed in MinGW itself.
2014-08-16enable DEP (NX bit) for 32-bit Windows executablesDaniel Micay-0/+3
This is already enabled by default for x86_64 executables on Windows, but it needs to be manually enabled on x86. Closes #16533
2014-08-12Replace all references to "Win32" with "Windows".Vadim Chugunov-7/+7
For historical reasons, "Win32" has been used in Rust codebase to mean "Windows OS in general". This is confusing, especially now, that Rust supports Win64 builds. [breaking-change]
2014-08-07enable PIE by default on Linux for full ASLRDaniel Micay-3/+15
Rust already builds all code as position independent by default, so the linker can be told to build a position independent executable if it's not disabled with `-C relocation-model=dynamic-no-pic`. Position independent code does have a significant cost on i686 (not on x86_64 or ARM) but there's no significant cost to linking code that's already position independent as a position independent executable. Address space layout randomization makes exploiting vulnerabilities much more difficult by providing a statistical defence against an attempt to find or modify existing code / data. Without ASLR, it's trivial to use a vulnerability to take over control of the process via return-oriented programming. Rust code can be used for return-oriented programming whether it is safe or unsafe, so even a fully safe application needs to be built as a position independent executable to defend against vulnerabilities in unsafe blocks or C libraries. Sample program: extern crate libc; use std::mem; static mut global: u32 = 5; static constant: u32 = 5; fn foo() {} fn main() { let local = 5; println!("stack: {}, global: {}, constant: {}, fn: {}, lib fn: {}", &local as *const u32, unsafe { &global as *const u32 }, &constant as *const u32, unsafe { mem::transmute::<_, *const ()>(foo) }, unsafe { mem::transmute::<_, *const ()>(libc::mprotect) }); } Before: stack: 0x3ff15eb9f94, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x32749547530 stack: 0x3b5d47d80e4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x394469a7530 stack: 0x3fe2c4e5564, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x399734a2530 stack: 0x3e525e0fb24, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2f62a810530 stack: 0x3b50fb3eae4, global: 0x6ab488, constant: 0x47db40, fn: 0x4030e0, lib fn: 0x2e590e86530 After: stack: 0x38cf12c90a4, global: 0x3e2d46b488, constant: 0x3e2d23cf80, fn: 0x3e2d1c2510, lib fn: 0x2617d3b4530 stack: 0x3d733faf474, global: 0x7eb1839488, constant: 0x7eb160af80, fn: 0x7eb1590510, lib fn: 0x32d30c1f530 stack: 0x3bb42212ec4, global: 0x5bbb365488, constant: 0x5bbb136f80, fn: 0x5bbb0bc510, lib fn: 0x3595e6c1530 stack: 0x39f678c1ab4, global: 0x22c4e3c488, constant: 0x22c4c0df80, fn: 0x22c4b93510, lib fn: 0x3835b727530 stack: 0x3afb25bd394, global: 0x493eab2488, constant: 0x493e883f80, fn: 0x493e809510, lib fn: 0x3478d6a7530 This may also be necessary on other platforms, but I can only test on Linux right now. Note that GDB gained support for debugging position independent executables in version 7.1 (March 2010).
2014-08-04rustc: Link entire archives of native librariesAlex Crichton-16/+49
As discovered in #15460, a particular #[link(kind = "static", ...)] line is not actually guaranteed to link the library at all. The reason for this is that if the external library doesn't have any referenced symbols in the object generated by rustc, the entire library is dropped by the linker. For dynamic native libraries, this is solved by passing -lfoo for all downstream compilations unconditionally. For static libraries in rlibs this is solved because the entire archive is bundled in the rlib. The only situation in which this was a problem was when a static native library was linked to a rust dynamic library. This commit brings the behavior of dylibs in line with rlibs by passing the --whole-archive flag to the linker when linking native libraries. On OSX, this uses the -force_load flag. This flag ensures that the entire archive is considered candidate for being linked into the final dynamic library. This is a breaking change because if any static library is included twice in the same compilation unit then the linker will start emitting errors about duplicate definitions now. The fix for this would involve only statically linking to a library once. Closes #15460 [breaking-change]