summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2024-10-08Only add an automatic SONAME for Rust dylibsJosh Stone-15/+70
(cherry picked from commit f46057bf1cc0dc24a0ecd7d87c9c93872e685253)
2024-08-31Rollup merge of #129366 - petrochenkov:libsearch, r=jieyouxuMatthias Krüger-50/+25
linker: Synchronize native library search in rustc and linker Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs. This unblocks https://github.com/rust-lang/rust/pull/123436. try-job: x86_64-msvc
2024-08-29Rollup merge of #128970 - DianQK:lint-llvm-ir, r=nikicGuillaume Gomez-0/+2
Add `-Zlint-llvm-ir` This flag is similar to `-Zverify-llvm-ir` and allows us to lint the generated IR. r? compiler
2024-08-29Add `-Zlint-llvm-ir`DianQK-0/+2
2024-08-27linker: Better support alternative static library naming on MSVCVadim Petrochenkov-4/+10
Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
2024-08-27linker: Synchronize native library search in rustc and linkerVadim Petrochenkov-46/+15
2024-08-27Rollup merge of #129418 - petrochenkov:libsearch2, r=jieyouxuTrevor Gross-16/+11
rustc: Simplify getting sysroot library directory It was very non-obvious that `sess.target_tlib_path`, `make_target_lib_path(...)`, and `sess.target_filesearch(...).search_paths()` result in the same sysroot library directory paths. They are however, indeed the same, because `sess.target_tlib_path` is initialized to `make_target_lib_path(...)` on `Session` creation, and they are used interchangeably. There are still some redundant calls to `make_target_lib_path` and other inconsistent ways to obtain sysroot directories, but fixing that requires some behavior changes, while this PR is a pure refactoring. Some places in the compiler even disagree on the number of sysroots - 1 (explicit `--sysroot` *or* default sysroot), 2 (explicit `--sysroot` *and* default sysroot), or an unclear number of `sysroot_candidates` every of which is considered. The logic currently using `sess.target_tlib_path` or equivalents assumes one sysroot.
2024-08-27Rollup merge of #126013 - nnethercote:unreachable_pub, r=UrgauMatthias Krüger-3/+3
Add `#[warn(unreachable_pub)]` to a bunch of compiler crates By default `unreachable_pub` identifies things that need not be `pub` and tells you to make them `pub(crate)`. But sometimes those things don't need any kind of visibility. So they way I did these was to remove the visibility entirely for each thing the lint identifies, and then add `pub(crate)` back in everywhere the compiler said it was necessary. (Or occasionally `pub(super)` when context suggested that was appropriate.) Tedious, but results in more `pub` removal. There are plenty more crates to do but this seems like enough for a first PR. r? `@compiler-errors`
2024-08-24Fix `elided_named_lifetimes` in codePavel Grigorenko-1/+1
2024-08-22rustc: Simplify getting sysroot library directoryVadim Petrochenkov-16/+11
2024-08-22Auto merge of #129257 - ChrisDenton:rename-null-descriptor, r=jieyouxubors-1/+5
Allow rust staticlib to work with MSVC's /WHOLEARCHIVE This fixes #129020 by renaming the `__NULL_IMPORT_DESCRIPTOR` to prevent conflicts. try-job: dist-i686-msvc
2024-08-21Simplify some redundant field namesMichael Goulet-2/+2
2024-08-20Make import libraries compatible with wholearchiveChris Denton-1/+5
2024-08-17Always use ar_archive_writer for import libsChris Denton-3/+83
2024-08-16Add `warn(unreachable_pub)` to `rustc_codegen_ssa`.Nicholas Nethercote-3/+3
2024-08-15Auto merge of #128936 - bjorn3:fix_thin_archive_reading, r=jieyouxubors-4/+9
Support reading thin archives in ArArchiveBuilder And switch to using ArArchiveBuilder with the LLVM backend too now that all regressions are fixed. Fixes https://github.com/rust-lang/rust/issues/107407 Fixes https://github.com/rust-lang/rust/issues/107162 https://github.com/rust-lang/rust/issues/107495 has been fixed in a previous PR already.
2024-08-12Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxuGuillaume Gomez-1/+2
Use `assert_matches` around the compiler more It's a useful assertion, especially since it actually prints out the LHS.
2024-08-11Use assert_matches around the compilerMichael Goulet-1/+2
2024-08-11Fix review comments and other improvementsbjorn3-4/+2
2024-08-10Auto merge of #128400 - petrochenkov:nowhole3, r=bjorn3bors-10/+1
linker: Remove the "`--whole-archive` in test mode" backcompat hack Fixes https://github.com/rust-lang/rust/issues/116910.
2024-08-10Support reading thin archives in ArArchiveBuilderbjorn3-4/+11
2024-08-07Rollup merge of #128772 - glaubitz:sparc-elf-fix, r=nagisaMatthias Krüger-0/+1
rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARC The `object` crate was recently updated to recognize the 32-bit SPARC ELF targets `EM_SPARC` and `EM_SPARC32PLUS`, so the proper architecture for 32-bit SPARC can now be set in `rustc_codegen_ssa`. r? nagisa
2024-08-07Rollup merge of #128206 - bjorn3:import_lib_writing_refactor, r=jieyouxuGuillaume Gomez-37/+196
Make create_dll_import_lib easier to implement This will make it easier to implement raw-dylib support in cg_clif and cg_gcc. This PR doesn't yet include an create_dll_import_lib implementation for cg_clif as I need to correctly implement dllimport in cg_clif first before raw-dylib can work at all with cg_clif. Required for https://github.com/rust-lang/rustc_codegen_cranelift/issues/1345
2024-08-07rustc_codegen_ssa: Set architecture for object crate for 32-bit SPARCJohn Paul Adrian Glaubitz-0/+1
The object crate was recently updated to recognize the 32-bit SPARC ELF targets EM_SPARC and EM_SPARC32PLUS, so the proper architecture for 32-bit SPARC can now be set in rustc_codegen_ssa.
2024-08-03Fix linking to sanitizers on Apple targetsVadim Petrochenkov-3/+7
2024-08-03linker: Pass fewer search directories to the linkerVadim Petrochenkov-38/+56
2024-08-01Rollup merge of #128450 - dpaoliello:coff, r=bjorn3Matthias Krüger-5/+1
Create COFF archives for non-LLVM backends `ar_archive_writer` now supports creating COFF archives, so enable them for the non-LLVM backends when requested. r? ``@bjorn3``
2024-07-31Create COFF archives for non-LLVM backendsDaniel Paoliello-5/+1
2024-07-31Rollup merge of #127830 - tgross35:archive-failure-message, r=BoxyUwUMatthias Krüger-2/+5
When an archive fails to build, print the path Currently the output on failure is as follows: Compiling block-buffer v0.10.4 Compiling crypto-common v0.1.6 Compiling digest v0.10.7 Compiling sha2 v0.10.8 Compiling xz2 v0.1.7 error: failed to build archive: No such file or directory error: could not compile `bootstrap` (lib) due to 1 previous error Change this to print which file is being constructed, to give some hint about what is going on. error: failed to build archive at `path/to/output`: No such file or directory
2024-07-30linker: Remove the "`--whole-archive` in test mode" backcompat hackVadim Petrochenkov-10/+1
2024-07-30Move mingw dlltool invocation to cg_ssabjorn3-0/+127
2024-07-30Move computation of decorated names out of the create_dll_import_lib methodbjorn3-4/+20
2024-07-30Move temp file name generation out of the create_dll_import_lib methodbjorn3-6/+9
2024-07-30Introduce create_dll_import_libs functionbjorn3-31/+44
2024-07-29Reformat `use` declarations.Nicholas Nethercote-81/+71
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28Rollup merge of #127860 - klensy:dedup, r=Mark-SimulacrumGuillaume Gomez-15/+17
deps: dedup object, wasmparser, wasm-encoder * dedups one `object`, additional dupe will be removed, with next `thorin-dwp` update * `wasmparser` pinned to minor versions, so full merge isn't possible * same with `wasm-encoder` Turned off some features for `wasmparser` (see features https://github.com/bytecodealliance/wasm-tools/blob/v1.208.1/crates/wasmparser/Cargo.toml) in `run-make-support`, looks working?
2024-07-28adopt object changesklensy-15/+17
adopt wasm_encoder changes
2024-07-25Auto merge of #127995 - workingjubilee:say-turings-prayer, r=BoxyUwUbors-4/+4
compiler: Never debug_assert in codegen In the name of Turing and his Hoarey heralds, assert our truths before creating a monster! The `rustc_codegen_llvm` and `rustc_codegen_ssa` crates are fairly critical for rustc's correctness. Small mistakes here can easily result in undefined behavior, since a "small mistake" can mean something like "link and execute the wrong code". We should probably run any and all asserts in these modules unconditionally on whether this is a "debug build", and damn the costs in performance. ...Especially because the costs in performance seem to be *nothing*. It is not clear how much correctness we gain here, but I'll take free correctness improvements.
2024-07-20compiler: Never debug_assert in codegenJubilee Young-4/+4
The gains in performance are not worth the costs in correctness. This is partly because the gains are zero and the costs are unknown.
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-6/+6
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
2024-07-16Rollup merge of #127512 - eggyal:newline-terminate-print-linkargs, ↵Trevor Gross-1/+1
r=compiler-errors Terminate `--print link-args` output with newline Fixes #127507
2024-07-16Rollup merge of #124033 - bjorn3:ar_archive_writer_0_3_0, r=davidtwcoTrevor Gross-13/+12
Sync ar_archive_writer to LLVM 18.1.3 From LLVM 15.0.0-rc3. This adds support for COFF archives containing Arm64EC object files and has various fixes for AIX big archive files.
2024-07-16When an archive fails to build, print the pathTrevor Gross-2/+5
Currently the output on failure is as follows: Compiling block-buffer v0.10.4 Compiling crypto-common v0.1.6 Compiling digest v0.10.7 Compiling sha2 v0.10.8 Compiling xz2 v0.1.7 error: failed to build archive: No such file or directory error: could not compile `bootstrap` (lib) due to 1 previous error Print which file is being constructed to give some hint about what is going on.
2024-07-16Fix unsafe_op_in_unsafe_fn in compilerMichael Goulet-1/+1
2024-07-09Terminate `--print link-args` output with newlineAlan Egerton-1/+1
2024-07-07Fix review commentsbjorn3-1/+1
2024-07-07Sync ar_archive_writer to LLVM 18.1.3bjorn3-13/+12
From LLVM 15.0.0-rc3. This adds support for COFF archives containing Arm64EC object files and has various fixes for AIX big archive files.
2024-07-07use "bootstrap" instead of "rustbuild" in comments and docsonur-ozkan-1/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-02linker: Link dylib crates by pathVadim Petrochenkov-85/+94
2024-07-01linker: Bail out of rpath logic early if the target doesn't support rpathVadim Petrochenkov-10/+4