RdStudios9145 / AnotherOSbutinrust

0 stars 1 forks source link

Support for C #7

Open aelnosu opened 4 months ago

aelnosu commented 4 months ago

This is an issue that tracks the progress of implementing C support.

Cross-compilation toolchains and C code If you want to compile C code along with Rust (such as for Rust crates with C dependencies), you will need an appropriate x86_64 toolchain.

Rust may be able to use an x86_64-linux-gnu- toolchain with appropriate standalone flags to build for this toolchain (depending on the assumptions of that toolchain, see below), or you may wish to use a separate x86_64-unknown-none (or x86_64-elf-) toolchain.

On some x86_64 hosts that use ELF binaries, you may be able to use the host C toolchain, if it does not introduce assumptions about the host environment that don't match the expectations of a standalone environment. Otherwise, you may need a separate toolchain for standalone/freestanding development, just as when cross-compiling from a non-x86_64 platform.

Could use clang.

aelnosu commented 4 months ago

clang++ -target x86_64-unknown-none -ffreestanding -nostdlib -fno-builtin -c INPUT.c -o OUTPUT.o