operating-systemcross-compiling

What's the difference between "riscv64-unknown-elf-gcc" and "riscv64-linux-gnu-gcc"


I want to develop a tiny OS on risc-v, and when I downloaded the risc-v cross-compiler, I found out that there are two modes of compiler, "riscv64-unknown-elf-gcc" and "riscv64-linux-gnu-gcc". I would like to know the difference between the two compilers.

I found that I should choose "riscv64-unknown-elf-gcc" because the OS is essentially a bare-metal program. But I'm not sure what exactly the difference is between these two compilers. I also learned something about the concepts of "newlib" and "glib", but I didn't recognize what they do.


Solution

  • "riscv64-unknown-elf-gcc" is a cross compiler that target the bare-metal.It does not need the operating system.This is suitable when you are developing a software and want to run directly on hardware without OS.It uses "newlib", a C library designed for embedded systems

    riscv64-linux-gnu-gcc is a compiler that target the OS running. It needs the operating system.It uses "glibc" (GNU C Library), a standard C library for Linux.