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

build/clang: use llvm instead of binutils #1181

Merged
merged 21 commits into from
Jul 8, 2022
Merged

Conversation

pj1031999
Copy link
Collaborator

  • use llvm toolchain with clang build
  • fix incompatible target for CLANG_ABIFLAGS
  • explicitly use $(CPP) for c preprocessor
  • rename CLANG to LLVM

Tested on AArch64 build.
As far as I know mips target is not fully compatible with llvm toolchain.

- use llvm toolchain with clang build
- fix incompatible target for CLANG_ABIFLAGS
- explicitly use $(CPP) for c preprocessor
- rename CLANG to LLVM

Signed-off-by: Paweł Jasiak <[email protected]>
@pj1031999 pj1031999 added the proposal should we spend time on it? label Oct 22, 2021
@pj1031999
Copy link
Collaborator Author

For tests use #1167 with llvm and lld packages.

@cahirwpz
Copy link
Owner

  1. Please minimize the changes, esp. in tools.mk.
  2. Also do not rename CLANG variable to LLVM. Clang is not LLVM and vice versa - the same applies to GCC which is not BINUTILS.
  3. Have you verified that after linking with LLVM debugging info is preserved, so that GDB works without hiccups?

@pj1031999
Copy link
Collaborator Author

  1. Please minimize the changes, esp. in tools.mk.

What do you mean? Changes in arch.*.mk are required because target argument for clang was wrong. Changes in compile.mk are cosmetic but you always stop after preprocessor phase for these targets. toolks.mk is just if statement and retab which fixes wrong formatting.

  1. Also do not rename CLANG variable to LLVM. Clang is not LLVM and vice versa - the same applies to GCC which is not BINUTILS.

I don't agree with you. First of all - the source of that naming scheme is Linux kernel - grep 'LLVM' Makefile. I can agree that gcc is not binutils. They are different projects that coexists. But I think that you are wrong about clang relation to llvm. clang lives in llvm source code [1] and it requires libllvm. From my point of view leaving CLANG variable as it is with s/$(TARGET)/llvm/g changes gives wrong assumption that clang requires llvm toolchain which is not true. I believe that in ideal world we should use CC=... to set compiler and LLVM for use whole llvm project. But it is a subject of future changes.

  1. Have you verified that after linking with LLVM debugging info is preserved, so that GDB works without hiccups?

For me it works on AArch64 build as good as before.

Anyway, it's only proof of concept that we can live (almost [2]) without binutils and gcc compiler. I don't know how looks llvm support for risc-v and other build-time features that we are using with gcc (kgprof?) so it's not my intention to merge it. We can just leave it and come back in the future if we will want to explore alternatives to gcc and binutils or we can close this pull request.

[1] https://github.com/llvm/llvm-project/
[2] we still link with libgcc, we can try to use compiler-rt which is a part of llvm project, but I didn't have enough time for tests

@cahirwpz cahirwpz requested a review from MichalBlk July 4, 2022 11:51
@cahirwpz cahirwpz added review please review this PR and removed proposal should we spend time on it? labels Jul 4, 2022
@cahirwpz cahirwpz self-requested a review July 4, 2022 11:51
@cahirwpz cahirwpz added WiP not ready for code review and removed review please review this PR labels Jul 6, 2022
@cahirwpz cahirwpz self-assigned this Jul 7, 2022
@cahirwpz cahirwpz added review please review this PR and removed WiP not ready for code review labels Jul 7, 2022
@cahirwpz cahirwpz added accepted accepted by the maintainer for code review and removed review please review this PR labels Jul 8, 2022
@cahirwpz cahirwpz merged commit b216ff9 into cahirwpz:master Jul 8, 2022
@cahirwpz cahirwpz deleted the llvm branch July 8, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted accepted by the maintainer for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants