llvm patches for SOF xtensa#1
Merged
Merged
Conversation
Zephyr's FindZephyr-sdk.cmake intentionally skips auto-discovery when ZEPHYR_TOOLCHAIN_VARIANT=llvm, expecting the user to point ZEPHYR_SDK_INSTALL_DIR at the SDK that provides the GNU Xtensa binutils / sysroot the LLVM clang driver wraps around. When neither the user nor the environment supplies that variable the build fails late with confusing 'string.h: file not found' / malformed -isystem errors. Auto-detect a zephyr-sdk-* directory under $HOME, /opt, or /usr/local (highest version wins) and export ZEPHYR_SDK_INSTALL_DIR before invoking west when the user passes --llvm-clang. This keeps the LLVM build flow as one command for the common case while still respecting any value the user has already exported. Signed-off-by: Henry Liao <hliao8@proton.me>
The HiFi3 / HiFi4 / HiFi5 sources unconditionally include <xtensa/config/defs.h>, a header that ships only with the Cadence xt-clang / xt-gcc toolchains. The LLVM clang toolchain variant uses the Zephyr SDK GNU Xtensa binutils for assembly/linking but does not expose that Cadence-internal header, so every HiFi translation unit fails to find it even though the body of the file is guarded by SOF_USE_HIFI(...) and is unreachable for the LLVM build. Wrap the include in __has_include so the compiler silently skips it on toolchains that lack the header. The HiFi intrinsics are already supplied by <xtensa/tie/xt_hifiN.h>, which the LLVM toolchain does provide. No functional change for the Cadence toolchain path. Signed-off-by: Henry Liao <hliao8@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hope this PR is OK I used AI. Had to add some code so I could use my llvm patches on SOF and Zephyr.