LLVM: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
LLVM is a compiler infrastructure for several languages. It consists of clang as the C compiler, the LLLVM library (includes [http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html llvm-mc] as the assembler) and lld as the linker. The LLVM library can be used to create several languages like Rust.
LLVM is a compiler infrastructure for several languages. It consists of clang as the C compiler, the LLVM library (includes [http://blog.llvm.org/2010/04/intro-to-llvm-mc-project.html llvm-mc] as the assembler) and lld as the linker. The LLVM library can be used to create several languages like Rust.


== OS Development with LLVM ==
== OS Development with LLVM ==
Line 9: Line 9:
The following command gives the supported architectures
The following command gives the supported architectures


<code>llc -version </code>
llc -version


As it is a cross compiler by default, clang can called to compile i686-elf for the simply by
As it is a cross compiler by default, clang can called to compile i686-elf for the simply by


<code>clang -target i686-elf</code>
clang -target i686-elf


To link the object files, simply use the `ld.lld` command, since for LLD, architectures doesn't matter
To link the object files, simply use <code>ld.lld</code>, as for LLD, architectures doesn't matter.


=== Building LLVM ===
=== Building LLVM ===

Latest revision as of 12:43, 6 September 2021

LLVM is a compiler infrastructure for several languages. It consists of clang as the C compiler, the LLVM library (includes llvm-mc as the assembler) and lld as the linker. The LLVM library can be used to create several languages like Rust.

OS Development with LLVM

LLVM recently has been used in development of BSDs.

One good thing about LLVM is that it is cross-compiler by design.

The following command gives the supported architectures

llc -version

As it is a cross compiler by default, clang can called to compile i686-elf for the simply by

clang -target i686-elf

To link the object files, simply use ld.lld, as for LLD, architectures doesn't matter.

Building LLVM

Main article: LLVM Cross-Compiler