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

Check minimal version of llvm/lld linker #35671

Closed
tejlmand opened this issue May 26, 2021 · 2 comments · Fixed by #63396
Closed

Check minimal version of llvm/lld linker #35671

tejlmand opened this issue May 26, 2021 · 2 comments · Fixed by #63396
Assignees
Labels
area: Build System area: Toolchains Toolchains Enhancement Changes/Updates/Additions to existing features

Comments

@tejlmand
Copy link
Collaborator

tejlmand commented May 26, 2021

Support for lld instead of ld.bfd was introduced here:
#31706, in this commit: 2a59fa5

However, linking fails if user is using a older llvm, for example v10.0.0.

So a check should be introduced which ensures that llvm in use is >=v12.0.0

Describe the solution you'd like
A check to ensure llvm >=12.0.0 is used.

Describe alternatives you've considered
N/A

Additional context

Edit: old description removed, as it was caused by an old llvm (version 10), instead changed into request to ensure llvm >=12 is used.

@tejlmand tejlmand added Enhancement Changes/Updates/Additions to existing features area: Build System area: Toolchains Toolchains labels May 26, 2021
@tejlmand tejlmand changed the title support llvm/lld linker Check minimal version of llvm/lld linker May 26, 2021
@XiaZhouZero
Copy link

XiaZhouZero commented Aug 15, 2021

Does anybody know how to build Zephyr with LLVM/Clang and generate the whole IR file of an application, e.g., sample/hello_world?
I tried to add compiler flags in the application CmakeLists.txt by add this command zephyr_library_compile_options(-flto -fuse-ld=lld) . However, the building process failed when linking the libapp.a file.

Thanks for your help in advance!

@tejlmand
Copy link
Collaborator Author

tejlmand commented Sep 3, 2021

Does anybody know how to build Zephyr with LLVM/Clang and generate the whole IR file of an application, e.g., sample/hello_world?

@XiaZhouZero Could you open a dedicated question on this topic, as it is unrelated to this issue.
Issue if there is something you think should be improved.
Question if you just need to know more.

That being said, are you talking about the final image or each individual object file ?
As compile option you may use the COMPILER_OPT in Kconfig to add additional compiler options, like -emit-llvm.

And that will give you the llvm bytecode, however there are python scripts that relies on the elf object file as output, so it's not really useful as such as those scripts will then fail.

So it could be we should have some kind of possibility to allow users to also output an additional format, bytecode, assembly, pre-processed file, etc.

@nashif nashif removed their assignment Sep 7, 2021
@nordicjm nordicjm added this to To do in Build system Jan 11, 2023
tejlmand added a commit to tejlmand/zephyr that referenced this issue Oct 2, 2023
Fixes: zephyrproject-rtos#35671

Add minimal version required for LLVM LLD linker.
Linking fails with older LLVM LLD, such as v10.0.0.

LLVM v14.0.0 was released in 2022, and latest LLVM is v17.0.1.
Zephyr currently doesn't have a strict minimum version of LLVM
specified, but based on LLVM development and known issues on older
releases, then a minimum version of v14.0.0 has been chosen in this
commit.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
carlescufi pushed a commit that referenced this issue Oct 3, 2023
Fixes: #35671

Add minimal version required for LLVM LLD linker.
Linking fails with older LLVM LLD, such as v10.0.0.

LLVM v14.0.0 was released in 2022, and latest LLVM is v17.0.1.
Zephyr currently doesn't have a strict minimum version of LLVM
specified, but based on LLVM development and known issues on older
releases, then a minimum version of v14.0.0 has been chosen in this
commit.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Chenhongren pushed a commit to Chenhongren/zephyr that referenced this issue Oct 4, 2023
Add minimal version required for LLVM LLD linker.
Linking fails with older LLVM LLD, such as v10.0.0.

LLVM v14.0.0 was released in 2022, and latest LLVM is v17.0.1.
Zephyr currently doesn't have a strict minimum version of LLVM
specified, but based on LLVM development and known issues on older
releases, then a minimum version of v14.0.0 has been chosen in this
commit.

(cherry picked from commit 026dbdf)

Original-Fixes: zephyrproject-rtos#35671
Original-Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
GitOrigin-RevId: 026dbdf
Change-Id: I428bfcb03db8cf7a8c2adde0e53fc74dce81d3dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4909470
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Toolchains Toolchains Enhancement Changes/Updates/Additions to existing features
Projects
Status: Done in 3.4
Development

Successfully merging a pull request may close this issue.

3 participants