Skip to content

toolchain: xt-clang: fixes issues when building picolibc from source #90702

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

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

Conversation

dcpleung
Copy link
Member

@dcpleung dcpleung commented May 27, 2025

Although xt-clang is based on clang, for some reason, it still lists xcc system include path as the first search path (e.g. for stddef.h), and the clang system include path as last. This creates a big issue when the code starts to use any standards past C89 (since xcc is based on GCC 4.2). We can use compiler property nostdin_include to add -isystem to compiler options. However, some modules (e.g. picolibc) somehow ignore this. So we also need to forcibly do add_compile_options() to make sure the clang system include path is placed before the xcc system include path.

dcpleung added 4 commits May 27, 2025 15:45
Since compiler options are unconditionally passed to the script,
we may pass arguments that are not recognized. So we change to
only parse known arguments. Currently, it only cares about -l,
which is related to linking libraries.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Some tests explicitly test for deprecated functions and they
override the macro __deprecated to avoid compiler warnings.
So, for xcc/xt-clang, only define __deprecated if it has not
already been defined.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Xtensa toolchain xt-clang needs similar treatment to xcc in
terms of nostdinc and nostdinc_include, so add it to the if
block to exclude these by default.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Although xt-clang is based on clang, for some reason, it still
lists xcc system include path as the first search path (e.g.
for stddef.h), and the clang system include path as last. This
creates a big issue when the code starts to use any standards
past C89 (since xcc is based on GCC 4.2). We can use compiler
property nostdin_include to add -isystem to compiler options.
However, some modules (e.g. picolibcs) somehow ignore this.
So we also need to forcibly do add_compile_options() to make
sure the clang system include path is placed before the xcc
system include path.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

intel_adsp: Xtensa: Build failures on intel_adsp platforms with cadence clang toolchain
2 participants