summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back
AgeCommit message (Collapse)AuthorLines
2025-07-31Rollup merge of #144726 - jdonszelmann:move-attr-data-structures, r=lcnrJana Dönszelmann-1/+1
merge rustc_attr_data_structures into rustc_hir this move was discussed on zulip: [#t-compiler > attribute parsing rework @ đź’¬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/attribute.20parsing.20rework/near/528530091) Many PRs in the attribute rework depend on this move.
2025-07-31remove rustc_attr_data_structuresJana Dönszelmann-1/+1
2025-07-31Rollup merge of #136840 - Flakebi:linker-plugin-lto-fat, r=dianqkSamuel Tardieu-1/+3
Fix linker-plugin-lto only doing thin lto When rust provides LLVM bitcode files to lld and the bitcode contains function summaries as used for thin lto, lld defaults to using thin lto. This prevents some optimizations that are only applied for fat lto. We solve this by not creating function summaries when fat lto is enabled. The bitcode for the module is just directly written out. An alternative solution would be to set the `ThinLTO=0` module flag to signal lld to do fat lto. The code in clang that sets this flag is here: https://github.com/llvm/llvm-project/blob/560149b5e3c891c64899e9912e29467a69dc3a4c/clang/lib/CodeGen/BackendUtil.cpp#L1150 The code in LLVM that queries the flag and defaults to thin lto if not set is here: https://github.com/llvm/llvm-project/blob/e258bca9505f35e0a22cb213a305eea9b76d11ea/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp#L4441-L4446 try-job: x86_64-gnu-debug try-job: aarch64-gnu-debug
2025-07-31Fix linker-plugin-lto only doing thin ltoFlakebi-1/+3
When rust provides LLVM bitcode files to lld and the bitcode contains function summaries as used for thin lto, lld defaults to using thin lto. This prevents some optimizations that are only applied for fat lto. We solve this by not creating function summaries when fat lto is enabled. The bitcode for the module is just directly written out. An alternative solution would be to set the `ThinLTO=0` module flag to signal lld to do fat lto. The code in clang that sets this flag is here: https://github.com/llvm/llvm-project/blob/560149b5e3c891c64899e9912e29467a69dc3a4c/clang/lib/CodeGen/BackendUtil.cpp#L1150 The code in LLVM that queries the flag and defaults to thin lto if not set is here: https://github.com/llvm/llvm-project/blob/e258bca9505f35e0a22cb213a305eea9b76d11ea/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp#L4441-L4446
2025-07-28Rename impl_of_method -> impl_of_assocCameron Steffen-1/+1
2025-07-28Auto merge of #144562 - matthiaskrgr:rollup-mlvn7qo, r=matthiaskrgrbors-64/+27
Rollup of 7 pull requests Successful merges: - rust-lang/rust#144072 (update `Atomic*::from_ptr` and `Atomic*::as_ptr` docs) - rust-lang/rust#144151 (`tests/ui/issues/`: The Issues Strike Back [1/N]) - rust-lang/rust#144300 (Clippy fixes for miropt-test-tools) - rust-lang/rust#144399 (Add a ratchet for moving all standard library tests to separate packages) - rust-lang/rust#144472 (str: Mark unstable `round_char_boundary` feature functions as const) - rust-lang/rust#144503 (Various refactors to the codegen coordinator code (part 3)) - rust-lang/rust#144530 (coverage: Infer `instances_used` from `pgo_func_name_var_map`) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-28use let chains in ast, borrowck, codegen, const_evalKivooeo-6/+6
2025-07-26Remove support for -Zcombine-cgubjorn3-36/+6
Nobody seems to actually use this, while still adding some extra complexity to the already rather complex codegen coordinator code. It is also not supported by any backend other than the LLVM backend.
2025-07-25Improve coordinator channel handlingbjorn3-28/+21
Remove usage of Any, reduce visibility of fields and remove unused backend arguments.
2025-07-24Auto merge of #144398 - fmease:rollup-z6vq7mi, r=fmeasebors-28/+106
Rollup of 15 pull requests Successful merges: - rust-lang/rust#143374 (Unquerify extern_mod_stmt_cnum.) - rust-lang/rust#143838 (std: net: uefi: Add support to query connection data) - rust-lang/rust#144014 (don't link to the nightly version of the Edition Guide in stable lints) - rust-lang/rust#144094 (Ensure we codegen the main fn) - rust-lang/rust#144218 (Use serde for target spec json deserialize) - rust-lang/rust#144221 (generate elf symbol version in raw-dylib) - rust-lang/rust#144240 (Add more test case to check if the false note related to sealed trait suppressed) - rust-lang/rust#144247 (coretests/num: use ldexp instead of hard-coding a power of 2) - rust-lang/rust#144276 (Use less HIR in check_private_in_public.) - rust-lang/rust#144278 (add Rev::into_inner) - rust-lang/rust#144317 (pass build.npm from bootstrap to tidy and use it for npm install) - rust-lang/rust#144320 (rustdoc: avoid allocating a temp String for aliases in search index) - rust-lang/rust#144334 (rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansion) - rust-lang/rust#144335 (Don't suggest assoc ty bound on non-angle-bracketed problematic assoc ty binding) - rust-lang/rust#144358 (Stop using the old `validate_attr` logic for stability attributes) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-24Rollup merge of #144221 - usamoi:versym, r=bjorn3LeĂłn Orell Valerian Liehr-28/+106
generate elf symbol version in raw-dylib For link names like `aaa@bbb`, it generates a symbol named `aaa` and a version named `bbb`. For link names like `aaa\0bbb`, `aaa@`@bbb`` or `aa@bb@cc`, it emits errors. It adds a test that the executable is linked with glibc using raw-dylib. cc rust-lang/rust#135694
2025-07-24Auto merge of #144062 - bjorn3:lto_refactors2, r=davidtwcobors-105/+170
Various refactors to the LTO handling code (part 2) Continuing from https://github.com/rust-lang/rust/pull/143388 this removes a bit of dead code and moves the LTO symbol export calculation from individual backends to cg_ssa.
2025-07-24generate elf symbol version in raw-dylibusamoi-28/+106
2025-07-21Remove each_linked_rlib_for_lto from CodegenContextbjorn3-12/+29
2025-07-21Move exported_symbols_for_lto out of CodegenContextbjorn3-8/+21
2025-07-21Merge exported_symbols computation into exported_symbols_for_ltobjorn3-80/+62
And move exported_symbols_for_lto call from backends to cg_ssa.
2025-07-21Move LTO symbol export calculation from backends to cg_ssabjorn3-0/+83
2025-07-21Remove worker idbjorn3-56/+19
It isn't used anywhere. Also inline free_worker into the only call site.
2025-07-21Merge modules and cached_modules for fat LTObjorn3-4/+11
The modules vec can already contain serialized modules and there is no need to distinguish between cached and non-cached cgus at LTO time.
2025-07-18add -Zoffload=Enable flag behind -Zunstable-options, to enable gpu (host) ↵Manuel Drehwald-0/+2
code generation
2025-07-18Rollup merge of #143846 - usamoi:gc, r=bjorn3Matthias KrĂĽger-39/+1
pass --gc-sections if -Zexport-executable-symbols is enabled and improve tests Exported symbols are added as GC roots in linking, so `--gc-sections` won't hurt `-Zexport-executable-symbols`. Fixes the run-make test to work on Linux. Enable the ui test on more targets. cc rust-lang/rust#84161
2025-07-17remove no_gc_sectionsusamoi-35/+0
2025-07-17Rollup merge of #143388 - bjorn3:lto_refactors, r=compiler-errorsLeĂłn Orell Valerian Liehr-137/+97
Various refactors to the LTO handling code In particular reducing the sharing of code paths between fat and thin-LTO and making the fat LTO implementation more self-contained. This also moves some autodiff handling out of cg_ssa into cg_llvm given that Enzyme only works with LLVM anyway and an implementation for another backend may do things entirely differently. This will also make it a bit easier to split LTO handling out of the coordinator thread main loop into a separate loop, which should reduce the complexity of the coordinator thread.
2025-07-13pass --gc-sections if -Zexport-executable-symbols is enabled and improve testsusamoi-6/+3
2025-07-10Rollup merge of #143446 - usamoi:export-executable-symbols, r=bjorn3,oli-obkMatthias KrĂĽger-16/+25
use `--dynamic-list` for exporting executable symbols closes rust-lang/rust#101610 cc rust-lang/rust#84161 https://sourceware.org/binutils/docs-2.39/ld/VERSION.html: > --dynamic-list=dynamic-list-file Specify the name of a dynamic list file to the linker. This is typically used when creating shared libraries to specify a list of global symbols whose references shouldn’t be bound to the definition within the shared library, or creating dynamically linked executables to specify a list of symbols which should be added to the symbol table in the executable. This option is only meaningful on ELF platforms which support shared libraries. `ld.lld --help`: > --dynamic-list=<file>: Similar to --export-dynamic-symbol-list. When creating a shared object, this additionally implies -Bsymbolic but does not set DF_SYMBOLIC > --export-dynamic-symbol-list=file: Read a list of dynamic symbol patterns. Apply --export-dynamic-symbol on each pattern > --export-dynamic-symbol=glob: (executable) Put matched symbols in the dynamic symbol table. (shared object) References to matched non-local STV_DEFAULT symbols shouldn't be bound to definitions within the shared object. Does not imply -Bsymbolic. > --export-dynamic: Put symbols in the dynamic symbol table Use `--dynamic-list` because it's older than `--export-dynamic-symbol-list` (binutils 2.35) try-job: dist-i586-gnu-i586-i686-musl
2025-07-09use `--dynamic-list` for exporting executable symbolsusamoi-16/+25
2025-07-08remove `-znostart-stop-gc` workaroundRémy Rakic-29/+0
Now that `#[used(linker)]` is the default on ELF, we don't need to use the `-znostart-stop-gc` link-arg workaround to match bfd's behavior when using lld.
2025-07-08stabilize `-Clinker-features=-lld` on x64 linuxRémy Rakic-1/+1
This stabilizes a subset of the `-Clinker-features` components on x64 linux: the lld opt-out. The opt-in is not stabilized, as interactions with other stable flags require more internal work, but are not needed for stabilizing using rust-lld by default. Similarly, since we only switch to rust-lld on x64 linux, the opt-out is only stabilized there. Other targets still require `-Zunstable-options` to use it.
2025-07-07compiler: Parse `p-` specs in datalayout string, allow definition of custom ↵Edoardo Marangoni-1/+1
default data address space
2025-07-03Merge run_fat_lto, optimize_fat and autodiff into run_and_optimize_fat_ltobjorn3-11/+1
2025-07-03Remove unused config param from WriteBackendMethods::autodiffbjorn3-2/+1
2025-07-03Remove unnecessary check for fat LTObjorn3-1/+1
2025-07-03Move run_fat_lto call into execute_fat_lto_work_itembjorn3-32/+36
This will allow merging all fat LTO steps together. In addition it reduces the amount of work done on the coordinator thread without jobserver token.
2025-07-03Pass in autodiff items when starting the coordinator threadbjorn3-12/+4
As opposed to sending a message to the coordinator thread.
2025-07-03Split generate_lto_work between fat and thin-LTO casesbjorn3-49/+63
2025-07-03Fat LTO always produces a single object file, so -Zcombine-cgu has no effectbjorn3-1/+3
2025-07-03Move dcx creation into WriteBackendMethods::codegenbjorn3-5/+2
2025-07-03Remove LtoModuleCodegenbjorn3-73/+35
Most uses of it either contain a fat or thin lto module. Only WorkItem::LTO could contain both, but splitting that enum variant doesn't complicate things much.
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-4/+4
2025-07-01Auto merge of #143013 - bjorn3:split_exported_symbols, r=oli-obkbors-9/+27
Split exported_symbols for generic and non-generic symbols This reduces metadata decoder overhead during the monomorphization collector.
2025-06-29Rollup merge of #142641 - bjorn3:proc_macro_symbols_o, r=jieyouxuMatthias KrĂĽger-2/+7
Generate symbols.o for proc-macros too To ensure used statics are functioning correctly for proc-macros too.
2025-06-27Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkovMatthias KrĂĽger-0/+32
Reduce special casing for the panic runtime See the individual commits for more info.
2025-06-27Generate symbols.o for proc-macros toobjorn3-2/+7
To ensure used statics are functioning correctly for proc-macros too.
2025-06-27Update commentsbjorn3-5/+5
2025-06-27Split exported_symbols for generic and non-generic symbolsbjorn3-9/+27
This reduces metadata decoder overhead during the monomorphization collector.
2025-06-24Auto merge of #142979 - matthiaskrgr:rollup-szqah4e, r=matthiaskrgrbors-7/+7
Rollup of 9 pull requests Successful merges: - rust-lang/rust#142645 (Also emit suggestions for usages in the `non_upper_case_globals` lint) - rust-lang/rust#142657 (mbe: Clean up code with non-optional `NonterminalKind`) - rust-lang/rust#142799 (rustc_session: Add a structure for keeping both explicit and default sysroots) - rust-lang/rust#142805 (Emit a single error when importing a path with `_`) - rust-lang/rust#142882 (Lazy init diagnostics-only local_names in borrowck) - rust-lang/rust#142883 (Add impl_trait_in_bindings tests from rust-lang/rust#61773) - rust-lang/rust#142943 (Don't include current rustc version string in feature removed help) - rust-lang/rust#142965 ([RTE-497] Ignore `c-link-to-rust-va-list-fn` test on SGX platform) - rust-lang/rust#142972 (Add a missing mailmap entry) r? `@ghost` `@rustbot` modify labels: rollup
2025-06-24Fix LTO for internalizing rustc_std_internal_symbol symbolsbjorn3-0/+15
2025-06-24Add all rustc_std_internal_symbol to symbols.objorn3-0/+17
rustc_std_internal_symbol is meant to call functions from crates where there is no direct dependency on said crate. As they either have to be added to symbols.o or rustc has to introduce an implicit dependency on them to avoid linker errors. The latter is done for some things like the panic runtime, but adding these symbols to symbols.o allows removing those implicit dependencies.
2025-06-24rustc_session: Add a structure for keeping both explicit and default sysrootsVadim Petrochenkov-7/+7
Also avoid creating and cloning sysroot unnecessarily.
2025-06-23[Arm64EC] Only decorate functions with `#`Daniel Paoliello-33/+108