about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-0/+1
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-25create and use GlobalAlloc::address_spaceErik Desjardins-8/+3
2023-01-22abi: add `AddressSpace` field to `Primitive::Pointer`Erik Desjardins-8/+16
...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string, which will be done in a followup.
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan-8/+8
2023-01-04Simplify some iterator combinatorsMichael Goulet-2/+2
2022-12-20Add missing anonymous lifetimeJeremy Stucki-1/+1
2022-12-20rustc: Remove needless lifetimesJeremy Stucki-3/+3
2022-12-12Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisabors-7/+7
Use struct types during codegen in less places This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-0/+4
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-0/+4
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-05Move linkage type check to HIR analysis and fix semantics issues.Peter Collingbourne-28/+6
This ensures that the error is printed even for unused variables, as well as unifying the handling between the LLVM and GCC backends. This also fixes unusual behavior around exported Rust-defined variables with linkage attributes. With the previous behavior, it appears to be impossible to define such a variable such that it can actually be imported and used by another crate. This is because on the importing side, the variable is required to be a pointer, but on the exporting side, the type checker rejects static variables of pointer type because they do not implement `Sync`. Even if it were possible to import such a type, it appears that code generation on the importing side would add an unexpected additional level of pointer indirection, which would break type safety. This highlighted that the semantics of linkage on Rust-defined variables is different to linkage on foreign items. As such, we now model the difference with two different codegen attributes: linkage for Rust-defined variables, and import_linkage for foreign items. This change gives semantics to the test src/test/ui/linkage-attr/auxiliary/def_illtyped_external.rs which was previously expected to fail to compile. Therefore, convert it into a test that is expected to successfully compile. The update to the GCC backend is speculative and untested.
2022-12-03Destruct landing_pad return value before passing it to cg_ssabjorn3-7/+7
2022-12-03Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiserbors-203/+8
Rewrite LLVM's archive writer in Rust This allows it to be used by other codegen backends. Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
2022-11-27Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillotMatthias Krüger-2/+2
Prefer doc comments over `//`-comments in compiler Doc comments are generally nicer: they show up in the documentation, they are shown in IDEs when you hover other mentions of items, etc. Thus it makes sense to use them instead of `//`-comments.
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-2/+2
2022-11-26Rewrite LLVM's archive writer in Rustbjorn3-203/+8
This allows it to be used by other codegen backends
2022-11-26Remove more redundant `all`sChris Denton-4/+4
2022-11-19Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3Dylan DPC-4/+5
Improve generating Custom entry function This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316. Currently, this moves the entry function name and Call convention to the target spec. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-17Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3bors-5/+4
Merge basic blocks where possible when generating LLVM IR. r? `@ghost`
2022-11-16Rollup merge of #103750 - calebzulawski:master, r=workingjubileeMatthias Krüger-4/+4
Fix some misleading target feature aliases This is the first half of a fix for #100752. It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512. These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions. A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features). This PR allows using the names as defined by LLVM, which matches Intel documentation. A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc. r? ```@workingjubilee``` cc ```@Amanieu```
2022-11-16Use `&mut Bx` more.Nicholas Nethercote-5/+4
For the next commit, `FunctionCx::codegen_*_terminator` need to take a `&mut Bx` instead of consuming a `Bx`. This triggers a cascade of similar changes across multiple functions. The resulting code is more concise and replaces many `&mut bx` expressions with `bx`.
2022-11-15Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obkbors-8/+49
Perform simple scalar replacement of aggregates (SROA) MIR opt This is a re-open of https://github.com/rust-lang/rust/pull/85796 I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR. This pass replaces plain field accesses by simple locals when possible. To be eligible, the replaced locals: - must not be enums or unions; - must not be used whole; - must not have their address taken. The storage and deinit statements are duplicated on each created local. cc `@tmiasko` who reviewed the former version of this PR.
2022-11-15Introduce composite debuginfo.Camille GILLOT-8/+49
2022-11-15Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obkbors-2/+2
interpret: support for per-byte provenance Also factors the provenance map into its own module. The third commit does the same for the init mask. I can move it in a separate PR if you prefer. Fixes https://github.com/rust-lang/miri/issues/2181 r? `@oli-obk`
2022-11-15Use custom entry name in gccAyush Singh-4/+5
This is a continuation of 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 for gcc. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-11-13add is_sized method on Abi and Layout, and use itRalf Jung-1/+1
2022-11-12Allow actual AVX512-related feature names in the case of some misleading aliasesCaleb Zulawski-4/+4
2022-11-06fix cranelift and gccRalf Jung-2/+2
2022-11-06Add type_array to BaseTypeMethodsAyush Singh-21/+21
Moved type_array function to rustc_codegen_ssa::BaseTypeMethods trait. This allows using normal alloca function to create arrays as suggested in https://github.com/rust-lang/rust/pull/104022. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-11/+4
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-24Support raw-dylib functions being used inside inlined functionsDaniel Paoliello-0/+1
2022-10-23Migrate all diagnosticsNilstrieb-23/+23
2022-10-17Stabilize asm_symAmanieu d'Antras-3/+6
2022-10-02Remove type argument of array_alloca and rename to byte_array_allocabjorn3-1/+1
2022-10-02Remove dynamic_alloca from BuilderMethodsbjorn3-4/+0
2022-10-01Merge apply_attrs_callsite into call and invokebjorn3-13/+32
Some codegen backends are not able to apply callsite attrs after the fact.
2022-10-01Remove unused target_cpu and tune_cpu methods from ExtraBackendMethodsbjorn3-9/+0
2022-10-01Remove several unused methods from MiscMethodsbjorn3-16/+0
2022-10-01Remove unused Context assoc type from WriteBackendMethodsbjorn3-1/+0
2022-09-30Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwcoMatthias Krüger-163/+322
Migrate rustc_codegen_gcc to SessionDiagnostics As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate. ``@rustbot`` label +A-translation
2022-09-28print <signal> when ranlib failed without an exit codeEllis Hoag-1/+1
2022-09-27Stabilize bench_black_boxUrgau-1/+1
2022-09-26lint and remove unused diagnosticEllis Hoag-6/+4
2022-09-24remove commentEllis Hoag-1/+0
2022-09-24fix lifetime errorEllis Hoag-29/+3
2022-09-24rebase and update trait namesEllis Hoag-25/+25
2022-09-24impl SessionDiagnostic for LayoutError and Spanned<T>Ellis Hoag-1/+18
2022-09-24Add monomorphization errorsEllis Hoag-153/+261
2022-09-24lint typeEllis Hoag-1/+1
2022-09-24Add wrapper type for ExitCode for use in RanlibFailureEllis Hoag-2/+24