about summary refs log tree commit diff
path: root/compiler/rustc_target/src
AgeCommit message (Collapse)AuthorLines
2020-11-08rustc_target: Rename some target options to avoid tautologyVadim Petrochenkov-219/+195
`target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount`
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-59/+64
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-07Update recently added targetsVadim Petrochenkov-6/+2
2020-11-07rustc_target: Move `linker_flavor` from `Target` to `TargetOptions`Vadim Petrochenkov-244/+120
2020-11-07rustc_target: Move `target_vendor` from `Target` to `TargetOptions`Vadim Petrochenkov-163/+28
2020-11-07rustc_target: Move `target_env` from `Target` to `TargetOptions`Vadim Petrochenkov-158/+27
2020-11-07rustc_target: Move `target_os` from `Target` to `TargetOptions`Vadim Petrochenkov-169/+52
2020-11-07rustc_target: Move `target_endian` from `Target` to `TargetOptions`Vadim Petrochenkov-168/+75
2020-11-07rustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`Vadim Petrochenkov-155/+20
2020-11-05Fix automatic_links warningsGuillaume Gomez-4/+4
2020-11-04Update compiler/rustc_target/src/abi/mod.rsOli Scherer-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04Update compiler/rustc_target/src/abi/mod.rsOli Scherer-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-11-04`u128` truncation and sign extension are not just interpreter relatedoli-0/+29
2020-11-02indicate calling conventionStephan-1/+1
2020-11-02improve commentsStephan-2/+3
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-02add blacklist for unsupported calling conventionsStephan-0/+9
2020-11-02add mipsel_unknown_none targetStephan-0/+33
2020-10-30Fix even more clippy warningsJoshua Nelson-48/+15
2020-10-24Rollup merge of #77716 - francesca64:revert-ios-dynamic-linking, ↵Jonas Schievink-0/+1
r=jonas-schievink Revert "Allow dynamic linking for iOS/tvOS targets." This reverts PR #73516. On macOS I compile static libs for iOS, automated using [cargo-mobile](https://github.com/BrainiumLLC/cargo-mobile), which has worked smoothly for the past 2 years. However, upon updating to Rust 1.46.0, I was no longer able to use Rust on iOS. I've bisected this to the PR referenced above. For most projects tested, apps now immediately crash with a message like this: ``` dyld: Library not loaded: /Users/francesca/Projects/example/target/aarch64-apple-ios/debug/deps/libexample.dylib Referenced from: /private/var/containers/Bundle/Application/745912AF-A928-465C-B340-872BD1C9F368/example.app/example Reason: image not found dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib ``` This can be reproduced by using cargo-mobile to generate a winit example project, and then attempting to run it on an iOS device (`cargo mobile init && cargo apple open`). In our projects that depend on DisplayLink, the build instead fails with a linker error: ``` = note: Undefined symbols for architecture arm64: "_CACurrentMediaTime", referenced from: display_link::ios::run_callback_ios10::hda81197ff46aedbd in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o) display_link::ios::run_callback_pre_ios10::h91f085da19374320 in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o) ld: symbol(s) not found for architecture arm64 ``` After reverting the change to enable dynamic linking on iOS, everything works the same as it did on Rust 1.45.2 for me. In the future, would it be possible for me to be pinged when iOS-related PRs are made? I work for a company that intends on using Rust on iOS in production, so I'd gladly provide testing. cc @aspenluxxxy
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-4/+1
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-15Rename target_pointer_width to pointer_width and turn it into an u32est31-7/+12
Rename target_pointer_width to pointer_width because it is already member of the Target struct. The compiler supports only three valid values for target_pointer_width: 16, 32, 64. Thus it can safely be turned into an int. This means less allocations and clones as well as easier handling of the type.
2020-10-15Use integer literals for builtin target_pointer_width fieldsest31-151/+151
Also change target_pointer_width to pointer_width. Preparation for a subsequent type change of target_pointer_width to an integer together with a rename to pointer_width. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/rustc_target/src/spec/ -type f -exec sed -i -e 's/target_pointer_width: "\(.*\)"\..*,/pointer_width: \1,/g' {} \;
2020-10-14Rollup merge of #77765 - amshafer:master, r=petrochenkovDylan DPC-0/+21
Add LLVM flags to limit DWARF version to 2 on BSD This has been a thorn in my side for a while, I can finally generate flamegraphs of rust programs on bsd again. This fixes dtrace profiling on freebsd, I think it might help with lldb as well but I can't test that because my current rust-lldb setup is messed up. I'm limiting the dwarf version to 2 on all bsd's (netbsd/openbsd/freebsd) since it looks like this applies to all of them, but I have only tested on freebsd. Let me know if there's anything I can improve! --- Currently on FreeBSD dtrace profiling does not work and shows jumbled/incorrect symbols in the backtraces. FreeBSD does not support the latest versions of DWARF in dtrace (and lldb?) yet, and needs to be limited to DWARF2 in the same way as macos. This adds an is_like_bsd flag since it was missing. NetBSD/OpenBSD/FreeBSD all match this. This effectively copies #11864 but targets FreeBSD instead of macos.
2020-10-13Add a target option for selecting a DWARF versionAustin Shafer-0/+21
Certain platforms need to limit the DWARF version emitted (oxs, *bsd). This change adds a dwarf_version entry to the options that allows a platform to specify the dwarf version to use. By default this option is none and the default DWARF version is selected. Also adds an option for printing Option<u32> json keys
2020-10-13Auto merge of #75406 - mati865:mingw-aslr, r=Mark-Simulacrumbors-2/+12
Enable ASLR for windows-gnu Fixes https://github.com/rust-lang/rust/issues/16514 Fixes https://github.com/rust-lang/rust/issues/16593 Fixes https://github.com/rust-lang/rust/issues/17684 Passes the tests for me with x86_64 toolchain.
2020-10-10Auto merge of #77337 - lzutao:asm-mips64, r=Amanieubors-39/+44
Add asm! support for mips64 - [x] Updated `src/doc/unstable-book/src/library-features/asm.md`. - [ ] No vector type support. I don't know much about those types. cc #76839
2020-10-10Auto merge of #77580 - petrochenkov:norestarg, r=matthewjasperbors-667/+631
rustc_target: Refactor away `TargetResult` Follow-up to https://github.com/rust-lang/rust/pull/77202. Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary. The second commit contains some further cleanup based on built-in target construction being infallible.
2020-10-08Implement the instruction_set attributexd009642-0/+11
2020-10-07Revert "Allow dynamic linking for iOS/tvOS targets."Francesca Lovebloom-0/+1
This reverts commit 56e115a2627ba8bdd2e66c759457af96b2b0286a.
2020-10-05rustc_target: Further simplify loading of built-in targetsVadim Petrochenkov-38/+13
using the fact that it is infallible. JSON roundtrip check on every rustc run is also removed, it's already performed by unit tests.
2020-10-05rustc_target: Refactor away `TargetResult`Vadim Petrochenkov-630/+619
Construction of a built-in target is always infallible now, so `TargetResult` is no longer necessary.
2020-10-04Support static linking with glibc and target-feature=+crt-staticJosh Triplett-2/+2
With this change, it's possible to build on a linux-gnu target and pass RUSTFLAGS='-C target-feature=+crt-static' or the equivalent via a `.cargo/config.toml` file, and get a statically linked executable. This requires libc 0.2.79, which adds support for static linking with glibc. Add `crt_static_respected` to the `linux_base` target spec. Update `android_base` and `linux_musl_base` accordingly. Avoid enabling crt_static_respected on Android platforms, since that hasn't been tested.
2020-10-04Removes reg aliases since there are many ABIs: o32/n32/n64Lzu Tao-32/+32
2020-10-04Add asm! support for mips64Lzu Tao-7/+12
2020-10-04mips32: Add f64 hard-float supportLzu Tao-1/+1
co-authored-by: Amanieu <amanieu@gmail.com>
2020-10-02Returns values up to 2*usize by valueJonas Schievink-12/+0
2020-10-01Rollup merge of #77202 - ehuss:defer-apple-sdkroot, r=petrochenkovDylan DPC-128/+20
Defer Apple SDKROOT detection to link time. This defers the detection of the SDKROOT for Apple iOS/tvOS targets to link time, instead of when the `Target` is defined. This allows commands that don't need to link to work (like `rustdoc` or `rustc --print=target-list`). This also makes `--print=target-list` a bit faster. This also removes the note in the platform support documentation about these targets being missing. When I wrote it, I misunderstood how the SDKROOT stuff worked. Notes: * This means that JSON spec targets can't explicitly override these flags. I think that is probably fine, as I believe the value is generally required, and can be set with the SDKROOT environment variable. * This changes `x86_64-apple-tvos` to use `appletvsimulator`. I think the original code was wrong (it was using `iphonesimulator`). Also, `x86_64-apple-tvos` seems broken in general, and I cannot build it locally. The `data_layout` does not appear to be correct (it is a copy of the arm64 layout instead of the x86_64 layout). I have not tried building Apple's LLVM to see if that helps, but I suspect it is just wrong (I'm uncertain since I don't know how the tvOS simulator works with its bitcode-only requirements). * I'm tempted to remove the use of `Result` for built-in target definitions, since I don't think they should be fallible. This was added in https://github.com/rust-lang/rust/pull/34980, but that only relates to JSON definitions. I think the built-in targets shouldn't fail. I can do this now, or not. Fixes #36156 Fixes #76584
2020-09-27Rollup merge of #76839 - lzutao:mips-asm, r=AmanieuJonas Schievink-0/+157
Add asm! support for MIPS For now, I only add support for mips32. mips64 may come in future PRs if I could learn more about the target.
2020-09-27Auto merge of #71274 - RalfJung:raw-init-check-aggregate, r=petrochenkovbors-4/+19
might_permit_raw_init: also check aggregate fields This is the next step for https://github.com/rust-lang/rust/issues/66151: when doing `mem::zeroed`/`mem::uninitialized`, also recursively check fields of aggregates (except for arrays) for whether they permit zero/uninit initialization.
2020-09-27Add MIPS asm! supportLzu Tao-0/+157
This patch also: * Add soft-float supports: only f32 * zero-extend i8/i16 to i32 because MIPS only supports register-length arithmetic. * Update table in asm! chapter in unstable book.
2020-09-27Auto merge of #76986 - jonas-schievink:ret-in-reg, r=nagisabors-0/+12
Return values up to 128 bits in registers This fixes https://github.com/rust-lang/rust/issues/26494#issuecomment-619506345 by making Rust's default ABI pass return values up to 128 bits in size in registers, just like the System V ABI. The result is that these methods from the comment linked above now generate the same code, making the Rust ABI as efficient as the `"C"` ABI: ```rust pub struct Stats { x: u32, y: u32, z: u32, } pub extern "C" fn sum_c(a: &Stats, b: &Stats) -> Stats { return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z }; } pub fn sum_rust(a: &Stats, b: &Stats) -> Stats { return Stats {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z }; } ``` ```asm sum_rust: movl (%rsi), %eax addl (%rdi), %eax movl 4(%rsi), %ecx addl 4(%rdi), %ecx movl 8(%rsi), %edx addl 8(%rdi), %edx shlq $32, %rcx orq %rcx, %rax retq ```
2020-09-27Rollup merge of #77208 - mati865:late-link-args-order, r=petrochenkovJonas Schievink-6/+1
Late link args order MSYS2 changed how winpthreads is built and as the result it now depends on more mingw-w64 libraries. This PR affects only MinGW targets since nobody else is using `late_link_args_{dynamic,static}`. Now the order is similar to how it used to be before https://github.com/rust-lang/rust/pull/67502.
2020-09-26Return values up to 128 bits in registersJonas Schievink-0/+12
2020-09-26might_permit_raw_init: also check aggregate fieldsRalf Jung-4/+19
2020-09-25Defer Apple SDKROOT detection to link time.Eric Huss-128/+20
2020-09-25Link dynamic and static late_link_args before generic onesMateusz Mikuła-6/+1
2020-09-25Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514Jonas Schievink-1/+1
Updated html_root_url for compiler crates Closes #77103 r? @jyn514
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-21fix typo in docs and commentsyuk1ty-1/+1