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

feat(clang): add clang support for riscv64 and aarch64 #77

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ninolomata
Copy link
Member

No description provided.

@josecm
Copy link
Member

josecm commented Jul 20, 2023

I haven't delved too deeply into this yet, but I have a small suggestion. Could you please provide additional information in the PR description about how and in what targets you have tested this?

Also, for arm targets, we should test this with armclang, not just clang.

Plus, aarch32 must also be supported. @AfonsoSantos96 could you try to take a look at this?

@josecm josecm self-assigned this Jul 20, 2023
@danielRep
Copy link
Member

For Ubuntu 20.04, I've used

16:43 $ ~/toolchains/arm/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang-cpp --version
clang version 16.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/daniel/toolchains/arm/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/bin

and I've effectively run bao on qemu-aarch64-virt platform:

=> go 0x50000000
## Starting application at 0x50000000 ...
Bao Hypervisor w/ clang compilation
Bao bare-metal test guest
cpu 1 up
cpu 2 up
cpu 3 up
cpu 0 up
cpu0: timer_handler
cpu1: ipi_handler
cpu2: ipi_handler
cpu3: ipi_handler
QEMU: Terminated

@danielRep
Copy link
Member

@ninolomata , could you separate the changes into x number of meaningful commits? It would be easier to understand some of the changes made. I feel that e.g. with the bao code changes it was an iterative process, maybe that would be sufficient to map it to significant commits.

@josecm
Copy link
Member

josecm commented Aug 15, 2023

Also, @ninolomata , could you clarify exactly what is need to compile the code with clang? I'm guessing:

make PLATFORM=... CONFIG=... LLVM=/path/to/llvm/install

Is my assumption correct?

I've installed clang via a package manager. So all the executables are in /usr/bin. Could you clarify how you have installed clang also?

Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com>
Clang assembler requires valid assembly; otherwise, an error is thrown. Instead of using "->" as the token to parse for assembly macro defines, we define the tokens "#", which is used for comments in assembly files. The generated output will be valid for both clang and gcc.

Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com>
This commit fixes relocation errors identified by the clang compiler and marks the .gtl_page_tables section as no data otherwise there is a type mismatch.

Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com>
This commit fixes some issues when using clang:
- remove .directive .func which is not recognized by clang assembler;
- make gtlb_page_tables as no data to avoid section type mismatch;
- remove mov instructions with flexible second operand since ithey are not recognized by the clang assembler;

Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com>
@josecm
Copy link
Member

josecm commented Oct 20, 2023

Another point is that we should include build checks for clang now that we have a CI pipeline.

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

Successfully merging this pull request may close these issues.

None yet

3 participants