-
Notifications
You must be signed in to change notification settings - Fork 124
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 #77
Conversation
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? |
For Ubuntu 20.04, I've used
and I've effectively run bao on
|
@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. |
Also, @ninolomata , could you clarify exactly what is need to compile the code with clang? I'm guessing:
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? |
dbab11e
to
09d1e95
Compare
Another point is that we should include build checks for clang now that we have a CI pipeline. |
59a293c
to
8837766
Compare
09d1e95
to
9a27fbe
Compare
I've rebase this branch with main, and replaced the proposed flag with I also propose to use the LLVM variable as a full path, so if one wants to use the package manager (to install clang llvm lld) it is possible to simply pass Another change is replacing the use of |
444474f
to
b11b413
Compare
@miguelafsilva5 I don't think those commit tags make sense. Maybe always use 'clang', e.g. |
1a3f785
to
4d6081e
Compare
4d6081e
to
0f4aa31
Compare
Tested on Ubuntu 22.04 with the following setup: Ubuntu clang version 18.1.8 (++20240731024944+3b5b5c1ec4a3-1~exp1~20240731145000.144)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin Successfully ran the Bao bare-metal demo from the bao demos on |
Double-checked. LGTM. |
Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com> Signed-off-by: David Cerdeira <davidmcerdeira@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 general-regs-only in aarch32 this is not recognized by the clang assembler - remove mov instructions with flexible second operand since they are not recognized by the clang assembler; Signed-off-by: Bruno Sa <bruno.vilaca.sa@gmail.com> Signed-off-by: David Cerdeira <davidmcerdeira@gmail.com>
These flags are enabled in Clang compiler by default. Adding these flags minimized the discrepancies between GCC and Clang Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Clang compiler only accepts fallthrough annotation to be done using attribute(fallthrough). This is can be enforced in gcc using the flag -Wimplicit-fallthrough=5 Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Both MISRA and clang compiler force inline functions to be static. Functions that are used in multiple sources stop being inline because they cannot be static. The other inline functions become static and their prototype is removed from the header Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
The way this size was being calculated using the linker generated a linking error when targetting risc-v. Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
No description provided.