Working commands
This commit is contained in:
parent
718bc09cde
commit
cf1ca4b108
39
Dockerfile
39
Dockerfile
@ -41,8 +41,6 @@ RUN mkdir gcc-build && cd gcc-build && \
|
||||
make -j $(nproc) && \
|
||||
make install
|
||||
|
||||
# --enable-cxx-flags='-fomit-frame-pointer -ffunction-sections -fno-exceptions' -fno-rtti?
|
||||
# --with-gnu-as --with-gnu-ld?
|
||||
# Clone source repo
|
||||
RUN git clone https://github.com/rust-lang/rustc_codegen_gcc.git
|
||||
|
||||
@ -69,48 +67,19 @@ ENV CHANNEL=release
|
||||
# Build project
|
||||
# See https://github.com/rust-lang/rustc_codegen_gcc/blob/master/doc/tips.md#how-to-build-a-cross-compiling-libgccjit
|
||||
RUN cd rustc_codegen_gcc && ./y.sh prepare --cross
|
||||
#RUN CG_RUSTFLAGS="-Cpanic=abort -Copt-level=3" cd rustc_codegen_gcc && ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu --target /build/rustc_codegen_gcc/target_specs/m68k-unknown-linux-gnu.json --release
|
||||
ENV CG_RUSTFLAGS="-Cpanic=abort -Crelocation-model=static -Copt-level=3"
|
||||
|
||||
RUN cd rustc_codegen_gcc && ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu --target /build/rustc_codegen_gcc/target_specs/m68k-unknown-linux-gnu.json --release
|
||||
ENV CG_RUSTFLAGS="-Cpanic=abort -Crelocation-model=static -Copt-level=s"
|
||||
# ENV CG_RUSTFLAGS="-Cpanic=abort -Crelocation-model=static -Copt-level=s"
|
||||
|
||||
# Build "megapong" PoC
|
||||
|
||||
# TODO: Make this a Makefile
|
||||
RUN git clone https://github.com/ricky26/rust-mega-drive.git
|
||||
COPY 0001-Make-project-compile-with-GCC.patch /tmp/rust-mega-drive.patch
|
||||
RUN cd rust-mega-drive && patch -p1 < /tmp/rust-mega-drive.patch && rm /tmp/rust-mega-drive.patch
|
||||
# Compile rust code
|
||||
RUN cd rustc_codegen_gcc && ./y.sh cargo build --target /build/rustc_codegen_gcc/target_specs/m68k-unknown-linux-gnu.json --manifest-path /build/rust-mega-drive/examples/megapong/Cargo.toml --release
|
||||
|
||||
#RUN cd rust-mega-drive/examples/megapong && find && cat ../../Cargo.toml && false
|
||||
# Compile entrypoint + stdlib stub (should not be strictly necessary to reproduce)
|
||||
RUN cd rust-mega-drive/examples/megapong && m68k-elf-gcc -fno-exceptions -mcpu=68000 -T /build/rust-mega-drive/share/ldscripts/megadrive.x entry.S hack.c /build/rust-mega-drive/target/m68k-unknown-linux-gnu/release/libmegapong.a -o out.elf -O2 -nostartfiles -nostdlib -static -nolibc -s -flto -Wl,-gc-sections -ffunction-sections -fdata-sections
|
||||
##RUN cd rust-mega-drive/examples/megapong && /usr/local/bin/m68k-elf-gcc -c entry.S -o entry.o -fno-exceptions -mcpu=68000
|
||||
##RUN cd rust-mega-drive/examples/megapong && /usr/local/bin/m68k-elf-gcc -c hack.c -o entry.o -fno-exceptions -mcpu=68000
|
||||
|
||||
|
||||
#RUN false
|
||||
|
||||
|
||||
# Link everything
|
||||
#RUN cd rust-mega-drive/examples/megapong && /usr/local/bin/m68k-elf-ld -o out.elf -T /build/rust-mega-drive/share/ldscripts/megadrive.x entry.o stdlib.o /build/rust-mega-drive/target/m68k-unknown-linux-gnu/debug/libmegapong.a -static -z nocopyreloc --no-eh-frame-hdr -nostdlib
|
||||
# RUN cd rust-mega-drive/examples/megapong && /usr/local/bin/m68k-elf-gcc -fno-exceptions -mcpu=68000 -T /build/rust-mega-drive/share/ldscripts/megadrive.x entry.o stdlib.o /build/rust-mega-drive/target/m68k-unknown-linux-gnu/release/libmegapong.a -static -s -o out.elf -nostdlib -nodefaultlibs
|
||||
# Create cartridge
|
||||
#RUN cd rust-mega-drive/examples/megapong && /usr/local/bin/m68k-elf-objcopy -O binary out.elf out.md
|
||||
|
||||
#apt install texinfo
|
||||
#../binutils-2.43/configure --prefix=/gcc/binutils-install --target=m68k-elf --disable-multilib
|
||||
#make -j $(nproc)
|
||||
#make install
|
||||
#set path...
|
||||
|
||||
#set gcc-path in config.toml /gcc/gcc-install/lib
|
||||
|
||||
|
||||
# -> set target stuff to m68k-elf
|
||||
|
||||
# install unzip
|
||||
# https://github.com/llvm/llvm-project/archive/refs/heads/main.zip
|
||||
# -> llvm-project-main/
|
||||
# enable feature [c] for compiler-builtins thingy
|
||||
# set RUST_COMPILER_RT_ROOT (RUST_COMPILER_RT_ROOT=/build/llvm-project-main/compiler-rt)
|
||||
RUN cd rust-mega-drive/examples/megapong && m68k-elf-objcopy -O binary out.elf out.md
|
||||
Loading…
Reference in New Issue
Block a user