Skip to content

Commit f514f39

Browse files
committed
Fix CI
1 parent 580b6e3 commit f514f39

File tree

7 files changed

+83
-7
lines changed

7 files changed

+83
-7
lines changed

.github/workflows/m68k.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
steps:
3939
- name: Install packages
40-
run: sudo apt-get install qemu
40+
run: sudo apt-get install qemu qemu-user-static
4141

4242
- uses: actions/checkout@v3
4343

@@ -67,6 +67,11 @@ jobs:
6767
- name: Setup path to libgccjit
6868
run: |
6969
sudo dpkg -i gcc-m68k-13.deb
70+
echo "*********************"
71+
ls /usr/bin
72+
echo "*********************"
73+
ls /bin
74+
echo "*********************"
7075
ls /lib
7176
echo "*********************"
7277
ls /usr/lib
@@ -114,18 +119,32 @@ jobs:
114119
#path: rust
115120
#key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }}
116121

122+
# TODO: reset cross-gcc config file (i.e. try to revert CT_BINUTILS_V_2_37 to CT_BINUTILS_V_2_38).
117123
- name: Test build (TODO REMOVE)
118124
run: |
119125
cat > main.c <<EOF
126+
#include <stdio.h>
120127
int main(void) {
121128
printf("Hello, world!");
122129
}
123130
EOF
124131
mkdir vm
125132
sudo mount debian-m68k.img vm
126-
m68k-unknown-linux-gnu-gcc main.c -o vm/home/main
133+
m68k-unknown-linux-gnu-gcc main.c -o main
134+
sudo cp main vm/home/main
135+
sudo cp $(which qemu-m68k-static) vm/usr/bin/
127136
sudo chroot vm/ qemu-m68k-static /home/main
128137
138+
- name: Test libgccjit build (TODO REMOVE)
139+
run: |
140+
export LD_LIBRARY_PATH=/usr/lib
141+
export LIBRARY_PATH=/usr/lib
142+
cd m68k-test
143+
cargo run
144+
cd ..
145+
sudo mv m68k-test/main-m68k vm/home/
146+
sudo chroot vm/ qemu-m68k-static /home/main-m68k
147+
129148
- name: Build
130149
run: |
131150
./y.sh prepare --only-libcore

config.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ TARGET_TRIPLE="m68k-unknown-linux-gnu"
2626
linker=''
2727
RUN_WRAPPER=''
2828
if [[ "$HOST_TRIPLE" != "$TARGET_TRIPLE" ]]; then
29-
if [[ "$TARGET_TRIPLE" == "m68k-unknown-linux-gnu" ]]; then
29+
#if [[ "$TARGET_TRIPLE" == "m68k-unknown-linux-gnu" ]]; then
3030
#TARGET_TRIPLE="mips-unknown-linux-gnu"
31-
linker='-Clinker=m68k-linux-gcc'
32-
elif [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
31+
#linker='-Clinker=m68k-linux-gcc'
32+
#el
33+
if [[ "$TARGET_TRIPLE" == "aarch64-unknown-linux-gnu" ]]; then
3334
# We are cross-compiling for aarch64. Use the correct linker and run tests in qemu.
3435
linker='-Clinker=aarch64-linux-gnu-gcc'
3536
RUN_WRAPPER='qemu-aarch64 -L /usr/aarch64-linux-gnu'

m68k-test/Cargo.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

m68k-test/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "m68k-test"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
gccjit = { git = "https://github.com/antoyo/gccjit.rs" }

m68k-test/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use gccjit::{Context, FunctionType, OutputKind};
2+
3+
fn main() {
4+
let context = Context::default();
5+
let int_type = context.new_type::<i32>();
6+
let function = context.new_function(None, FunctionType::Exported, int_type, &[], "main", false);
7+
let block = function.new_block("block");
8+
block.end_with_return(None, context.new_rvalue_from_int(int_type, 0));
9+
context.compile_to_file(OutputKind::Executable, "main-m68k");
10+
}

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock
101101
// TODO(antoyo): only set on x86 platforms.
102102
//context.add_command_line_option("-masm=intel");
103103

104-
if !disabled_features.contains("avx") {
104+
if !disabled_features.contains("avx") && tcx.sess.target.arch == "x86_64" {
105105
// NOTE: we always enable AVX because the equivalent of llvm.x86.sse2.cmp.pd in GCC for
106106
// SSE2 is multiple builtins, so we use the AVX __builtin_ia32_cmppd instead.
107107
// FIXME(antoyo): use the proper builtins for llvm.x86.sse2.cmp.pd and similar.

src/gcc_util.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,16 @@ pub fn check_tied_features(sess: &Session, features: &FxHashMap<&str, bool>) ->
198198
None
199199
}
200200

201+
fn arch_to_gcc(name: &str) -> &str {
202+
match name {
203+
"M68020" => "68020",
204+
_ => name,
205+
}
206+
}
207+
201208
fn handle_native(name: &str) -> &str {
202209
if name != "native" {
203-
return name;
210+
return arch_to_gcc(name);
204211
}
205212

206213
#[cfg(feature="master")]

0 commit comments

Comments
 (0)