Skip to content

Commit a0e7630

Browse files
committed
Merge branch 'master' into sync_from_rust_2025_07_04
2 parents 44b7484 + 75a4fb9 commit a0e7630

File tree

5 files changed

+44
-53
lines changed

5 files changed

+44
-53
lines changed

.github/workflows/m68k.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ permissions:
1414
env:
1515
# Enable backtraces for easier debugging
1616
RUST_BACKTRACE: 1
17-
# TODO: remove when confish.sh is removed.
18-
OVERWRITE_TARGET_TRIPLE: m68k-unknown-linux-gnu
1917

2018
jobs:
2119
build:
@@ -59,14 +57,12 @@ jobs:
5957

6058
- name: Setup path to libgccjit
6159
run: |
62-
sudo dpkg -i gcc-m68k-15.deb
60+
sudo dpkg --force-overwrite -i gcc-m68k-15.deb
6361
echo 'gcc-path = "/usr/lib/"' > config.toml
6462
6563
- name: Set env
6664
run: |
6765
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
68-
69-
7066
7167
#- name: Cache rust repository
7268
## We only clone the rust repository for rustc tests
@@ -87,15 +83,15 @@ jobs:
8783
run: |
8884
./y.sh prepare --only-libcore --cross
8985
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
90-
./y.sh cargo build --manifest-path=./tests/hello-world/Cargo.toml --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
86+
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ./y.sh cargo build --manifest-path=./tests/hello-world/Cargo.toml --target ${{ github.workspace }}/target_specs/m68k-unknown-linux-gnu.json
9187
./y.sh clean all
9288
9389
- name: Build
9490
run: |
9591
./y.sh prepare --only-libcore --cross
9692
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
97-
./y.sh test --mini-tests
98-
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests
93+
./y.sh test --mini-tests --target-triple m68k-unknown-linux-gnu
94+
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu ./y.sh test --cargo-tests --target-triple m68k-unknown-linux-gnu
9995
./y.sh clean all
10096
10197
- name: Prepare dependencies
@@ -106,7 +102,19 @@ jobs:
106102
107103
- name: Run tests
108104
run: |
109-
./y.sh test --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}
105+
./y.sh test --target-triple m68k-unknown-linux-gnu --release --clean --build-sysroot --sysroot-features compiler_builtins/no-f16-f128 ${{ matrix.commands }}
106+
107+
- name: Run Hello World!
108+
run: |
109+
./y.sh build --target-triple m68k-unknown-linux-gnu
110+
111+
vm_dir=$(pwd)/vm
112+
cd tests/hello-world
113+
CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../../y.sh cargo build --target m68k-unknown-linux-gnu
114+
sudo cp target/m68k-unknown-linux-gnu/debug/hello_world $vm_dir/home/
115+
sudo chroot $vm_dir qemu-m68k-static /home/hello_world > hello_world_stdout
116+
expected_output="40"
117+
test $(cat hello_world_stdout) == $expected_output || (echo "Output differs. Actual output: $(cat hello_world_stdout)"; exit 1)
110118
111119
# Summary job for the merge queue.
112120
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!

build_system/src/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,6 @@ impl ConfigInfo {
352352
None => return Err("no host found".to_string()),
353353
};
354354

355-
if self.target_triple.is_empty()
356-
&& let Some(overwrite) = env.get("OVERWRITE_TARGET_TRIPLE")
357-
{
358-
self.target_triple = overwrite.clone();
359-
}
360355
if self.target_triple.is_empty() {
361356
self.target_triple = self.host_triple.clone();
362357
}

doc/tips.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ generate it in [gimple.md](./doc/gimple.md).
6262

6363
* Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case.
6464
* Set the path to the cross-compiling libgccjit in `gcc-path` (in `config.toml`).
65-
* Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu`.
66-
* Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`.
65+
* Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. You can specify which linker to use via `CG_RUSTFLAGS="-Clinker=<linker>"`, for instance: `CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc"`. Specify the target when building the sysroot: `./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu`.
66+
* Build your project by specifying the target and the linker to use: `CG_RUSTFLAGS="-Clinker=m68k-unknown-linux-gnu-gcc" ../y.sh cargo build --target m68k-unknown-linux-gnu`.
6767

6868
If the target is not yet supported by the Rust compiler, create a [target specification file](https://docs.rust-embedded.org/embedonomicon/custom-target.html) (note that the `arch` specified in this file must be supported by the rust compiler).
6969
Then, you can use it the following way:
7070

7171
* Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --sysroot --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json`
72-
* Build your project by specifying the target specification file: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`.
72+
* Build your project by specifying the target specification file: `../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`.
7373

7474
If you get the following error:
7575

src/archive.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::path::Path;
2+
3+
use rustc_codegen_ssa::back::archive::{
4+
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
5+
};
6+
use rustc_session::Session;
7+
8+
pub(crate) struct ArArchiveBuilderBuilder;
9+
10+
impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
11+
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder + 'a> {
12+
Box::new(ArArchiveBuilder::new(sess, &DEFAULT_OBJECT_READER))
13+
}
14+
15+
fn create_dll_import_lib(
16+
&self,
17+
_sess: &Session,
18+
_lib_name: &str,
19+
_import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
20+
_output_path: &Path,
21+
) {
22+
unimplemented!("creating dll imports is not yet supported");
23+
}
24+
}

src/intrinsic/mod.rs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -74,44 +74,8 @@ fn get_simple_intrinsic<'gcc, 'tcx>(
7474
sym::fabsf64 => "fabs",
7575
sym::minnumf32 => "fminf",
7676
sym::minnumf64 => "fmin",
77-
sym::minimumf32 => "fminimumf",
78-
sym::minimumf64 => "fminimum",
79-
sym::minimumf128 => {
80-
// GCC doesn't have the intrinsic we want so we use the compiler-builtins one
81-
// https://docs.rs/compiler_builtins/latest/compiler_builtins/math/full_availability/fn.fminimumf128.html
82-
let f128_type = cx.type_f128();
83-
return Some(cx.context.new_function(
84-
None,
85-
FunctionType::Extern,
86-
f128_type,
87-
&[
88-
cx.context.new_parameter(None, f128_type, "a"),
89-
cx.context.new_parameter(None, f128_type, "b"),
90-
],
91-
"fminimumf128",
92-
false,
93-
));
94-
}
9577
sym::maxnumf32 => "fmaxf",
9678
sym::maxnumf64 => "fmax",
97-
sym::maximumf32 => "fmaximumf",
98-
sym::maximumf64 => "fmaximum",
99-
sym::maximumf128 => {
100-
// GCC doesn't have the intrinsic we want so we use the compiler-builtins one
101-
// https://docs.rs/compiler_builtins/latest/compiler_builtins/math/full_availability/fn.fmaximumf128.html
102-
let f128_type = cx.type_f128();
103-
return Some(cx.context.new_function(
104-
None,
105-
FunctionType::Extern,
106-
f128_type,
107-
&[
108-
cx.context.new_parameter(None, f128_type, "a"),
109-
cx.context.new_parameter(None, f128_type, "b"),
110-
],
111-
"fmaximumf128",
112-
false,
113-
));
114-
}
11579
sym::copysignf32 => "copysignf",
11680
sym::copysignf64 => "copysign",
11781
sym::floorf32 => "floorf",

0 commit comments

Comments
 (0)