Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asking an advice. #56

Open
AlessandroSangiuliano opened this issue Dec 13, 2021 · 1 comment
Open

Asking an advice. #56

AlessandroSangiuliano opened this issue Dec 13, 2021 · 1 comment

Comments

@AlessandroSangiuliano
Copy link

Hello, I know this is not probably the best place to ask, but I started to learn some system programming and I have a kernel that actually just start and set the IDT.

I'm using gcc as cross compiler but I want to switch to clang/llvm I know that ofr its nature clang is a cross compiler so i dont need to recompile it.

The question is: what are the options to make clang to cross compile to x86(_64) bare metal?

Something like -target=i386-none ?

This is needed because obviously when you start to buld a kernel from scratch you are going to run a binary on the bare metal and you don't have any environment yet.

Thank you for the help.

@nuta
Copy link
Owner

nuta commented Dec 13, 2021

Hi, try clang --target=x86_64 to let it cross-compile. Also, you would be interested in the following options:

clang --target=x86_64 -mcmodel=large -fno-omit-frame-pointer -ffreestanding -fno-builtin -nostdlib -nostdinc \
	-mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-avx -mno-avx2 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants