The iar toolchain fails to build after the update to the
1.0.0 Zephyr SDK. The path to the gnu toolchains
was updated to '${ZEPHYR_SDK_INSTALL_DIR}/gnu/'
in order to be compatible with the 1.0.0 SDK.
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
ZephyrSDK v1.0.0 is updated to support RXv2 and RXv3 instruction
this update the gcc cmake configuration for RX build on Zephyr SDK
for RXv2 and RXv3 MCU
Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
Override the GCC-specific `-Wno-volatile` flag specified by GCC
`compiler_flags.cmake` with the Clang-equivalent
`-Wno-deprecated-volatile`.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Compiler-generated FLIX instructions are currently disabled for LLEXT due
to a historic issue with LLEXT feature that appears to be already
resolved. However, another issue with FLIX is now being investigated.
The latter issue is not related to LLEXT but userspace feature.
To mitigate impact of global complier settings, this change adds a kconfig
choice for controlling FLIX generation independently for LLEXT modules.
Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
Add a new compiler property warning_no_misleading_indentation to allow
disabling misleading indentation warnings. This is implemented for GCC
with the -Wno-misleading-indentation flag.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Adds fixes for build and runtime issues using MWDT:
* Rename sections for llext_memblk.c buffers as MWDT cannot initialize
sys_mem_blocks struct with buffer address when the section name of
sys_mem_blocks struct (its variable name) is identical to the
buffer's section name
* Adds --no-check-sections flag for MWDT on final stages of
linking. Unlike other toolchains, MWDT's default behavior is to
strictly check and fail on section overlap. Using SLIDs requires
overlap; see llext-sections.ld
* Modifies inspect test case's ifdef around rodata sections, as
not all Harvard platforms using MWDT have .rodata_in_data sections -
their creation is triggered by passing the -Hccm flag to CCAC.
As an example, nsim/nsim_em doesn't have them and nsim/nsim_vpx5 does
* Removes -Hccm flag when building with CONFIG_LLEXT_RODATA_NO_RELOC
as it causes CCAC to mark the custom section llext.rodata.noreloc
writable (SHF_WRITE) though it has only read-only data, making it
impossible for for LLEXT to recognize it and put it in the
appropriate region; see llext_load.c's llext_map_sections
* Adds name to unnamed first argument of threads_objects_test_setup,
removing warning about omitting parameter names being a
C2x extension
Also fixes a build warning for GCC about pointer arithmetic in
the INSTR_FETCHABLE macro.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
Enable the ARM_PACBTI Kconfig choice for ARM64 architectures (ARMV8_A
and ARMV9_A) in addition to the existing ARM32 ARMV8_1_M_MAINLINE
support. Add the corresponding -mbranch-protection compiler flags to
both GCC and Clang target files for ARM64.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This adds the compiler flag to instruct xt-clang not to generate
FLIX (Flexible Length Instruction Xtensions) instructions, where
multiple instructions can be fused into one instruction. FLIX
can provide performance and code size advantages.
When userspace is enabled, FLIX may reorder memory access
where memory is accessed before code determines whether
we should perform that memory access. For example,
when guarding memory access via k_is_user_context(), and
some kernel variables can only be accessed via kernel mode,
FLIX may reorder memory access such that these variables are
accessed before k_is_user_context(). This results in access
violation. This turns off FLIX generation by default and
lets the application developers to decide whether to enable
FLIX generation.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds to compiler flags template on instructing the compiler
on whether to generate VLIW instructions.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
seperate fpu mabi and march part, also use
the extention for the march part to make it
easier to add Zfinx and Zdinx later.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
Introduce the missing flag to compile code with Zbkb extension,
which has already been supported by the GCC 12 in current SDK.
Signed-off-by: Andy Lin <andylinpersonal@gmail.com>
When building for ARMv9-A platforms with CONFIG_ARM64_SVE disabled,
compilers still emit SVE instructions because ARMv9-A includes SVE
by default in the architecture specification.
Add explicit +nosve flag to -march when CONFIG_ARMV9_A=y but
CONFIG_ARM64_SVE=n to prevent SVE instruction emission. This ensures
the compiler respects the SVE configuration and only emits SVE
instructions when explicitly enabled.
Applied to both GCC and Clang/LLVM toolchains.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
As described in this issue:
https://github.com/zephyrproject-rtos/sdk-ng/issues/1038
`-flto=auto` fails on some (slower) Windows machines due to an issue with
the Zephyr SDK's GCC toolchain for Windows.
In order to allow users to work around this issue, introduce a new
CONFIG_LTO_SINGLE_THREADED option that switches to `-flto=1`, which
enforces a single thread when processing LTO.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit fixes bug #95402. When the GNU toolchain is installed
in its default path the library include dir will contain spaces.
By encasulating the library path in quotes the linker works again.
Signed-off-by: Rico van Dongen <rdongen@ziggo.nl>
Implement Scalable Vector Extension (SVE) context switching support,
enabling threads to use SVE and SVE2 instructions with lazy context
preservation across task switches.
The implementation is incremental: if only FPU instructions are used
then only the NEON access is granted and preserved to minimize context
switching overhead. If SVE is used then the NEON context is upgraded to
SVE and then full SVE access is granted and preserved from that point
onwards.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add ARMv9-A architecture support with Cortex-A510 CPU as the default
processor for generic ARMv9-A targets.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Add arcmwdt RISC-V core/ISA mapping in target_riscv.cmake to
automatically derive compiler flags from Kconfig settings.
- Select series core flag from SoC Kconfig: -av5rmx/-av5rhx
- Map RISC-V Kconfig to ccac -Z flags (M/A/C/Zicsr/Zifencei/Zicntr)
- Handle compressed logic correctly: -Zc or individual Zc* sub-extensions
- Add F/D and compressed FPU (-Zf/-Zd, -Zcf/-Zcd)
- Add -Zmmul when M is not selected and ZMMUL is enabled
- Use OPTIONAL include to allow for arch-specific target files
Keep early compiler checks stable by not pushing -Z flags into
CMAKE_REQUIRED_FLAGS.
Co-authored-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
Signed-off-by: Afonso Oliveira <afonsoo@synopsys.com>
Signed-off-by: Afonso Oliveira <afonso.oliveira707@gmail.com>
Signed-off-by: Torsten Tejlmand Rasmussen <torsten.rasmussen@nordicsemi.no>
Adds a new compiler flag to enable function instrumentation injection
at compile time for compilers that support it.
Adds support for this flag to GCC when `CONFIG_INSTRUMENTATION` is
enabled, setting the `-finstrument-functions` flag during compilation.
Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Signed-off-by: Maciej Sobkowski <msobkowski@antmicro.com>
Fixes#91045
Adding NO_SPLIT in the TOOLCHAIN_LD_FLAGS list caused every flags in the
list to be checked together by the linker. This caused issues where
incompatible flags was passed together, and the result was that none was
propagated to the linker.
By using separate variables, we can achieve the initial goal of NO_SPLIT to
only group a sub-set of flags.
Signed-off-by: Pierrick Guillaume <pguillaume@fymyte.com>
Compiler property no_track_macro_expansion is controlled by
CONFIG_COMPILER_TRACK_MACRO_EXPANSION.
When that Kconfig is set to Y, clang fails with the following error
message:
unknown argument: '-ftrack-macro-expansion=0'
This commit modifies clang/compiler_flags.cmake so that there is a
proper clang compiler option for this flag.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
-Wno-volatile is set by gcc/compiler_flags.cmake,
but is not supported by clang and generated warnings.
Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
Since this overrides values from gcc/compiler_flags.cmake,
they should ideally have the same structure and order.
Signed-off-by: Jaagup Averin <jaagup.averin@gmail.com>
Provide toolchain-specific implementations for the new functions
added in d77b58a, because the default ones end up with build failures.
As the MWDT toolchain doesn't support different combinations of
compilers and linkers, there's no need to pass any linker properties
from the compiler, at least for the time being. Moreover, the default
implementation of compiler_set_linker_properties() uses the compiler
flag (--print-libgcc-file-name) that doesn't make any sense for MWDT.
Therefore, provide an empty implementation of the function.
The default implementation of toolchain_linker_add_compiler_options()
doesn't cause any issues for now, but it's still better to replace
it with the passthrough implementation borrowed from ld/lld.
Signed-off-by: Ilya Tagunov <Ilya.Tagunov@synopsys.com>
Use CMAKE_C_COMPILER_TARGET to allow clang to correctly determine
the runtime library for the target architecture.
Otherwise, the default runtime library will be selected.
Signed-off-by: Mikhail Siomin <victorovich.01@mail.ru>
With inclusion of the optimization flag into the multilib selection
process, we cannot compute the compiler library path when the compiler's
target.cmake is processed as LINKER_OPTIMIZATION_FLAG is not computed until
much later.
Instead, add a function (compiler_file_path) which can be used to locate
the appropriate crtbegin.o and crtend.o files.
Delay computation of lib_include_dir and rt_library until after all
compiler flags have been computed by adding compiler_set_linker_properties
and calling that just before toolchain_linker_finalize is invoked.
Place default implementations of both of these functions in a new file,
cmake/compiler/target_template.cmake, where we assume the compiler works
like gcc or clang and handlers the --print-file-name and
--print-libgcc-file-name options. Compilers needing alternate
implementations can override these functions in their target.cmake files.
These implementations require that no generator expressions are necessary
for the compiler to compute the right library paths.
This mechanism is also used to take any additional compiler options by
adding a new (optional) linker function,
toolchain_linker_add_compiler_options, which maps compiler options to
equivalent linker options, discarding any that aren't applicable.
Signed-off-by: Keith Packard <keithp@keithp.com>
Commit f499ea0 made it so that the compiler optimization flags are also
passed to the assembler. However, this breaks for the IAR toolchain
since it uses the GNU assembler which does not have the same
optimization flags as the IAR compiler.
This commit separates the compiler and assembler optimizations to make
it possible to specify appropriate flags in a toolchains corresponding
`compiler_flags.cmake`
Signed-off-by: Daniel Flodin <daniel.flodin@iar.com>
Allow users to compile LLEXTs with the MetaWare Design Toolchain.
Provides utility to dramatically shrink bloated extensions by removing
unused section names left behind by MWDT strip. Test extensions will
not fit in NSIM VPX5 memory otherwise; each is reduced from ~16k to ~1k.
Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
to be able to choose c++23 dialect
deprecates c++2b, but we should keep the option c++2b for legacy
Signed-off-by: Adrian Bieri <adrian.bieri@loepfe.com>
This commit introduces a new Kconfig choice for configuring the code model
used for compilation.
All three code models specified by the RISC-V ELF psABI specification are
supported: medlow, medany and large.
For RV32, the `medlow` code model is always selected.
For RV64, the `large` code model is selected if the SRAM or kernel VM base
address is greater than or equal to 4 GiB; otherwise, the `medany` code
model is selected.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit introduces the support for the standard Zicntr extension, which
provides hardware counters.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the support for the following new Zc* series compressed
instruction extensions:
Zca - Subset of the C extension without FP loads and stores
Zcb - "Simple" instructions
Zcd - Double-precision floating-point instructions
Zcf - Single-precision floating-point instructions
Zcmp - "Complex" instructions for embedded CPUs
Zcmt - Table jump instructions for embedded CPUs
With the introduction of the Zc* extensions, the C extension now implies
the following Zc* extensions:
* Zca, always
* Zcf if F is specified (RV32 only)
* Zcd if D is specified
The Zc* extensions that are implied by the C extension are not specified in
the GCC `-march` flag because they are redundant and can interfere with the
resolution of the correct multi-lib for the selected architecture unless
the the alternate mappings for the redundant forms are manually specified.
All the implementation details in this commit are based on the Zc* v1.0.0
specification, which is the ratified version.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Fixed a problem where the command line option --vla was used
with C++ causing a command line error in the IAR ICCARM compiler.
Signed-off-by: Lars-Ove Karlsson <lars-ove.karlsson@iar.com>
This commit fixes the incorrect code formatting used by target_riscv.cmake
by changing the 4-space indent to 2-space and removing the space between if
keyword and parenthesis.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Several years ago we started enabling the -Waddress-of-packed-member
warning in commit cf111962e0 for GCC.
Do the same for Clang, since there is no reason not to and the warning
is very useful, especially in protocol stacks.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Commit be40d854c2ccacf14ca3fcfb01bffdc9b075c6c9 introduced the ability
of building Zephyr with deprecation warnings enabled, by making
COMPILER_WARNINGS_AS_ERRORS depend on the newly added DEPRECATION_TEST
Kconfig option. This has the downside of disabling **all** warnings, not
only the deprecation ones.
This patch instead makes DEPRECATION_TEST disable only the deprecation
warning, but leaves COMPILER_WARNINGS_AS_ERRORS enabled.
This has the advantage of being able to see other unrelated warnings
(and fail if they appear) but has the disadvantage of not printing out
the deprecation warnings themselves (since they are disabled).
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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>
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>
"-fshort-enums" changes the ABI. It's not enabled for gcc, so it's not
clear why it's enabled for clang (only ARM) and armclang, other than it
looks like some users of these toolchains may be linking against code
that is compiled with "-fshort-enums".
As an example, when compiling with clang, CONFIG_LTO, and a toolchain
built without "-fshort-enums", the linker warns:
ld.lld: error: linking module flags 'min_enum_size': IDs have
conflicting values in
'/usr/armv7m-cros-eabi/usr/lib/libc++_static.a(string.cpp.o at 784090)'
and 'ld-temp.o'
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
When running naive sim builds using clang, respect user passed
SYSROOT_DIR values. Additionally, allow overriding the archive tool
when calling Make for the native simulator.
Add the sysroot (if available) to the native_simulator target and
TOOLCHAIN_C_FLAGS and TOOLCHAIN_LD_FLAGS. Additionally pass CMAKE_AR
to NSI_AR.
Signed-off-by: Yuval Peress <peress@google.com>