about summary refs log tree commit diff
path: root/src/librustc_target
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-13324/+0
2020-08-27Auto merge of #74941 - dylanmckay:replace-broken-avr-unknown-unknown-target, ↵bors-50/+58
r=oli-obk [AVR] Replace broken 'avr-unknown-unknown' target with 'avr-unknown-gnu-atmega328' target The `avr-unknown-unknown` target has never worked correctly, always trying to invoke the host linker and failing. It aimed to be a mirror of AVR-GCC's default handling of the `avr-unknown-unknown' triple (assume bare minimum chip features, silently skip linking runtime libraries, etc). This behaviour is broken-by-default as it will cause a miscompiled executable when flashed. This patch improves the AVR builtin target specifications to instead expose only a 'avr-unknown-gnu-atmega328' target. This target system is `gnu`, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'. In the future, it should be possible to replace the dependency on AVR-GCC and binutils by using the in-progress AVR LLD and compiler-rt support. Perhaps at that point it would make sense to add an 'avr-unknown-unknown-atmega328' target as a better default when implemented. There is no current intention to add in-tree AVR target specifications for other AVR microcontrollers - this one can serve as a reference implementation for other devices via `rustc --print target-spec-json avr-unknown-gnu-atmega328p`. There should be no users of the existing 'avr-unknown-unknown' Rust target as a custom target specification JSON has always been recommended, and the avr-unknown-unknown target could never pass the linking step anyway.
2020-08-26Auto merge of #75843 - hermitcore:devel, r=nagisabors-6/+6
HermitCore switchs to relocatable binaries - switch to relocatbale binaries to realize ASLR - remove all dependencies to gcc
2020-08-24[AVR] Merge the 'freestanding' base target spec into AVR base target specDylan McKay-35/+21
The 'freestanding' module was only ever used for AVR. It was an unnecessary layer of abstraction. This commit merges the 'freestanding_base' module into 'avr_gnu_base'.
2020-08-24[AVR] Remove unnecessary arguments passed to the linker for GNU targetDylan McKay-4/+3
In general, linking with libc is not required, only libgcc is needed. As suggested in the code review, a better option for libc support is by building it into rust-lang/libc directly. This also removes the '-Os' argument to the linker, which is a NOP.
2020-08-24[AVR] Replace broken 'avr-unknown-unknown' target with ↵Dylan McKay-18/+41
'avr-unknown-gnu-atmega328' target The `avr-unknown-unknown` target has never worked correctly, always trying to invoke the host linker and failing. It aimed to be a mirror of AVR-GCC's default handling of the `avr-unknown-unknown' triple (assume bare minimum chip features, silently skip linking runtime libraries, etc). This behaviour is broken-by-default as it will cause a miscompiled executable when flashed. This patch improves the AVR builtin target specifications to instead expose only a 'avr-unknown-gnu-atmega328' target. This target system is `gnu`, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'. In the future, it should be possible to replace the dependency on AVR-GCC and binutils by using the in-progress AVR LLD and compiler-rt support. Perhaps at that point it would make sense to add an 'avr-unknown-unknown-atmega328' target as a better default when implemented. There is no current intention to add in-tree AVR target specifications for other AVR microcontrollers - this one can serve as a reference implementation for other devices via `rustc --print target-spec-json avr-unknown-gnu-atmega328p`. There should be no users of the existing 'avr-unknown-unknown' Rust target as a custom target specification JSON has always been recommended, and the avr-unknown-unknown target could never pass the linking step anyway.
2020-08-23HermitCore switchs to relocatable binariesStefan Lankes-6/+6
- switch to relocatbale binaries to realize ASLR - remove all dependencies to gcc
2020-08-15replaced log with tracingGurpreet Singh-2/+2
2020-08-15Auto merge of #75483 - mati865:mingw-lld-flags, r=petrochenkovbors-67/+71
Add LLD flags for MinGW Tested locally and this now works: - `RUSTFLAGS="-Zlink-self-contained=yes -Clinker=rust-lld" cargo b` - `RUSTFLAGS="-Zlink-self-contained=no -Clinker=rust-lld -Zpre-link-arg=-Ld:/msys64/mingw64/x86_64-w64-mingw32/lib -Zpre-link-arg=-Ld:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.2.0 -Zpre-link-arg=crt2.o" cargo b` This is "harmless" part of the changes to make possible linking with bare LLD with windows-gnu target. More debatable changes should follow in next PRs soon.
2020-08-14Rework `rustc_serialize`Matthew Jasper-47/+16
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-13Add LLD flags for MinGWMateusz Mikuła-67/+71
2020-08-04Remove the `--no-threads` workaround for wasm targets.Dan Gohman-7/+0
Remove `--no-threads` from the wasm-ld command-line, which was a workaround for [an old bug] which was fixed in LLVM 9.0, and is no longer needed. Also, the `--no-threads` option has been [removed upstream]. [an old bug]: https://bugs.llvm.org/show_bug.cgi?id=41508 [removed upstream]: https://reviews.llvm.org/D76885
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-29Change the target data layout to specify more valuesLokathor-1/+1
This does not actually alter the previously specified important parts, but apparently `rustc` cares about more layout components than `cargo-xbuild` ever did. This extends the data layout to be fully specified layout, as given in the error from issue #74767
2020-07-22Rollup merge of #74643 - petrochenkov:noenvrerun, r=Mark-SimulacrumManish Goregaokar-4/+0
build: Remove unnecessary `cargo:rerun-if-env-changed` annotations ... and a couple of related cleanups. rustc and cargo now track the majority of env var dependencies automatically (https://github.com/rust-lang/cargo/pull/8421), so the annotations are no longer necessary.
2020-07-22Rollup merge of #74631 - petrochenkov:ehdr2, r=jonas-schievinkManish Goregaokar-0/+20
rustc_target: Add a target spec option for disabling `--eh-frame-hdr` Disable `--eh-frame-hdr` for targets that use an `ld`-like linker, but don't support that option. Do it through a target spec option rather than through hard-coding in `linker.rs`. The option is still enabled by default though. cc https://github.com/rust-lang/rust/pull/73564 Fixes https://github.com/rust-lang/rust/pull/73564#issuecomment-657011004 Fixes https://github.com/rust-lang/rust/pull/74625 Fixes https://github.com/rust-embedded/msp430-rt/issues/12
2020-07-22Rollup merge of #74541 - shepmaster:aarch64-apple-darwin-target, r=nagisaManish Goregaokar-1/+35
Add the aarch64-apple-darwin target This is a basic copy-paste-modify from the existing x86_64-apple-darwin target.
2020-07-22build: Remove unnecessary `cargo:rerun-if-env-changed` annotationsVadim Petrochenkov-4/+0
2020-07-22rustc_target: Add a target spec option for disabling `--eh-frame-hdr`Vadim Petrochenkov-0/+20
2020-07-22[AVR] Ensure that function pointers stored within aggregates are annotated ↵Dylan McKay-2/+3
with the correct space Before this patch, a function pointer stored within an aggregate like a struct or an enum would always have the default address space `0`. This patch removes this assumption and instead, introspects the inner type being pointed at, storing the target address space in the PointeeInfo struct so that downstream users may query it.
2020-07-22[AVR] Correctly set the pointer address space when constructing pointers to ↵Dylan McKay-3/+14
functions This patch extends the existing `type_i8p` method so that it requires an explicit address space to be specified. Before this patch, the `type_i8p` method implcitily assumed the default address space, which is not a safe transformation on all targets, namely AVR. The Rust compiler already has support for tracking the "instruction address space" on a per-target basis. This patch extends the code generation routines so that an address space must always be specified. In my estimation, around 15% of the callers of `type_i8p` produced invalid code on AVR due to the loss of address space prior to LLVM final code generation. This would lead to unavoidable assertion errors relating to invalid bitcasts. With this patch, the address space is always either 1) explicitly set to the instruction address space because the logic is dealing with functions which must be placed there, or 2) explicitly set to the default address space 0 because the logic can only operate on data space pointers and thus we keep the existing semantics of assuming the default, "data" address space.
2020-07-20Add the aarch64-apple-darwin targetJake Goulding-1/+35
This is a basic copy-paste-modify from the existing x86_64-apple-darwin target.
2020-07-19Rollup merge of #74419 - Lokathor:gba-target, r=jonas-schievinkManish Goregaokar-0/+63
Add a thumbv4t-none-eabi target (cc @ketsuban, one of the few other Rust users who programs for GBA.) --- **EDIT:** This is now a more general `thumbv4t-none-eabi` PR! See [this comment](https://github.com/rust-lang/rust/pull/74419#issuecomment-660391579) --- Now that the PSP officially has an official target within Rust, well as the lead of the `gba` crate I can't _not_ add a GBA target as well. I know that the [target tier policy](https://github.com/rust-lang/rfcs/pull/2803) isn't ratified and official, but I'll use it as an outline (cc @joshtriplett): * Designated Developer: Lokathor * Naming consistent with any existing targets * Doesn't create Rust project legal issues. * No license issues * Uses the standard Apache/mit license. * Rust tooling users don't have to accept any new licensing requirements * Does not support hosting rust tooling. * Doesn't require linking in proprietary code to obtain a functional binary. However, you will need to do some post-build steps to turn the ELF file into a usable GBA ROM (either for an emulator or for the actual hardware). * This is a `no_std` environment, without even a standard global allocator, so this adds no new code to `alloc` or `std`. * The process of building for this target is documented in the `gba` crate ([link](https://rust-console.github.io/gba/development-setup.html)). Well, the docs there are currently a little out of date, they're back on using `cargo-xbuild`, but the crate docs there will get updated once this target is available. * This places no new burden on any other targets * Does not break any existing targets. I'm not fully confident in specifying the same linker script for all possible projects, so I'm currently just not giving a linker script at all, and users can continue to select their own linker script by using `-C` to provide a linker arg. I added the file, and added it to the `supported_targets!` macro usage, and I think that's all there is to do.
2020-07-18remove unused importsLokathor-1/+1
2020-07-18Resolve https://github.com/rust-lang/rust/pull/74419#issuecomment-660518936Lokathor-14/+1
2020-07-17Make the new target a general thumbv4t target.Lokathor-13/+19
2020-07-17Rollup merge of #74394 - bjorn3:remove_emscripten_leftover, r=spastorinoManish Goregaokar-6/+0
Remove leftover from emscripten fastcomp support This is no longer used since #63649
2020-07-16Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456139741Lokathor-2/+0
2020-07-16resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456140272Lokathor-3/+0
2020-07-16Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456142514Lokathor-3/+0
2020-07-16Resolve https://github.com/rust-lang/rust/pull/74419#discussion_r456141344Lokathor-3/+0
2020-07-16fix the imports.Lokathor-1/+1
2020-07-16apply bootstrap cfgsMark Rousskov-1/+0
2020-07-16Add to supported_targets list.Lokathor-0/+1
2020-07-16Docs clarifications.Lokathor-5/+5
2020-07-16fill in all those options.Lokathor-11/+61
2020-07-16Remove leftover from emscripten fastcomp supportbjorn3-6/+0
This is no longer used since #63649
2020-07-16start GBA file.Lokathor-0/+30
2020-07-11don't mark linux kernel module targets as a unix environmentAlex Gaynor-1/+0
2020-07-10Avoid "whitelist"Tamir Duberstein-10/+10
Other terms are more inclusive and precise.
2020-07-08Avoid "blacklist"Tamir Duberstein-77/+85
Other terms are more inclusive and precise. Clippy still has a lint named "blacklisted-name", but renaming it would be a breaking change, so is left for future work. The target configuration option "abi-blacklist" has been depreciated and renamed to "unsupported-abis". The old name continues to work.
2020-07-02Rollup merge of #73564 - petrochenkov:ehdr, r=AmanieuManish Goregaokar-14/+2
linker: Create GNU_EH_FRAME header by default when producing ELFs Do it in a centralized way in `link.rs` instead of individual target specs. The opt-out is `-Clink-arg=(-Wl,)--no-eh-frame-hdr` if necessary. Fixes https://github.com/rust-lang/rust/issues/73451 cc https://github.com/rust-lang/rust/pull/73483
2020-06-28Remove `const_if_match` feature gate from librariesDylan MacKenzie-1/+1
2020-06-27linker: Create GNU_EH_FRAME header by default when producing ELFsVadim Petrochenkov-14/+2
2020-06-26Rollup merge of #72937 - AdrianCX:master, r=nikomatsakisManish Goregaokar-2/+4
Fortanix SGX target libunwind build process changes Ticket: https://github.com/fortanix/rust-sgx/issues/174 LLVM related changes (merged): https://github.com/rust-lang/llvm-project/pull/57 Description: libunwind changes needed to run code in sgx environment via rust-sgx. Target that uses this in rust: x86_64-fortanix-unknown-sgx. Without this change, rust std for this toolchain is forced to use a precompiled library loaded via environment variable. With this change we act the same as musl target.
2020-06-26Rollup merge of #73588 - Amanieu:thumb-fp, r=nagisaManish Goregaokar-18/+62
Fix handling of reserved registers for ARM inline asm `r6` is now disallowed as an operand since LLVM sometimes uses it as a base pointer. The check against using the frame pointer as an operand now takes the platform into account and will block either `r7` or `r11` as appropriate. Fixes #73450 cc @cbiffle
2020-06-25Rollup merge of #73516 - Crabapple-iOS:feature/apple-dynamic-linking, ↵Dylan DPC-1/+0
r=nikomatsakis Allow dynamic linking for iOS/tvOS targets During the development and testing of the [Crabapple project](https://github.com/Crabapple-iOS/Crabapple), one obstacle was the lack of `cdylib` target support for iOS. Surprisingly, once `dynamic_linking` was enabled for iOS targets, it worked seemingly flawlessly. I could not find any information on why this was initially or still is disabled.
2020-06-24Update libunwind build process for x86_64-fortanix-unknown-sgx targetAdrian Cruceru-2/+4
2020-06-21Fix handling of reserved registers for ARM inline asmAmanieu d'Antras-18/+62
2020-06-19Allow dynamic linking for iOS/tvOS targets.luxx4x-1/+0