about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back/linker.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1351/+0
2020-08-16Use more compatible out-implib styleMateusz Mikuła-1/+1
2020-08-14Rework `rustc_serialize`Matthew Jasper-1/+1
- 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-07-29Auto merge of #72049 - mati865:mingw-lld, r=petrochenkovbors-2/+21
MinGW: enable dllexport/dllimport Fixes (only when using LLD) https://github.com/rust-lang/rust/issues/50176 Fixes https://github.com/rust-lang/rust/issues/72319 This makes `windows-gnu` on pair with `windows-msvc` when it comes to symbol exporting. For MinGW it means both good things like correctly working dllimport/dllexport, ability to link with LLD and bad things like https://github.com/rust-lang/rust/issues/27438. Not sure but maybe this should land behind unstable compiler option (`-Z`) or environment variable?
2020-07-29MinGW: emit dllexport/dllimport by rustcMateusz Mikuła-2/+21
This fixes various cases where LD could not guess dllexport correctly and greatly improves compatibility with LLD which is not going to support linker scripts anytime soon
2020-07-22rustc_target: Add a target spec option for disabling `--eh-frame-hdr`Vadim Petrochenkov-7/+1
2020-07-18Revert "Use an UTF-8 locale for the linker."Jonas Schievink-3/+1
2020-07-17Use an UTF-8 locale for the linker.Jakub Kądziołka-1/+3
2020-07-11Rollup merge of #74167 - jclulow:illumos-linker-eh-frame-hdr-fix, r=petrochenkovManish Goregaokar-1/+1
linker: illumos ld does not support --eh-frame-hdr As of rust-lang/rust#73564, the --eh-frame-hdr flag is unconditionally passed to linkers on many platforms. The illumos link editor does not currently support this flag. The linker machinery in the Rust toolchain currently seems to use the (potentially cross-compiled) target to choose linker flags, rather than looking at what might be running on the build system. Disabling the flag for all illumos/Solaris targets seems like the best we can do for now without more serious surgery.
2020-07-10Rollup merge of #74127 - tamird:allowlist, r=oli-obkManish Goregaokar-4/+4
Avoid "whitelist" Other terms are more inclusive and precise.
2020-07-10Avoid "whitelist"Tamir Duberstein-4/+4
Other terms are more inclusive and precise.
2020-07-10Only add cfguard module flag on windows-msvcAndrew Paverd-12/+4
2020-07-08linker: illumos ld does not support --eh-frame-hdrJoshua M. Clulow-1/+1
As of rust-lang/rust#73564, the --eh-frame-hdr flag is unconditionally passed to linkers on many platforms. The illumos link editor does not currently support this flag. The linker machinery in the Rust toolchain currently seems to use the (potentially cross-compiled) target to choose linker flags, rather than looking at what might be running on the build system. Disabling the flag for all illumos/Solaris targets seems like the best we can do for now without more serious surgery.
2020-06-27linker: Create GNU_EH_FRAME header by default when producing ELFsVadim Petrochenkov-0/+14
2020-06-23rustc: Modernize wasm checks for atomicsAlex Crichton-3/+2
This commit modernizes how rustc checks for whether the `atomics` feature is enabled for the wasm target. The `sess.target_features` set is consulted instead of fiddling around with dealing with various aspects of LLVM and that syntax.
2020-06-19Rollup merge of #72785 - petrochenkov:wholemsvc, r=matthewjasperRalf Jung-2/+4
linker: MSVC supports linking static libraries as a whole archive
2020-06-15linker: Never pass `-no-pie` to non-gnu linkersVadim Petrochenkov-2/+2
2020-06-08Use shorthand linker strip arguments in order to support MacOSAlan Egerton-2/+4
2020-06-03rustc_target: Remove `pre_link_args_crt`Vadim Petrochenkov-0/+15
2020-06-01rustc: Remove the `--passive-segments` LLD flag on wasmAlex Crichton-4/+0
This flag looks like it's been removed in LLVM 10, so this removes rustc unconditionally passing the flag.
2020-05-30linker: MSVC supports linking static libraries as a whole archiveVadim Petrochenkov-2/+4
2020-05-29Rollup merge of #71804 - petrochenkov:static-pie, r=cuviperRalf Jung-110/+117
linker: Support `-static-pie` and `-static -shared` This PR adds support for passing linker arguments for creating statically linked position-independent executables and "statically linked" shared libraries. Therefore it incorporates the majority of https://github.com/rust-lang/rust/pull/70740 except for the linker rerun hack and actually flipping the "`static-pie` is supported" switch for musl targets.
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-2/+1
2020-05-20linker: Support `-static-pie` and `-static -shared`Vadim Petrochenkov-110/+117
2020-05-14linker: More systematic handling of CRT objectsVadim Petrochenkov-1/+20
2020-05-10add linking option stripYI-32/+51
move strip option to "Z" add more strip options, remove strip-debuginfo-if-disabled merge strip and debuginfo
2020-04-27Disable localization for all linkersVadim Petrochenkov-0/+13
2020-04-24Replace filter_map().next() calls with find_map()Josh Stone-5/+1
These are semantically the same, but `find_map()` is more concise.
2020-04-19Replace uses of `parse_opt_*` with `parse_*` where possible.Nicholas Nethercote-1/+1
This lets us specify the default at the options declaration point, instead of using `.unwrap(default)` or `None | Some(default)` at some use point far away. It also makes the code more concise.
2020-04-13linker: Pass `/NODEFAULTLIB` in a more regular wayVadim Petrochenkov-9/+1
2020-04-07linker: Combine argument building into a single functionVadim Petrochenkov-17/+11
2020-04-07linker: Make argument building interface in `trait Linker` richerVadim Petrochenkov-19/+28
by redirecting everything to `Command`
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-2/+2
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-2/+2
2020-03-16use direct imports for `rustc::{lint, session}`.Mazdak Farrokhzad-3/+3
2020-01-28Add support for Control Flow Guard on Windows.Andrew Paverd-0/+21
This patch enables rustc to emit the required LLVM module flags to enable Control Flow Guard metadata (cfguard=1) or metadata and checks (cfguard=2). The LLVM module flags are ignored on unsupported targets and operating systems.
2020-01-23Add `-Z no-link` flagVictor Ding-0/+1
Adds a compiler option to allow rustc compile a crate without linking. With this flag, rustc serializes codegen_results into a .rlink file.
2020-01-20Make sure that all upstream generics get re-exported from Rust dylibs.Michael Woerister-7/+6
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-1/+1
2020-01-02Normalize `syntax::symbol` imports.Mazdak Farrokhzad-1/+1
2019-12-22Format the worldMark Rousskov-163/+160
2019-12-03Change linker for x86_64-fortanix-unknown-sgx to rust-lldParth Sane-1/+2
For SGX, the relocation using the relocation table is done by the code in rust/src/libstd/sys/sgx/abi/reloc.rs and this code should not require relocation. Setting RelaxELFRelocations flag if allows this to happen, hence adding a Target Option for it.
2019-11-01targeted revert of PR rust-lang/rust#64324 (just undo change to dylib ↵Felix S. Klock II-15/+4
generics export). Includes the anticipated fallout to run-make-fulldeps test suite from this change. (We need to reopen issue 64319 as part of landing this.)
2019-09-23Allow using upstream generics in a dylib crate typeAlex Crichton-2/+20
... just don't export them!
2019-09-23rustc: Convert `dependency_formats` to a queryAlex Crichton-3/+9
This commit converts a field of `Session`, `dependency_formats`, into a query of `TyCtxt`. This information then also needed to be threaded through to other remaining portions of the linker, but it's relatively straightforward. The only change here is that instead of `HashMap<CrateType, T>` the data structure changed to `Vec<(CrateType, T)>` to make it easier to deal with in queries.
2019-09-11Use `Symbol` in `Linker`.Nicholas Nethercote-37/+42
2019-08-27Prevent syntax error in ld linker version scriptLogan Wendholt-4/+7
2019-07-29Rollup merge of #62809 - alexcrichton:wasm-llvm-9, r=nikicMazdak Farrokhzad-1/+46
rustc: Update wasm32 support for LLVM 9 This commit brings in a number of minor updates for rustc's support for the wasm target which has changed in the LLVM 9 update. Notable updates include: * The compiler now no longer manually inserts the `producers` section, instead relying on LLVM to do so. LLVM uses the `llvm.ident` metadata for the `processed-by` directive (which is now emitted on the wasm target in this PR) and it uses debuginfo to figure out what `language` to put in the `producers` section. * Threaded WebAssembly code now requires different flags to be passed with LLD. In LLD we now pass: * `--shared-memory` - required since objects are compiled with atomics. This also means that the generated memory will be marked as `shared`. * `--max-memory=1GB` - required with the `--shared-memory` argument since shared memories in WebAssembly must have a maximum size. The 1GB number is intended to be a conservative estimate for rustc, but it should be overridable with `-C link-arg` if necessary. * `--passive-segments` - this has become the default for multithreaded memory, but when compiling a threaded module all data segments need to be marked as passive to ensure they don't re-initialize memory for each thread. This will also cause LLD to emit a synthetic function to initialize memory which users will have to arrange to call. * The `__heap_base` and `__data_end` globals are explicitly exported since they're now hidden by default due to the `--export` flags we pass to LLD.
2019-07-25rustc: codegen: Build import library for all windows targetsHugo Beauzée-Luyssen-0/+20
So far it is assumed that using a DLL as a -l parameter argument is ok, but the assumption doesn't hold when compiling the native code with llvm. In which case, an import library is required, so let's build one This also requires the cargo counterpart to add the import library in the stamp files, at least when compiling libstd. Otherwise, the files don't get uplifted
2019-07-25std: Use native `#[thread_local]` TLS on wasmAlex Crichton-0/+7
This commit moves `thread_local!` on WebAssembly targets to using the `#[thread_local]` attribute in LLVM. This was recently implemented upstream and is [in the process of being documented][dox]. This change only takes affect if modules are compiled with `+atomics` which is currently unstable and a pretty esoteric method of compiling wasm artifacts. This "new power" of the wasm toolchain means that the old `wasm-bindgen-threads` feature of the standard library can be removed since it should now be possible to create a fully functioning threaded wasm module without intrusively dealing with libstd symbols or intrinsics. Yay! [dox]: https://github.com/WebAssembly/tool-conventions/pull/116