about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
AgeCommit message (Collapse)AuthorLines
2022-08-28Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcmbors-0/+12
Add pointer masking convenience functions This PR adds the following public API: ```rust impl<T: ?Sized> *const T { fn mask(self, mask: usize) -> *const T; } impl<T: ?Sized> *mut T { fn mask(self, mask: usize) -> *const T; } // mod intrinsics fn mask<T>(ptr: *const T, mask: usize) -> *const T ``` This is equivalent to `ptr.map_addr(|a| a & mask)` but also uses a cool llvm intrinsic. Proposed in https://github.com/rust-lang/rust/pull/95643#issuecomment-1121562352 cc `@Gankra` `@scottmcm` `@RalfJung` r? rust-lang/libs-api
2022-08-27interpret: rename relocation → provenanceRalf Jung-6/+6
2022-08-27Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3bors-31/+16
Shrink `FnAbi` Because they can take up a lot of memory in debug and release builds. r? `@bjorn3`
2022-08-26Move `ArgAbi::pad_i32` into `PassMode::Cast`.Nicholas Nethercote-11/+12
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
2022-08-26Turn `ArgAbi::pad` into a `bool`.Nicholas Nethercote-2/+2
Because it's only ever set to `None` or `Some(Reg::i32())`.
2022-08-26Rollup merge of #100604 - dtolnay:okorerr, r=m-ou-seYuki Okushi-1/+0
Remove unstable Result::into_ok_or_err Pending FCP: https://github.com/rust-lang/rust/issues/82223#issuecomment-1214920203 ```@rustbot``` label +waiting-on-fcp
2022-08-26Simplify arg capacity calculations.Nicholas Nethercote-19/+3
Currently they try to be very precise. But they are wrong, i.e. they don't match what's happening in the loop below. This code isn't hot enough for it to matter that much.
2022-08-26Change `FnAbi::args` to a boxed slice.Nicholas Nethercote-1/+1
2022-08-26Box `CastTarget` within `PassMode`.Nicholas Nethercote-5/+5
Because `PassMode::Cast` is by far the largest variant, but is relatively rare. This requires making `PassMode` not impl `Copy`, and `Clone` is no longer necessary. This causes lots of sigil adjusting, but nothing very notable.
2022-08-21Fix `ptr_mask` impl in cg gccMaybe Waffle-1/+11
2022-08-21Implement `ptr_mask` intrinsic in cg gccMaybe Waffle-0/+2
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-1/+1
2022-08-17Remove unstable Result::into_ok_or_errDavid Tolnay-1/+0
2022-08-16Move the cast_float_to_int fallback code to GCCJosh Stone-5/+170
Now that we require at least LLVM 13, that codegen backend is always using its intrinsic `fptosi.sat` and `fptoui.sat` conversions, so it doesn't need the manual implementation. However, the GCC backend still needs it, so we can move all of that code down there.
2022-07-28Introduce an ArchiveBuilderBuilderbjorn3-27/+34
This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend.
2022-07-28Inline inject_dll_import_libbjorn3-4/+0
2022-07-28Move output argument from ArchiveBuilder::new to .build()bjorn3-11/+7
2022-07-26Auto merge of #98989 - dpaoliello:rawdylibbin, r=michaelwoeristerbors-2/+10
Enable raw-dylib for bin crates Fixes #93842 When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line. I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
2022-07-24Auto merge of #95548 - rcvalle:rust-cfi-2, r=nagisabors-11/+12
Add fine-grained LLVM CFI support to the Rust compiler This PR improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. 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 https://github.com/rust-lang/rust/issues/89653). LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto). Thank you again, `@eddyb,` `@nagisa,` `@pcc,` and `@tmiasko` for all the help!
2022-07-23Add fine-grained LLVM CFI support to the Rust compilerRamon de C Valle-11/+12
This commit improves the LLVM Control Flow Integrity (CFI) support in the Rust compiler by providing forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. 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 CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).
2022-07-22Enable raw-dylib for binariesDaniel Paoliello-2/+10
2022-07-22Auto merge of #99420 - RalfJung:vtable, r=oli-obkbors-0/+5
make vtable pointers entirely opaque This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers. - We have a new kind of `GlobalAlloc` that symbolically refers to a vtable. - Miri uses that kind of allocation when generating a vtable. - The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable. - We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now. I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense... r? `@oli-obk`
2022-07-20slightly cleaner, if more verbose, vtable handling in codegen backendsRalf Jung-8/+5
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-2/+2
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-0/+8
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-2/+2
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-2/+2
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwcoDylan DPC-4/+4
Keep unstable target features for asm feature checking Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-11Keep unstable target features for asm feature checkingAmanieu d'Antras-4/+4
Inline assembly uses the target features to determine which registers are available on the current target. However it needs to be able to access unstable target features for this. Fixes #99071
2022-07-09fix cranelift and gcc backendsRalf Jung-5/+4
2022-07-08Auto merge of #98638 - bjorn3:less_string_interning, r=tmiaskobors-10/+19
Use less string interning This removes string interning in a couple of places where doing so won't result in perf improvements. I also switched one place to use pre-interned symbols.
2022-07-06Update TypeVisitor pathsAlan Egerton-3/+3
2022-06-28Avoid unnecessary string interning for const_strbjorn3-10/+19
2022-06-21Auto merge of #98098 - bjorn3:archive_refactor, r=michaelwoeristerbors-39/+8
Remove the source archive functionality of ArchiveWriter We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts. This is simpler and makes it easier to swap out the archive writer in https://github.com/rust-lang/rust/pull/97485.
2022-06-19Remove the source archive functionality of ArchiveWriterbjorn3-25/+3
We now build archives through strictly additive means rather than taking an existing archive and potentially substracting parts.
2022-06-19Fix "Remove src_files and remove_file"bjorn3-1/+5
2022-06-17Rollup merge of #97675 - nvzqz:unsized-needs-drop, r=dtolnayYuki Okushi-1/+8
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as https://github.com/rust-lang/rust/pull/97676.
2022-06-14Remove src_files and remove_filebjorn3-13/+0
They only apply to the main source archive and their role can be fulfilled through the skip argument of add_archive too.
2022-06-14Add llvm.type.checked.load intrinsicflip1995-0/+10
Add the intrinsic declare {i8*, i1} @llvm.type.checked.load(i8* %ptr, i32 %offset, metadata %type) This is used in the VFE optimization when lowering loading functions from vtables to LLVM IR. The `metadata` is used to map the function to all vtables this function could belong to. This ensures that functions from vtables that might be used somewhere won't get removed.
2022-06-07Remove unused macro ruleAntoni Boucher-3/+0
2022-06-06Merge commit 'e8dca3e87d164d2806098c462c6ce41301341f68' into sync_from_cg_gccAntoni Boucher-618/+7959
2022-06-03Fix unsized field orderNikolai Vazquez-1/+1
2022-06-03Make `std::mem::needs_drop` accept `?Sized`Nikolai Vazquez-1/+8
2022-05-27Finish bumping stage0Mark Rousskov-0/+1
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-05-25rustc_codegen_ssa: derive copy and clone for various enumsTomasz Miąsko-19/+2
2022-05-25rustc_codegen_ssa: cleanup `AtomicOrdering`Tomasz Miąsko-4/+2
* Remove unused `NotAtomic` ordering. * Rename `Monotonic` to `Relaxed` - a Rust specific name.
2022-05-17Handle tmm_reg in rustc_codegen_gccConnor Horman-2/+3
2022-04-30Merge new_metadata into codegen_allocatorbjorn3-7/+5
2022-04-30Remove config parameter of optimize_fat and avoid interior mutability for modulebjorn3-1/+1
2022-04-30Let LtoModuleCodegen::optimize take self by valuebjorn3-2/+2