Re: Using Clang instead of GCC?
Posted: Sun Sep 26, 2010 10:57 am
LLVM bitcode is. However, post preprocessing, [standard] C isn'tberkus wrote:LLVM bitcode is in essence assembly language. Haven't seen a portable assembly yet.
The Place to Start for Operating System Developers
http://f.osdev.org/
LLVM bitcode is. However, post preprocessing, [standard] C isn'tberkus wrote:LLVM bitcode is in essence assembly language. Haven't seen a portable assembly yet.
Doesn't 'as' normally default to a.out output, not ELF? Run;quanganht wrote:What's happening right now is output object files from clang is not recognized by gnu ldEdit: Maybe something is wrong with my toolchain. Like JamesM said, I used llc to get an assembly file (Kernel.s) then compile it with gnu asCode: Select all
~clang -c -nostdlib -nodefaultlibs -mcmodel=large Kernel.cpp -o Kernel.o ~nasm -f elf loader.asm -o loader.o ~i586-elf-ld -T link.ld -o Kernel .bin loader.o Kernel.o Kernel.o: file not recognized: File format not recognized
But when I try to link, the same error appears.Code: Select all
as Kernel.s -o Kernel.o
Edit2: found it. llc emitted 64-bit asm code. But adding "-march=x86" to llc makes it spit out broken code
Code: Select all
file Kernel.o
+ {INF}.JamesM wrote:Run;
and see what you get.Code: Select all
file Kernel.o
Don't know about Linux, but on every system I'm familiar with as outputs same format that is used by other parts of toolchain. ELF that is these days.JamesM wrote:Doesn't 'as' normally default to a.out output, not ELF?
Just checked, you're quite right.fronty wrote:Don't know about Linux, but on every system I'm familiar with as outputs same format that is used by other parts of toolchain. ELF that is these days.JamesM wrote:Doesn't 'as' normally default to a.out output, not ELF?
Good luck getting support from the GCC team if your bug is specific to OS development...SatyaNarayan wrote:so If u find some bug in OS development using Clang then There is no one to help u. So there will be delay in Development.
The standard library isn't the reason for which people build GCC cross-compilers. If they don't want to link it in, they can just use -ffree-standing. There are two reasons for building a cross-compiler: (1) the target(s) and (2) the ABI (i.e., any initialization prior to main, calling conventions, etc.).JamesM wrote:LLVM isn't as hard-tied to the platform's glibc, so you don't need a cross compiler.
Clang has many active developers who will be very willing to fix bugs. There's a big company with paid developers working on it, I think it cares about bugs in clang and llvm, because they have it in production use.SatyaNarayan wrote:so If u find some bug in OS development using Clang then There is no one to help u. So there will be delay in
I've reported a couple of Clang bugs before, and had very fast fixes to them.SatyaNarayan wrote:so If u find some bug in OS development using Clang then There is no one to help u. So there will be delay in Development.