Skip to content

Commit 75a4fb9

Browse files
authored
Merge pull request #424 from rust-lang/remove-overwrite-target-triple-env-var
Remove OVERWRITE_TARGET_TRIPLE env var now that config.sh is gone
2 parents bd100e2 + f1c71ff commit 75a4fb9

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.github/workflows/m68k.yml

Lines changed: 16 additions & 6 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:
@@ -85,15 +83,15 @@ jobs:
8583
run: |
8684
./y.sh prepare --only-libcore --cross
8785
./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
88-
./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
8987
./y.sh clean all
9088
9189
- name: Build
9290
run: |
9391
./y.sh prepare --only-libcore --cross
9492
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
95-
./y.sh test --mini-tests
96-
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
9795
./y.sh clean all
9896
9997
- name: Prepare dependencies
@@ -104,7 +102,19 @@ jobs:
104102
105103
- name: Run tests
106104
run: |
107-
./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)
108118
109119
# Summary job for the merge queue.
110120
# 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

0 commit comments

Comments
 (0)