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 4 pull requests #95349

Closed
wants to merge 101 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
2fec530
Mark drop calls in landing pads cold instead of noinline
erikdesjardins Dec 29, 2021
f3e1f33
keep noinline for system llvm < 14
erikdesjardins Dec 30, 2021
54d2ec1
Merge commit '1411a98352ba6bee8ba3b0131c9243e5db1e6a2e' into sync_cg_…
bjorn3 Dec 31, 2021
e6e4605
Remove unused extern crate rustc_symbol_mangling
bjorn3 Dec 31, 2021
da4a392
Auto merge of #92419 - erikdesjardins:coldland, r=nagisa
bors Jan 1, 2022
0be9d1e
Merge pull request #114 from bjorn3/sync_from_rust
antoyo Jan 1, 2022
37069f1
Update references to `-Z symbol-mangling-version` to use `-C`
joshtriplett Oct 21, 2021
09afd64
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`
Aaron1011 Jan 3, 2022
68cbb46
Remove deprecated LLVM-style inline assembly
tmiasko Jan 12, 2022
e690fb1
Add comment
antoyo Jan 15, 2022
47c311a
Use Symbol for target features in asm handling
bjorn3 Jan 10, 2022
94dc375
Add preliminary support for inline assembly for msp430.
cr1901 Jan 20, 2022
ba41953
Reorder unwinding related builder methods to differentiate between dw…
bjorn3 Jan 24, 2022
81597f2
Remove unused return values from resume and cleanup_ret
bjorn3 Jan 24, 2022
2eaf0bc
Merge add_handler into catch_switch
bjorn3 Jan 24, 2022
4bdc784
Merge landing_pad and set_cleanup into cleanup_landing_pad
bjorn3 Jan 24, 2022
cd5d42a
Correctly import foreign statics
bjorn3 Jan 23, 2022
6663f4e
Move rustup component installation to rust-toolchain
bjorn3 Jan 24, 2022
fc23678
Merge pull request #115 from bjorn3/foreign_statics
antoyo Jan 25, 2022
5dc660b
Support upgrading the alignment of a global variable (#121)
antoyo Jan 26, 2022
99941cd
Support -Zfunction-sections
bjorn3 Jan 25, 2022
b7bfb21
Merge pull request #118 from bjorn3/function_sections
antoyo Jan 26, 2022
41f20fa
Support 128-bit integers on platforms without native support (#103)
antoyo Jan 31, 2022
9c3cce6
Implement simd_neg
antoyo Jan 15, 2022
72d89b0
Merge pull request #125 from rust-lang/fix/simd-slice
antoyo Feb 1, 2022
28ba430
Sync from rust a00e130dae74a213338e2b095ec855156d8f3d8a
bjorn3 Feb 1, 2022
7aaa87b
Rustup to rustc 1.60.0-nightly (a00e130da 2022-01-29)
bjorn3 Jan 30, 2022
9c3a123
Fix type_kind implementation
bjorn3 Jan 30, 2022
5067ad9
Replace unimplemented with todo in apply_attrs_to_cleanup_callsite
bjorn3 Jan 30, 2022
477d102
Move coretests to the 2021 edition
bjorn3 Feb 1, 2022
b4ad63c
Merge pull request #122 from bjorn3/rustup
antoyo Feb 1, 2022
20506e3
`#[used(linker)]` attribute (https://github.com/dtolnay/linkme/issues…
cynecx Nov 22, 2021
96340e5
Ensure that queries only return Copy types.
cjgillot Jan 31, 2022
1b2337c
Make FnAbiError Copy.
cjgillot Feb 1, 2022
22a3068
Auto merge of #93511 - cjgillot:query-copy, r=oli-obk
bors Feb 10, 2022
40d30ce
Unconditionally update symbols
bjorn3 Feb 10, 2022
e855e2d
Move ty::print methods to Drop-based scope guards
Mark-Simulacrum Feb 16, 2022
4cdcf03
README: Add compiler-rt cloning step
jbruechert Feb 4, 2022
164aa39
Merge pull request #127 from JBBgameich/readme-compiler-rt
antoyo Feb 19, 2022
56b7080
Remove build_sibling_block
bjorn3 Feb 18, 2022
18c34e4
Introduce Bx::switch_to_block
bjorn3 Feb 18, 2022
648d038
Auto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko
bors Feb 24, 2022
471234f
Sync from rust 3d127e2040b57157936f5f24e114a8b4c9a505ef
bjorn3 Feb 24, 2022
d565f60
Rustup to rustc 1.61.0-nightly (4b043faba 2022-02-24)
bjorn3 Feb 25, 2022
ddbbded
Merge pull request #130 from bjorn3/rustup
antoyo Feb 25, 2022
ff6b398
Use bx.switch_to_block where possible
bjorn3 Feb 25, 2022
b48ed38
Make bx.block non-optional
bjorn3 Feb 25, 2022
07afdb8
Use bitcast for ptrtoint and inttoptr
bjorn3 Feb 25, 2022
62e9b50
Remove current_block field of CodegenCx
bjorn3 Feb 25, 2022
a7c1c47
Fix review comments
bjorn3 Feb 25, 2022
3e35fab
Fix inttoptr
bjorn3 Feb 26, 2022
9d09842
Add and change a TODO
bjorn3 Feb 26, 2022
1fb9821
Merge pull request #131 from bjorn3/fix_non_singleton_builder
antoyo Feb 26, 2022
f706317
Support -Cpanic=unwind without unwinding
bjorn3 Feb 26, 2022
ac4baf3
Allow unreachable blocks for now
bjorn3 Feb 26, 2022
710b741
Merge pull request #132 from bjorn3/panic_unwind
antoyo Feb 27, 2022
beb1767
Don't export global allocs which are not statics
bjorn3 Feb 26, 2022
1a9ae8d
Merge pull request #133 from bjorn3/less_exports
antoyo Feb 27, 2022
dcc0853
Add support for on_stack parameters
antoyo Feb 27, 2022
f4ea709
Merge pull request #135 from rust-lang/feature/byval-params
antoyo Feb 28, 2022
962b8cf
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"
erikdesjardins Feb 26, 2022
4f132cb
Querify `global_backend_features`
nagisa Sep 24, 2021
7df92e4
Auto merge of #87402 - nagisa:nagisa/request-feature-requests-for-fea…
bors Mar 2, 2022
081bf75
rename ErrorReported -> ErrorGuaranteed
mark-i-m Jan 23, 2022
8238b91
all: fix some typos
cuishuang Mar 3, 2022
6fcfc3d
Add -Z oom={panic,abort} command-line option
Amanieu Oct 6, 2021
a19138f
cleanup: remove unused ability to have LLVM null-terminate const strings
erikdesjardins Mar 5, 2022
92d1850
Introduce `ConstAllocation`.
nnethercote Mar 1, 2022
0e36868
Auto merge of #94638 - erikdesjardins:noextranull, r=nagisa
bors Mar 7, 2022
d35fc85
Clarify `Layout` interning.
nnethercote Mar 4, 2022
3e7035f
Auto merge of #94690 - nnethercote:clarify-Layout-interning, r=fee1-dead
bors Mar 7, 2022
7c1f863
Stop removing the llvm-asm tests in test.sh since they don't exist an…
light4 Mar 8, 2022
0cff1d0
Merge pull request #136 from light4/clean_test
antoyo Mar 8, 2022
64012a1
Improve `AdtDef` interning.
nnethercote Mar 4, 2022
1c38932
debuginfo: Refactor debuginfo generation for types -- Rename DebugInf…
michaelwoerister Mar 14, 2022
fadd1c5
Auto merge of #88098 - Amanieu:oom_panic, r=nagisa
bors Mar 18, 2022
12f782e
Fix version of compiler_builtins to fix compilation failure
antoyo Mar 19, 2022
be9789b
Fix ice in box alloc
antoyo Mar 8, 2022
b3e50bd
Merge pull request #139 from rust-lang/fix/compiler-builtin-version
antoyo Mar 19, 2022
d63ea3e
Merge pull request #137 from rust-lang/fix/box-alloc-ice
antoyo Mar 19, 2022
0fb350f
Fix shift of unsigned integer by signed integer
antoyo Mar 19, 2022
44c0204
Merge pull request #141 from rust-lang/fix/unsigned-by-signed-shift
antoyo Mar 19, 2022
7230660
Add a simple argument parser to `build.sh`
yvt Mar 23, 2022
842a5fb
Add `--release-sysroot` flag to `build.sh`
yvt Mar 23, 2022
a22e15b
Merge pull request #143 from yvt/sysroot-profile
antoyo Mar 23, 2022
db59177
Sync from rust bc881e83d1cced71046e844fa55c0b0e9f9af382
bjorn3 Mar 26, 2022
6faa6a2
Rustup to rustc 1.61.0-nightly (d53246fed 2022-03-25)
bjorn3 Mar 26, 2022
7829437
Enable #[thread_local] on armv6k-nintendo-3ds
ian-h-chamberlain Feb 18, 2022
edf33fe
Add Destruct and Drop traits to static.rs
bjorn3 Mar 26, 2022
724473b
Fix compiletest compilation
bjorn3 Mar 26, 2022
fb9658d
Review comments
bjorn3 Mar 26, 2022
39683d8
Merge pull request #146 from bjorn3/rustup
antoyo Mar 26, 2022
78b680e
interpret: mark a dead match arm as dead
RalfJung Mar 26, 2022
bbff48e
Merge commit '39683d8eb7a32a74bea96ecbf1e87675d3338506' into sync_cg_…
bjorn3 Mar 26, 2022
3bbcf64
interpret: with enforce_number_validity, ensure integers are truly Sc…
RalfJung Mar 26, 2022
419b630
Merge pull request #16 from ian-h-chamberlain/feature/target-thread-l…
Meziu Mar 26, 2022
72ee247
Debug print char 0 as '\0' rather than '\u{0}'
dtolnay Mar 26, 2022
df1a8b3
Rollup merge of #95338 - bjorn3:sync_cg_gcc-2022-03-26, r=antoyo
Dylan-DPC Mar 26, 2022
b9c31d4
Rollup merge of #95340 - RalfJung:pnvi, r=oli-obk
Dylan-DPC Mar 26, 2022
6819c4d
Rollup merge of #95341 - Meziu:armv6k-3ds-target, r=nagisa
Dylan-DPC Mar 26, 2022
75587cc
Rollup merge of #95345 - dtolnay:escape0, r=Dylan-DPC
Dylan-DPC Mar 26, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,43 @@ jobs:

strategy:
fail-fast: false
matrix:
libgccjit_version: ["libgccjit.so", "libgccjit_without_int128.so"]

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v2
with:
repository: llvm/llvm-project
path: llvm

- name: Install packages
run: sudo apt-get install ninja-build ripgrep

- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yml
name: libgccjit.so
name: ${{ matrix.libgccjit_version }}
path: gcc-build
repo: antoyo/gcc
search_artifacts: true # Because, instead, the action only check the last job ran and that won't work since we want multiple artifacts.

- name: Setup path to libgccjit
run: |
echo $(readlink -f gcc-build) > gcc_path
# NOTE: the filename is still libgccjit.so even when the artifact name is different.
ln gcc-build/libgccjit.so gcc-build/libgccjit.so.0

- name: Set LIBRARY_PATH
- name: Set env
run: |
echo "LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$(cat gcc_path)" >> $GITHUB_ENV
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV

- name: Set RUST_COMPILER_RT_ROOT
run: echo "RUST_COMPILER_RT_ROOT="${{ env.workspace }}/llvm/compiler-rt >> $GITHUB_ENV

# https://github.com/actions/cache/issues/133
- name: Fixup owner of ~/.cargo/
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_gcc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ gimple*
res
test-backend
gcc_path
benchmarks
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ dependencies = [
[[package]]
name = "gccjit"
version = "1.0.0"
source = "git+https://github.com/antoyo/gccjit.rs#0672b78d162d65b6f36ea4062947253affe9fdef"
source = "git+https://github.com/antoyo/gccjit.rs#bdecdecfb8a02ec861a39a350f990faa33bd31c3"
dependencies = [
"gccjit_sys",
]

[[package]]
name = "gccjit_sys"
version = "0.0.1"
source = "git+https://github.com/antoyo/gccjit.rs#0672b78d162d65b6f36ea4062947253affe9fdef"
source = "git+https://github.com/antoyo/gccjit.rs#bdecdecfb8a02ec861a39a350f990faa33bd31c3"
dependencies = [
"libc 0.1.12",
]
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_codegen_gcc/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ You can also use my [fork of gcc](https://github.com/antoyo/gcc) which already i
```bash
$ git clone https://github.com/rust-lang/rustc_codegen_gcc.git
$ cd rustc_codegen_gcc
$ git clone https://github.com/llvm/llvm-project llvm --depth 1 --single-branch
$ export RUST_COMPILER_RT_ROOT="$PWD/llvm/compiler-rt"
$ ./prepare_build.sh # download and patch sysroot src
$ ./build.sh --release
```
Expand Down Expand Up @@ -109,6 +111,13 @@ Or add a breakpoint to `add_error` in gdb and print the line number using:

```
p loc->m_line
p loc->m_filename->m_buffer
```

To print a debug representation of a tree:

```c
debug_tree(expr);
```

To get the `rustc` command to run in `gdb`, add the `--verbose` flag to `cargo build`.
Expand All @@ -134,4 +143,5 @@ To get the `rustc` command to run in `gdb`, add the `--verbose` flag to `cargo b
* Set `linker='-Clinker=m68k-linux-gcc'`.
* Set the path to the cross-compiling libgccjit in `gcc_path`.
* Disable the 128-bit integer types if the target doesn't support them by using `let i128_type = context.new_type::<i64>();` in `context.rs` (same for u128_type).
* Comment the line: `context.add_command_line_option("-masm=intel");` in src/base.rs.
* (might not be necessary) Disable the compilation of libstd.so (and possibly libcore.so?).
43 changes: 38 additions & 5 deletions compiler/rustc_codegen_gcc/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,27 @@
#set -x
set -e

if [ -f ./gcc_path ]; then
codegen_channel=debug
sysroot_channel=debug

while [[ $# -gt 0 ]]; do
case $1 in
--release)
codegen_channel=release
shift
;;
--release-sysroot)
sysroot_channel=release
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done

if [ -f ./gcc_path ]; then
export GCC_PATH=$(cat gcc_path)
else
echo 'Please put the path to your custom build of libgccjit in the file `gcc_path`, see Readme.md for details'
Expand All @@ -13,13 +33,21 @@ fi
export LD_LIBRARY_PATH="$GCC_PATH"
export LIBRARY_PATH="$GCC_PATH"

if [[ "$1" == "--release" ]]; then
features=

if [[ "$1" == "--features" ]]; then
shift
features="--features $1"
shift
fi

if [[ "$codegen_channel" == "release" ]]; then
export CHANNEL='release'
CARGO_INCREMENTAL=1 cargo rustc --release
CARGO_INCREMENTAL=1 cargo rustc --release $features
else
echo $LD_LIBRARY_PATH
export CHANNEL='debug'
cargo rustc
cargo rustc $features
fi

source config.sh
Expand All @@ -28,4 +56,9 @@ rm -r target/out || true
mkdir -p target/out/gccjit

echo "[BUILD] sysroot"
time ./build_sysroot/build_sysroot.sh $CHANNEL
if [[ "$sysroot_channel" == "release" ]]; then
time ./build_sysroot/build_sysroot.sh --release
else
time ./build_sysroot/build_sysroot.sh
fi

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/build_sysroot/build_sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [[ "$1" == "--release" ]]; then
RUSTFLAGS="$RUSTFLAGS -Zmir-opt-level=3" cargo build --target $TARGET_TRIPLE --release
else
sysroot_channel='debug'
cargo build --target $TARGET_TRIPLE
cargo build --target $TARGET_TRIPLE --features compiler_builtins/c
fi

# Copy files to sysroot
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pushd $(dirname "$0") >/dev/null
source config.sh

# read nightly compiler from rust-toolchain file
TOOLCHAIN=$(cat rust-toolchain)
TOOLCHAIN=$(cat rust-toolchain | grep channel | sed 's/channel = "\(.*\)"/\1/')

popd >/dev/null

Expand Down
20 changes: 17 additions & 3 deletions compiler/rustc_codegen_gcc/example/mini_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ unsafe extern "C" fn _Unwind_Resume() {
#[lang = "sized"]
pub trait Sized {}

#[lang = "destruct"]
pub trait Destruct {}

#[lang = "unsize"]
pub trait Unsize<T: ?Sized> {}

Expand Down Expand Up @@ -59,6 +62,7 @@ unsafe impl Copy for i16 {}
unsafe impl Copy for i32 {}
unsafe impl Copy for isize {}
unsafe impl Copy for f32 {}
unsafe impl Copy for f64 {}
unsafe impl Copy for char {}
unsafe impl<'a, T: ?Sized> Copy for &'a T {}
unsafe impl<T: ?Sized> Copy for *const T {}
Expand Down Expand Up @@ -443,12 +447,22 @@ pub trait Deref {
fn deref(&self) -> &Self::Target;
}

pub trait Allocator {
}

pub struct Global;

impl Allocator for Global {}

#[lang = "owned_box"]
pub struct Box<T: ?Sized>(*mut T);
pub struct Box<
T: ?Sized,
A: Allocator = Global,
>(*mut T, A);

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

impl<T: ?Sized> Drop for Box<T> {
impl<T: ?Sized, A: Allocator> Drop for Box<T, A> {
fn drop(&mut self) {
// drop is currently performed by compiler.
}
Expand All @@ -468,7 +482,7 @@ unsafe fn allocate(size: usize, _align: usize) -> *mut u8 {
}

#[lang = "box_free"]
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: *mut T, alloc: A) {
libc::free(ptr as *mut u8);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ index 0000000..46fd999
+[package]
+name = "core"
+version = "0.0.0"
+edition = "2018"
+edition = "2021"
+
+[lib]
+name = "coretests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,4 @@ index 4bc44e9..8e3c7a4 100644

#[test]
fn cell_allows_array_cycle() {
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
index 3e00e0a..8e5663b 100644
--- a/library/core/tests/slice.rs
+++ b/library/core/tests/slice.rs
@@ -2108,6 +2108,7 @@ fn test_copy_within_panics_src_out_of_bounds() {
bytes.copy_within(usize::MAX..=usize::MAX, 0);
}

+/*
#[test]
fn test_is_sorted() {
let empty: [i32; 0] = [];
@@ -2122,6 +2123,7 @@ fn test_is_sorted() {
assert!(!["c", "bb", "aaa"].is_sorted());
assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len()));
}
+*/

#[test]
fn test_slice_run_destructors() {
-- 2.21.0 (Apple Git-122)
Loading