about summary refs log tree commit diff
path: root/src/librustc_back/target/asmjs_unknown_emscripten.rs
AgeCommit message (Collapse)AuthorLines
2018-04-26Rename rustc_back::target to rustc_target::spec.Irina Popa-48/+0
2018-04-26rustc_back: move LinkerFlavor, PanicStrategy, and RelroLevel to target.Irina Popa-2/+1
2018-03-15setting ABORTING_MALLOC for asmjs backendsnf-1/+3
2018-03-03rustc: Tweak default linker selectionAlex Crichton-3/+0
This commit refactors how the path to the linker that we're going to invoke is selected. Previously all targets listed *both* a `LinkerFlavor` and a `linker` (path) option, but this meant that whenever you changed one you had to change the other. The purpose of this commit is to avoid coupling these where possible. Target specifications now only unconditionally define the *flavor* of the linker that they're using by default. If not otherwise specified each flavor now implies a particular default linker to run. As a result, this means that if you'd like to test out `ld` for example you should be able to do: rustc -Z linker-flavor=ld foo.rs whereas previously you had to do rustc -Z linker-flavor=ld -C linker=ld foo.rs This will hopefully make it a bit easier to tinker around with variants that should otherwise be well known to work, for example with LLD, `ld` on OSX, etc.
2018-01-28rustc: Split Emscripten to a separate codegen backendAlex Crichton-0/+1
This commit introduces a separately compiled backend for Emscripten, avoiding compiling the `JSBackend` target in the main LLVM codegen backend. This builds on the foundation provided by #47671 to create a new codegen backend dedicated solely to Emscripten, removing the `JSBackend` of the main codegen backend in the process. A new field was added to each target for this commit which specifies the backend to use for translation, the default being `llvm` which is the main backend that we use. The Emscripten targets specify an `emscripten` backend instead of the main `llvm` one. There's a whole bunch of consequences of this change, but I'll try to enumerate them here: * A *second* LLVM submodule was added in this commit. The main LLVM submodule will soon start to drift from the Emscripten submodule, but currently they're both at the same revision. * Logic was added to rustbuild to *not* build the Emscripten backend by default. This is gated behind a `--enable-emscripten` flag to the configure script. By default users should neither check out the emscripten submodule nor compile it. * The `init_repo.sh` script was updated to fetch the Emscripten submodule from GitHub the same way we do the main LLVM submodule (a tarball fetch). * The Emscripten backend, turned off by default, is still turned on for a number of targets on CI. We'll only be shipping an Emscripten backend with Tier 1 platforms, though. All cross-compiled platforms will not be receiving an Emscripten backend yet. This commit means that when you download the `rustc` package in Rustup for Tier 1 platforms you'll be receiving two trans backends, one for Emscripten and one that's the general LLVM backend. If you never compile for Emscripten you'll never use the Emscripten backend, so we may update this one day to only download the Emscripten backend when you add the Emscripten target. For now though it's just an extra 10MB gzip'd. Closes #46819
2017-10-09cleanup: rustc doesn't use an external archiverVadim Petrochenkov-1/+0
2017-09-30rustc: Specify c_int width for each targetDaniel Klauer-0/+1
(all i32 for now, as in liblibc)
2017-04-07-Z linker-flavorJorge Aparicio-2/+9
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-01-19tell emcc stip exception handling if panic rt usedSergey Pepyakin-0/+1
2016-12-31Auto merge of #38601 - schulzch:master, r=brsonbors-2/+3
Partial fix for #38489. Fixes script name resolution for windows by invoking `emcc.bat` instead of `emcc`, etc. Remaining issue: ``` Traceback (most recent call last): File "C:\Program Files\Emscripten\emscripten\1.35.0\\emcc", line 1309, in <module> final = shared.Building.llvm_opt(final, link_opts, DEFAULT_FINAL) File "C:\Program Files\Emscripten\emscripten\1.35.0\tools\shared.py", line 1471, in llvm_opt assert os.path.exists(target), 'Failed to run llvm optimizations: ' + output AssertionError: Failed to run llvm optimizations: ```
2016-12-25Move target_family to TargetOptions, not TargetAlex Crichton-1/+1
Just fixing a compile error
2016-12-25Emscripten targets are Unix targetsBrian Anderson-0/+1
2016-12-22Partial fix for #38489.Christoph Schulz-2/+3
2016-10-03change max_atomic_width type from u64 to Option<u64>Jorge Aparicio-1/+1
to better express the idea that omitting this field defaults this value to target_pointer_width
2016-09-30Call emcc with ERROR_ON_UNDEFINED_SYMBOLSBrian Anderson-0/+1
2016-09-12crate-ify compiler-rt into compiler-builtinsJorge Aparicio-1/+0
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib This commit moves the logic that used to build libcompiler-rt.a into a compiler-builtins crate on top of the core crate and below the std crate. This new crate still compiles the compiler-rt instrinsics using gcc-rs but produces an .rlib instead of a static library. Also, with this commit rustc no longer passes -lcompiler-rt to the linker. This effectively makes the "no-compiler-rt" field of target specifications a no-op. Users of `no_std` will have to explicitly add the compiler-builtins crate to their crate dependency graph *if* they need the compiler-rt intrinsics. Users of the `std` have to do nothing extra as the std crate depends on compiler-builtins. Finally, this a step towards lazy compilation of std with Cargo as the compiler-rt intrinsics can now be built by Cargo instead of having to be supplied by the user by some other method. closes #34400
2016-07-27librustc_back: convert fn target() to return ResultDoug Goldstein-3/+3
Change all the target generation functions to return a Result<Target, String> so that targets that are unable to be instantiated can be expressed as an Err instead of a panic!(). This should improve #33497 as well.
2016-05-09Add #[cfg(target_has_atomic)] to get atomic support for the current targetAmanieu d'Antras-0/+1
2016-04-19Make data-layout mandatory in target specs.Eduard Burtescu-0/+1
2016-02-08rustc: Use llvm-ar for custom targets by defaultAlex Crichton-1/+0
The compiler currently vendors its own version of "llvm-ar" (not literally the binary but rather the library support) and uses it for all major targets by default (e.g. everything defined in `src/librustc_back/target`). All custom target specs, however, still search for an `ar` tool by default. This commit changes this default behavior to using the internally bundled llvm-ar with the GNU format. Currently all targets use the GNU format except for OSX which uses the BSD format (surely makes sense, right?), and custom targets can change the format via the `archive-format` key in custom target specs. I suspect that we can outright remove support for invoking an external `ar` utility, but I figure for now there may be some crazy target relying on that so we should leave support in for now.
2016-02-06rustc: Add obj_is_bitcode to TargetOptionsBrian Anderson-0/+1
This tells trans::back::write not to LLVM codegen to create .o files but to put LLMV bitcode in .o files. Emscripten's emcc supports .o in this format, and this is, I think, slightly easier than making rlibs work without .o files.
2016-02-06Add the asmjs-unknown-emscripten triple. Add cfgs to libs.Brian Anderson-0/+37
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It disables stack protection.