diff --git a/.github/workflows/m68k.yml b/.github/workflows/m68k.yml index 329d21a25b0..d9ca7af8f82 100644 --- a/.github/workflows/m68k.yml +++ b/.github/workflows/m68k.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Install packages - run: sudo apt-get install qemu + run: sudo apt-get install qemu qemu-user-static - uses: actions/checkout@v3 @@ -67,6 +67,11 @@ jobs: - name: Setup path to libgccjit run: | sudo dpkg -i gcc-m68k-13.deb + echo "*********************" + ls /usr/bin + echo "*********************" + ls /bin + echo "*********************" ls /lib echo "*********************" ls /usr/lib @@ -114,18 +119,33 @@ jobs: #path: rust #key: ${{ runner.os }}-packages-${{ hashFiles('rust/.git/HEAD') }} + # TODO: reset cross-gcc config file (i.e. try to revert CT_BINUTILS_V_2_37 to CT_BINUTILS_V_2_38). - name: Test build (TODO REMOVE) run: | cat > main.c < int main(void) { printf("Hello, world!"); } EOF mkdir vm sudo mount debian-m68k.img vm - m68k-unknown-linux-gnu-gcc main.c -o vm/home/main + m68k-unknown-linux-gnu-gcc main.c -o main + sudo cp main vm/home/main + sudo cp $(which qemu-m68k-static) vm/usr/bin/ sudo chroot vm/ qemu-m68k-static /home/main + - name: Test libgccjit build (TODO REMOVE) + run: | + export LD_LIBRARY_PATH=/usr/lib + export LIBRARY_PATH=/usr/lib + cd m68k-test + cargo run + cd .. + sudo mount debian-m68k.img vm + sudo mv m68k-test/main-m68k vm/home/ + sudo chroot vm/ qemu-m68k-static /home/main-m68k + - name: Build run: | ./y.sh prepare --only-libcore diff --git a/m68k-test/Cargo.lock b/m68k-test/Cargo.lock new file mode 100644 index 00000000000..5a5e22665db --- /dev/null +++ b/m68k-test/Cargo.lock @@ -0,0 +1,32 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "gccjit" +version = "1.0.0" +source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" +dependencies = [ + "gccjit_sys", +] + +[[package]] +name = "gccjit_sys" +version = "0.0.1" +source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.148" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" + +[[package]] +name = "m68k-test" +version = "0.1.0" +dependencies = [ + "gccjit", +] diff --git a/m68k-test/Cargo.toml b/m68k-test/Cargo.toml new file mode 100644 index 00000000000..b94f6b5bea5 --- /dev/null +++ b/m68k-test/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "m68k-test" +version = "0.1.0" +edition = "2021" + +[dependencies] +gccjit = { git = "https://github.com/antoyo/gccjit.rs" } diff --git a/m68k-test/src/main.rs b/m68k-test/src/main.rs new file mode 100644 index 00000000000..73c06a76bf5 --- /dev/null +++ b/m68k-test/src/main.rs @@ -0,0 +1,10 @@ +use gccjit::{Context, FunctionType, OutputKind}; + +fn main() { + let context = Context::default(); + let int_type = context.new_type::(); + let function = context.new_function(None, FunctionType::Exported, int_type, &[], "main", false); + let block = function.new_block("block"); + block.end_with_return(None, context.new_rvalue_from_int(int_type, 42)); + context.compile_to_file(OutputKind::Executable, "main-m68k"); +}