Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 5 pull requests #112888

Closed
wants to merge 184 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
9de1d7c
document memory orderings of `thread::{park, unpark}`
ibraheemdev Jul 22, 2022
0646f0d
Move the cast_float_to_int fallback code to GCC
cuviper Aug 16, 2022
34d33f2
Implement `ptr_mask` intrinsic in cg gcc
WaffleLapkin May 11, 2022
1acc3b4
Fix `ptr_mask` impl in cg gcc
WaffleLapkin May 13, 2022
93191f6
Box `CastTarget` within `PassMode`.
nnethercote Aug 25, 2022
f78592f
Change `FnAbi::args` to a boxed slice.
nnethercote Aug 25, 2022
5a69929
Simplify arg capacity calculations.
nnethercote Aug 26, 2022
d83636d
Turn `ArgAbi::pad` into a `bool`.
nnethercote Aug 25, 2022
8900341
Move `ArgAbi::pad_i32` into `PassMode::Cast`.
nnethercote Aug 25, 2022
1a61b6e
Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3
bors Aug 27, 2022
c32ad5c
interpret: rename relocation → provenance
RalfJung Aug 27, 2022
7006047
Auto merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
bors Aug 28, 2022
f2d73af
Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obk
Dylan-DPC Aug 30, 2022
ecb8613
Rollup merge of #100653 - cuviper:fptoint_sat, r=michaelwoerister,antoyo
Dylan-DPC Aug 30, 2022
c3dce60
Remove dead broken code from const zst handling in backends
oli-obk Sep 6, 2022
23eae52
Add RanlibFailure
ellishg Aug 27, 2022
7277046
Add LinkageConstOrMutType
ellishg Aug 27, 2022
7fc07ca
Add UnwindingInlineAsm
ellishg Aug 27, 2022
33b58eb
Add LTONotSupported
ellishg Aug 27, 2022
534ce39
Add LayoutSizeOverflow
ellishg Aug 27, 2022
1f3ae14
Lint against untranslatable diagnostics in rustc_codegen_gcc
ellishg Aug 27, 2022
ff9bf7b
remove IntoDiagnosticArg impl for Option
ellishg Aug 30, 2022
d3bb849
Add wrapper type for ExitCode for use in RanlibFailure
ellishg Sep 1, 2022
70ab054
lint type
ellishg Sep 1, 2022
059326c
Add monomorphization errors
ellishg Sep 11, 2022
5c839d9
impl SessionDiagnostic for LayoutError and Spanned<T>
ellishg Sep 12, 2022
43b3206
rebase and update trait names
ellishg Sep 24, 2022
0ae1e27
fix lifetime error
ellishg Sep 24, 2022
d1741f6
remove comment
ellishg Sep 24, 2022
277b997
lint and remove unused diagnostic
ellishg Sep 27, 2022
4d39883
Stabilize bench_black_box
Urgau Sep 24, 2022
5ae3bf2
print <signal> when ranlib failed without an exit code
ellishg Sep 29, 2022
869203c
Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=da…
matthiaskrgr Sep 30, 2022
2db7a87
Remove unused Context assoc type from WriteBackendMethods
bjorn3 Oct 1, 2022
29edc88
Remove several unused methods from MiscMethods
bjorn3 Oct 1, 2022
69a065e
Remove unused target_cpu and tune_cpu methods from ExtraBackendMethods
bjorn3 Oct 1, 2022
3f43ee2
Merge apply_attrs_callsite into call and invoke
bjorn3 Oct 1, 2022
af0b18b
Remove dynamic_alloca from BuilderMethods
bjorn3 Oct 1, 2022
413edf6
Remove type argument of array_alloca and rename to byte_array_alloca
bjorn3 Oct 1, 2022
1bae661
tidy
ibraheemdev Oct 5, 2022
f0e4083
Auto merge of #2583 - RalfJung:rustup, r=oli-obk
bors Oct 8, 2022
14e0e0f
Stabilize asm_sym
Amanieu Oct 17, 2022
1e9d9b1
merge rustc history
RalfJung Oct 21, 2022
d3b02e3
Migrate all diagnostics
Noratrieb Oct 22, 2022
e30385b
Support raw-dylib functions being used inside inlined functions
dpaoliello Oct 12, 2022
a1d984c
Auto merge of #103392 - RalfJung:miri, r=oli-obk
bors Oct 25, 2022
5a1c8e8
Rewrite implementation of `#[alloc_error_handler]`
Amanieu Oct 14, 2022
87237cb
Add type_array to BaseTypeMethods
Ayush1325 Nov 6, 2022
e876f43
fix cranelift and gcc
RalfJung Nov 6, 2022
2596ab4
Allow actual AVX512-related feature names in the case of some mislead…
calebzulawski Oct 30, 2022
358419c
add is_sized method on Abi and Layout, and use it
RalfJung Nov 13, 2022
695c76c
Use custom entry name in gcc
Ayush1325 Nov 15, 2022
eb0bc47
Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk
bors Nov 15, 2022
af8682b
Introduce composite debuginfo.
cjgillot Oct 1, 2022
d2d2b28
Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obk
bors Nov 15, 2022
d01b63a
Use `&mut Bx` more.
nnethercote Nov 9, 2022
5d862b8
Rollup merge of #103750 - calebzulawski:master, r=workingjubilee
matthiaskrgr Nov 16, 2022
ee50714
Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3
bors Nov 17, 2022
20ff362
Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3
Dylan-DPC Nov 19, 2022
3951167
Remove more redundant `all`s
ChrisDenton Nov 26, 2022
690085c
Rewrite LLVM's archive writer in Rust
bjorn3 May 28, 2022
38dfdee
Prefer doc comments over `//`-comments in compiler
WaffleLapkin Nov 27, 2022
f9805a2
Rollup merge of #104976 - WaffleLapkin:move_comments, r=cjgillot
matthiaskrgr Nov 27, 2022
12224e8
Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiser
bors Dec 3, 2022
213ced1
Destruct landing_pad return value before passing it to cg_ssa
bjorn3 Dec 3, 2022
6181cb2
Move linkage type check to HIR analysis and fix semantics issues.
pcc Nov 24, 2022
d5f7c20
Add LLVM KCFI support to the Rust compiler
rcvalle Nov 22, 2022
79f7b7b
Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3
matthiaskrgr Dec 10, 2022
ac4e9ca
Add `round_ties_even` to `f32` and `f64`
Jules-Bertholet Mar 25, 2022
6ec5ebd
Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
bors Dec 12, 2022
b4e9ba5
rustc: Remove needless lifetimes
jeremystucki Dec 20, 2022
2d09c9b
Add missing anonymous lifetime
jeremystucki Dec 20, 2022
6e8a013
improve wording of `thread::park` docs
ibraheemdev Jan 1, 2023
26c010c
Simplify some iterator combinators
compiler-errors Dec 10, 2022
2671f37
Change `src/test` to `tests` in source files, fix tidy and tests
albertlarsan68 Jan 5, 2023
559b57e
abi: add `AddressSpace` field to `Primitive::Pointer`
erikdesjardins Jan 23, 2023
01241f8
create and use GlobalAlloc::address_space
erikdesjardins Jan 25, 2023
9c6f7cb
session: diagnostic migration lint on more fns
davidtwco Aug 19, 2022
4238ce2
s/eval_usize/eval_target_usize/ for clarity
oli-obk Feb 14, 2023
3e14bba
errors: generate typed identifiers in each crate
davidtwco Oct 13, 2022
984945a
various: translation resources from cg backend
davidtwco Oct 17, 2022
aefda57
Remove type-traversal trait aliases
eggyal Feb 22, 2023
bfa228b
Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obk
bors Feb 22, 2023
5b0dbc4
Rename many interner functions.
nnethercote Feb 17, 2023
ea83d6f
Use `List::empty()` instead of `mk_substs(&[])`.
nnethercote Feb 20, 2023
d725cfb
Merge commit '08a6d6e16b5efe217123e780398969946266268f' into sync-cg_…
antoyo Mar 5, 2023
9453873
Update gccjit
antoyo Mar 5, 2023
cf9c2f8
Fix for diagnostics
antoyo Mar 5, 2023
7b85215
Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, r=pnkfelix…
bors Mar 7, 2023
cbbaebc
Rollup merge of #108783 - antoyo:sync-cg_gcc-2023-03-04, r=cjgillot
matthiaskrgr Mar 7, 2023
8652bbb
replace legacy copyright annotations in submodules
pietroalbini Nov 17, 2022
fe93911
Simplify message paths
est31 Mar 2, 2023
ee38de5
Remove uses of `box_syntax` in rustc and tools
clubby789 Feb 27, 2023
0c115bf
Use poison instead of undef
nikic Mar 16, 2023
77a9eff
Optimize bitreverse codegen
arpankapoor Mar 24, 2023
6e1a79c
Add u128 PartialEq impl in mini_core.rs
arpankapoor Mar 26, 2023
68b8500
move u128 test to std_example
arpankapoor Mar 27, 2023
ade3739
Merge pull request #257 from arpankapoor/master
antoyo Mar 28, 2023
2bfd89d
Update gccjit and remove libc 0.1 dependency
uweigand Mar 30, 2023
7e2e505
Update gccjit dependency version
GuillaumeGomez Apr 5, 2023
5af59b6
Merge pull request #261 from GuillaumeGomez/update-gcc-jit
antoyo Apr 6, 2023
b769ad2
Add `llvm` folder to .gitignore file
GuillaumeGomez Apr 5, 2023
98482ad
Regen intrinsics
GuillaumeGomez Apr 5, 2023
24ea06b
Merge pull request #259 from GuillaumeGomez/regen-intrinsics
antoyo Apr 6, 2023
ba60936
Merge pull request #260 from GuillaumeGomez/ignore-llvm
antoyo Apr 6, 2023
65a20d3
Fix vpshrd llvm instrinsics
antoyo Apr 6, 2023
76c10cc
Merge pull request #262 from rust-lang/fix/vpshrdvw
antoyo Apr 7, 2023
556ab26
Define MIN_ALIGN for loongarch64
zhaixiaojuan Mar 28, 2023
a6d7ab5
Run emulated stdarch tests in the CI
antoyo Apr 8, 2023
17cbb61
Merge pull request #266 from rust-lang/test/stdarch-emulator
antoyo Apr 10, 2023
e9868ef
clarify wording around spurious wakeups from `thread::park`
ibraheemdev Apr 11, 2023
8541fce
Rollup merge of #96971 - zhaixiaojuan:master, r=wesleywiser
compiler-errors Apr 12, 2023
387718f
Add inline assembly support for m68k
ids1024 Apr 6, 2023
6883c25
Auto merge of #109989 - ids1024:m68k-asm, r=Amanieu
bors Apr 13, 2023
5f30b63
Remove #[alloc_error_handler] from the compiler and library
Amanieu Mar 22, 2023
b93041a
Add support for inline attribute
antoyo Apr 16, 2023
0cbf2b9
Merge pull request #267 from rust-lang/inline-attribute
antoyo Apr 16, 2023
f40e4da
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`
Noratrieb Apr 16, 2023
7dc2487
Merge from rustc
RalfJung Apr 22, 2023
321337b
Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwco
bors Apr 22, 2023
fab5943
Merge from rustc
RalfJung Apr 24, 2023
94735c7
Revert "Remove #[alloc_error_handler] from the compiler and library"
matthiaskrgr Apr 24, 2023
7ec90e3
Add loongarch64 asm! support
zhaixiaojuan Aug 19, 2022
403ebdc
Auto merge of #101069 - zhaixiaojuan:loongarch64-inline-asm, r=Amanieu
bors Apr 25, 2023
9c69c0d
Merge from rustc
RalfJung Apr 26, 2023
43f2b16
rename `needs_infer` to `has_infer`
BoxyUwU Apr 27, 2023
f822f8f
Merge from rustc
RalfJung Apr 28, 2023
7a48ba9
Merge from rustc
RalfJung Apr 30, 2023
0d183f8
Add cross-language LLVM CFI support to the Rust compiler
rcvalle Dec 13, 2022
6933be5
Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3
Manishearth May 3, 2023
77375ab
Use `landingpad filter` to encode aborting landing pad
nbdd0121 Nov 6, 2022
59177fc
Add todo for filter landing pad
nbdd0121 Apr 8, 2023
35836b3
Don't use an allocator shim for `#[global_allocator]`
bjorn3 Jul 3, 2021
c50427b
Split AllocatorKind::fn_name in global_fn_name and default_fn_name
bjorn3 Jul 3, 2021
2be697f
Use global_fn_name instead of format!
bjorn3 Jul 6, 2021
da466a2
Prevent insta-stable no alloc shim support
bjorn3 Sep 10, 2022
e5b5842
Move expansion of query macros in rustc_middle to rustc_middle::query
Zoxc May 15, 2023
a512e98
Set visibility of global
antoyo May 25, 2023
a3c1f42
Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix
bors May 25, 2023
4d8c6d3
Merge pull request #277 from rust-lang/feature/global-visibility
antoyo May 25, 2023
d9d12d7
Ensure Fluent messages are in alphabetical order
clubby789 May 23, 2023
80efecf
Stop creating intermediate places just to immediate convert them to o…
oli-obk May 19, 2023
afe5787
Auto merge of #111768 - oli-obk:pair_const_llvm, r=cjgillot
bors May 30, 2023
3d0a0dc
Add a distinct `OperandValue::ZeroSized` variant for ZSTs
scottmcm May 7, 2023
f16ca93
Use translatable diagnostics in `rustc_const_eval`
fee1-dead May 17, 2023
2c6b979
Regen intrinsics with latest LLVM version
GuillaumeGomez Jun 2, 2023
8430ec5
Updated cranelift codegen to reflect modified trait signature
ndrewxie Apr 7, 2023
ffb092d
Merge pull request #279 from GuillaumeGomez/regen-intrinsics
antoyo Jun 9, 2023
8c2b14f
Update to nightly-2023-06-11
antoyo Jun 11, 2023
c8376e4
Add usage of git subtree to readme
antoyo Jun 3, 2023
94e5c27
Update libgccjit and mini_core
antoyo Jun 3, 2023
3d4c59e
Merge branch 'master' into sync_from_rust_2023_06_11
antoyo Jun 11, 2023
4115e09
Fix for opaque pointers
antoyo Jun 4, 2023
e74bc51
Attempt to fix the tests
antoyo Jun 4, 2023
6f858a2
Add missing cast to fix another issue caused by opaque pointers
antoyo Jun 9, 2023
984b9c5
Improve sync instructions
antoyo Jun 9, 2023
e9708eb
Add note
antoyo Jun 10, 2023
a0edbfb
Test to fix UI tests
antoyo Jun 11, 2023
90527b8
Some fixes and cleanups
antoyo Jun 11, 2023
3371fce
Fix tests
antoyo Jun 11, 2023
ef037e6
Fix tests
antoyo Jun 11, 2023
8bba646
Cleanup
antoyo Jun 12, 2023
9483008
Tests for the CI
antoyo Jun 13, 2023
218575a
Working, but requires a patched rustc
antoyo Jun 16, 2023
45bca00
Handle alignment of the load instruction
antoyo Jun 16, 2023
8560b07
TO REVERT: temporarily add a patch for rustc
antoyo Jun 16, 2023
3d7ec59
Fix for check_ptr_call for variadic functions
antoyo Jun 17, 2023
607cbfd
Cleanup and update to rustc 2023-06-19
antoyo Jun 18, 2023
37413a2
Fix indent
antoyo Jun 18, 2023
1bbee3e
Merge pull request #282 from rust-lang/sync_from_rust_2023_06_11
antoyo Jun 19, 2023
4d96893
Merge commit '1bbee3e217d75e7bc3bfe5d8c1b35e776fce96e6' into sync-cg_…
antoyo Jun 19, 2023
f78096f
Update Cargo.lock
antoyo Jun 20, 2023
bc20a8e
Add `Item::def_id` helper
GuillaumeGomez Jun 19, 2023
db95734
Fix invalid creation of files in rustdoc
GuillaumeGomez Jun 19, 2023
bf27f12
relaxed orderings in `thread::park` example
ibraheemdev Jun 21, 2023
7201271
Fix typo in `eprintln` docs
clubby789 Jun 21, 2023
3acb1d2
"Memory Orderings" -> "Memory Ordering"
m-ou-se Jun 21, 2023
91aef00
Fix msg passed to span_bug
imor Jun 21, 2023
3ad595a
Add tests for invalid files generation
GuillaumeGomez Jun 19, 2023
e5c66ec
Rollup merge of #99587 - ibraheemdev:park-orderings, r=m-ou-se
GuillaumeGomez Jun 21, 2023
a7b90cf
Rollup merge of #112814 - antoyo:sync-cg_gcc-2023-06-19, r=bjorn3
GuillaumeGomez Jun 21, 2023
e5a4b67
Rollup merge of #112836 - GuillaumeGomez:rustdoc-invalid-file-creatio…
GuillaumeGomez Jun 21, 2023
cba1b84
Rollup merge of #112863 - clubby789:stderr-typo, r=albertlarsan68
GuillaumeGomez Jun 21, 2023
b3f43c4
Rollup merge of #112885 - imor:fix_span_bug_msg, r=cjgillot
GuillaumeGomez Jun 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions compiler/rustc_codegen_gcc/.github/workflows/stdarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
matrix:
libgccjit_version:
- { gcc: "libgccjit.so", artifacts_branch: "master" }
commands: [
"--test-successful-rustc --nb-parts 2 --current-part 0",
"--test-successful-rustc --nb-parts 2 --current-part 1",
cargo_runner: [
"sde -future -rtm_mode full --",
"",
]

steps:
Expand All @@ -36,6 +36,20 @@ jobs:
- name: Install packages
run: sudo apt-get install ninja-build ripgrep

- name: Install Intel Software Development Emulator
if: ${{ matrix.cargo_runner }}
run: |
mkdir intel-sde
cd intel-sde
dir=sde-external-9.14.0-2022-10-25-lin
file=$dir.tar.xz
wget https://downloadmirror.intel.com/751535/$file
tar xvf $file
sudo mkdir /usr/share/intel-sde
sudo cp -r $dir/* /usr/share/intel-sde
sudo ln -s /usr/share/intel-sde/sde /usr/bin/sde
sudo ln -s /usr/share/intel-sde/sde64 /usr/bin/sde64

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
Expand Down Expand Up @@ -91,6 +105,10 @@ jobs:
./prepare_build.sh
./build.sh --release --release-sysroot
cargo test

- name: Clean
if: ${{ !matrix.cargo_runner }}
run: |
./clean_all.sh

- name: Prepare dependencies
Expand All @@ -107,10 +125,18 @@ jobs:
args: --release

- name: Run tests
if: ${{ !matrix.cargo_runner }}
run: |
./test.sh --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore

- name: Run stdarch tests
if: ${{ !matrix.cargo_runner }}
run: |
cd build_sysroot/sysroot_src/library/stdarch/
CHANNEL=release TARGET=x86_64-unknown-linux-gnu ../../../../cargo.sh test

- name: Run stdarch tests
if: ${{ matrix.cargo_runner }}
run: |
cd build_sysroot/sysroot_src/library/stdarch/
STDARCH_TEST_EVERYTHING=1 CHANNEL=release CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER="${{ matrix.cargo_runner }}" TARGET=x86_64-unknown-linux-gnu ../../../../cargo.sh test -- --skip rtm --skip tbm --skip sse4a
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_gcc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ benchmarks
tools/llvm-project
tools/llvmint
tools/llvmint-2
# The `llvm` folder is generated by the `tools/generate_intrinsics.py` script to update intrinsics.
llvm
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ dependencies = [
[[package]]
name = "gccjit"
version = "1.0.0"
source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
source = "git+https://github.com/antoyo/gccjit.rs#d6e52626cfc6f487094a5d5ac66302baf3439984"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.0.1"
source = "git+https://github.com/antoyo/gccjit.rs#fe242b7eb26980e6c78859d51c8d4cc1e43381a3"
source = "git+https://github.com/antoyo/gccjit.rs#d6e52626cfc6f487094a5d5ac66302baf3439984"
dependencies = [
"libc",
]
Expand Down
17 changes: 16 additions & 1 deletion compiler/rustc_codegen_gcc/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Using git-subtree with `rustc` requires a patched git to make it work.
The PR that is needed is [here](https://github.com/gitgitgadget/git/pull/493).
Use the following instructions to install it:

```
```bash
git clone git@github.com:tqc/git.git
cd git
git checkout tqc/subtree
Expand All @@ -204,6 +204,21 @@ make
cp git-subtree ~/bin
```

Then, do a sync with this command:

```bash
PATH="$HOME/bin:$PATH" ~/bin/git-subtree push -P compiler/rustc_codegen_gcc/ ../rustc_codegen_gcc/ sync_branch_name
cd ../rustc_codegen_gcc
git checkout master
git pull
git checkout sync_branch_name
git merge master
```

TODO: write a script that does the above.

https://rust-lang.zulipchat.com/#narrow/stream/301329-t-devtools/topic/subtree.20madness/near/258877725

### How to use [mem-trace](https://github.com/antoyo/mem-trace)

`rustc` needs to be built without `jemalloc` so that `mem-trace` can overload `malloc` since `jemalloc` is linked statically, so a `LD_PRELOAD`-ed library won't a chance to intercept the calls to `malloc`.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_gcc/build_sysroot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ compiler_builtins = "0.1"
alloc = { path = "./sysroot_src/library/alloc" }
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
test = { path = "./sysroot_src/library/test" }
proc_macro = { path = "./sysroot_src/library/proc_macro" }

[patch.crates-io]
rustc-std-workspace-core = { path = "./sysroot_src/library/rustc-std-workspace-core" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ git config user.name || git config user.name "None"

git commit -m "Initial commit" -q
for file in $(ls ../../patches/ | grep -v patcha); do
echo "[GIT] apply" $file
git apply ../../patches/$file
git add -A
git commit --no-gpg-sign -m "Patch $file"
echo "[GIT] apply" $file
git apply ../../patches/$file
git add -A
git commit --no-gpg-sign -m "Patch $file"
done
popd

Expand Down
20 changes: 18 additions & 2 deletions compiler/rustc_codegen_gcc/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
drop_in_place(to_drop);
}

#[lang = "unpin"]
pub auto trait Unpin {}

#[lang = "deref"]
pub trait Deref {
type Target: ?Sized;
Expand Down Expand Up @@ -488,10 +491,23 @@ pub struct Box<T: ?Sized, A: Allocator = Global>(Unique<T>, A);

impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A> {}

impl<T> Box<T> {
pub fn new(val: T) -> Box<T> {
unsafe {
let size = intrinsics::size_of::<T>();
let ptr = libc::malloc(size);
intrinsics::copy(&val as *const T as *const u8, ptr, size);
Box(Unique { pointer: NonNull(ptr as *const T), _marker: PhantomData }, Global)
}
}
}

impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
fn drop(&mut self) {
// inner value is dropped by compiler
libc::free(self.pointer.0 as *mut u8);
// inner value is dropped by compiler.
unsafe {
libc::free(self.0.pointer.0 as *mut u8);
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ fn main() {
world as Box<dyn SomeTrait>;

assert_eq!(intrinsics::bitreverse(0b10101000u8), 0b00010101u8);
assert_eq!(intrinsics::bitreverse(0xddccu16), 0x33bbu16);
assert_eq!(intrinsics::bitreverse(0xffee_ddccu32), 0x33bb77ffu32);
assert_eq!(intrinsics::bitreverse(0x1234_5678_ffee_ddccu64), 0x33bb77ff1e6a2c48u64);

assert_eq!(intrinsics::bswap(0xabu8), 0xabu8);
assert_eq!(intrinsics::bswap(0xddccu16), 0xccddu16);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_gcc/example/std_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ fn main() {

assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
assert_eq!(0x1234_5678_ffee_ddcc_1234_5678_ffee_ddccu128.reverse_bits(), 0x33bb77ff1e6a2c4833bb77ff1e6a2c48u128);

let _d = 0i128.checked_div(2i128);
let _d = 0u128.checked_div(2u128);
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_codegen_gcc/failing-ui-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ tests/ui/issues/issue-40883.rs
tests/ui/issues/issue-43853.rs
tests/ui/issues/issue-47364.rs
tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs
tests/ui/rfc-2091-track-caller/std-panic-locations.rs
tests/ui/rfcs/rfc1857-drop-order.rs
tests/ui/rfcs/rfc-2091-track-caller/std-panic-locations.rs
tests/ui/rfcs/rfc-1857-stabilize-drop-order/drop-order.rs
tests/ui/simd/issue-17170.rs
tests/ui/simd/issue-39720.rs
tests/ui/simd/issue-89193.rs
Expand All @@ -66,3 +66,5 @@ tests/ui/generator/panic-safe.rs
tests/ui/issues/issue-14875.rs
tests/ui/issues/issue-29948.rs
tests/ui/panic-while-printing.rs
tests/ui/enum-discriminant/get_discr.rs
tests/ui/panics/nested_panic_caught.rs

This file was deleted.

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-03-02"
channel = "nightly-2023-06-19"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
1 change: 0 additions & 1 deletion compiler/rustc_codegen_gcc/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
OperandValue::Immediate(op.tmp_var.to_rvalue()).store(self, place);
}
}

}
}

Expand Down
39 changes: 39 additions & 0 deletions compiler/rustc_codegen_gcc/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
use gccjit::FnAttribute;
use gccjit::Function;
use rustc_attr::InstructionSetAttr;
#[cfg(feature="master")]
use rustc_attr::InlineAttr;
use rustc_codegen_ssa::target_features::tied_target_features;
use rustc_data_structures::fx::FxHashMap;
use rustc_middle::ty;
#[cfg(feature="master")]
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_session::Session;
use rustc_span::symbol::sym;
use smallvec::{smallvec, SmallVec};
Expand Down Expand Up @@ -67,6 +71,24 @@ fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> {
}
}

/// Get GCC attribute for the provided inline heuristic.
#[cfg(feature="master")]
#[inline]
fn inline_attr<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, inline: InlineAttr) -> Option<FnAttribute<'gcc>> {
match inline {
InlineAttr::Hint => Some(FnAttribute::Inline),
InlineAttr::Always => Some(FnAttribute::AlwaysInline),
InlineAttr::Never => {
if cx.sess().target.arch != "amdgpu" {
Some(FnAttribute::NoInline)
} else {
None
}
}
InlineAttr::None => None,
}
}

/// Composite function which sets GCC attributes for function depending on its AST (`#[attribute]`)
/// attributes.
pub fn from_fn_attrs<'gcc, 'tcx>(
Expand All @@ -77,6 +99,23 @@ pub fn from_fn_attrs<'gcc, 'tcx>(
) {
let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(instance.def_id());

#[cfg(feature="master")]
{
let inline =
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NAKED) {
InlineAttr::Never
}
else if codegen_fn_attrs.inline == InlineAttr::None && instance.def.requires_inline(cx.tcx) {
InlineAttr::Hint
}
else {
codegen_fn_attrs.inline
};
if let Some(attr) = inline_attr(cx, inline) {
func.add_attribute(attr);
}
}

let function_features =
codegen_fn_attrs.target_features.iter().map(|features| features.as_str()).collect::<Vec<&str>>();

Expand Down
Loading
Loading