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

Merged
merged 4 commits into from
Jun 11, 2025

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

@dcpleung
Copy link
Member Author

dcpleung commented Jun 9, 2025

ping? This is blocking internal CI.

@nashif nashif requested a review from teburd June 9, 2025 23:05
@nashif
Copy link
Member

nashif commented Jun 10, 2025

@tejlmand please review

@nashif nashif assigned dcpleung and unassigned tejlmand Jun 11, 2025
@dkalowsk dkalowsk merged commit 146e22f into zephyrproject-rtos:main Jun 11, 2025
46 checks passed
@dcpleung dcpleung deleted the toolchain/xtclang_bs branch June 12, 2025 16:19
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
6 participants