C99 section 5.1.2.2.1p2 mandates that:
- argv[argc] shall be a null pointer.
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
So we might as well copy the null pointer along in the memcpy() rather than
copy everything up to the null pointer and then add one afterwards for
simplicity.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Commit 1e97b27873 ("ccache: support changing the output directory") added
the CCACHE_BASEDIR logic, but added a comment (presumably from cut'n'paste)
about compilercheck instead, fix that.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Glibc introduced LoongArch64 support in 2.36, it requires kernel
5.19 to build.
Unselect BR2_ARCH_HAS_NO_TOOLCHAIN_BUILDROOT to reflect we can
build the toolchain.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
The BR2_ARCH_NEEDS_GCC_AT_LEAST_X guards were added in commit [1]
for toolchain-external-custom gcc versions from 4.8 to 12. No guard
was added for gcc 13 because is was the latest version at that time
(and the symbol BR2_ARCH_NEEDS_GCC_AT_LEAST_14 was not available
at that time).
Then, commit [2] and [3] added gcc 14 and 15 without adding
guards.
In order to prevent a Buildroot user selecting an external custom
toolchain that does not support a selected CPU, this commit adds all
the missing guards.
[1] eed1670d8a
[2] 7fa12e4f9e
[3] 5f1a38a41f
Reported-by: Arnout Vandecappelle <arnout@rnout.be>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
This patch allows to use an external toolchain based on gcc 15.
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
[Julien: change spaces to tabs to fix check-package errors]
Signed-off-by: Julien Olivain <ju.o@free.fr>
Now that xilinx-embeddedsw is compatible with the toolchain vendor buildroot,
this patch modifies the toolchain-bare-metal-buildroot help example to use
the microblazeel-buildroot-elf tuple.
Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Release:
https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.5
Major Changes and Fixes:
-- CMake 3.20 minimum required
-- Issue encountered during standalone LLVM build:
CMake Error at CMakeLists.txt:8 (include):
include could not find requested file:
This error is due to the line:
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake)
Upstream commit [1] harmonized policy handling by introducing this shared include
for all LLVM sub-projects. However, in the LLVM CMakeLists, LLVM_COMMON_CMAKE_UTILS
is set unconditionally, preventing external override — which is required in
Buildroot when building from separated archives.
To solve this:
We apply a patch to wrap the assignment of LLVM_COMMON_CMAKE_UTILS in an
`if(NOT DEFINED ...)` block, allowing Buildroot to set the path externally.
In the `llvm-cmake` package, we also **adjust the installation path** of the
CMake modules: instead of installing directly into `lib/cmake/llvm`, we now
install them under `lib/cmake/llvm/Modules` to match the expected layout.
This ensures that:
LLVM can include `${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake`
without errors.
-- Also the Clang build system has removed support for
the GCC_INSTALL_PREFIX option, raising a fatal error when attempting to use it:
CMake Error at CMakeLists.txt:211 (message):
GCC_INSTALL_PREFIX is deprecated and will be removed.
Use configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files)
to specify the default --gcc-install-dir= or --gcc-triple=.
--gcc-toolchain= is discouraged.
See https://github.com/llvm/llvm-project/pull/77537
for details.
Remove the use of GCC_INSTALL_PREFIX and replace it with a
Clang configuration file as recommended by upstream.
A configuration file is now automatically generated at:
$(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/$(GNU_TARGET_NAME).cfg
It contains:
--gcc-install-dir=<path to external toolchain's lib/gcc/...>
--target=<GNU target triplet>
We dynamically detect the GCC install path by scanning
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/lib/gcc/<target>/<version>/
The Clang toolchain wrapper was also updated to add --config=<file> when
BR_CLANG_CONFIG_FILE is defined.
-- Fix LLVM_MAIN_SRC_DIR path:
set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH ...)
This path isn't correct when using standalone archive builds. We explicitly pass
LLVM_MAIN_SRC_DIR=$(BUILD_DIR)/llvm-$(LLVM_PROJECT_VERSION) to fix the path. [2]
-- Add LLVM_ENABLE_RUNTIMES:
Upstream added LLVM_ENABLE_RUNTIMES for runtimes [3]
-- Removed LLVM_INCLUDE_GO_TESTS:
Upstream dropped this option; we remove it too [4]
-- Disable TensorFlow Lite integration:
LLVM_HAVE_TFLITE is added to the CMakelist
We now explicitly disable it to avoid unexpected
TensorFlow Lite dependency.
-- Clang introduced CLANG_ENABLE_LIBXML2 [5]
We now explicitly disable it by setting CLANG_ENABLE_LIBXLM2=OFF
since we set LLVM_ENABLE_LIBXML2 to OFF in LLVM
-- Host-python3, which is now always needed by Clang’s resource bundling
script. [6]
-- Clang explicitly request to disable llvm tests when llvm_gtest is missing.[7]
CMake Error at CMakeLists.txt:126 (message):
llvm-gtest not found. Please install llvm-gtest or disable tests with
-DLLVM_INCLUDE_TESTS=OFF
-- Also update the installation path in COMPILER_RT_SETUP_RUNTIME_LIBS
to use CLANG_VERSION_MAJOR instead of HOST_CLANG_VERSION,
ensuring that the runtime files are placed correctly
in the /lib/clang/<major>/ folder. [8]
-- Add llvm-runtimes dependency
libunwind needs runtimes [9]
-- Fix for libclc out of tree patch
Due to upstream changes in libclc, the old patch no longer
applies. Only the fix related to invoking './prepare_builtins'
directly is still relevant and preserved, as it is required to avoid
a build failure when the binary is not in PATH.
-- Upstream commit [10] removed the use of llvm-config in libclc and
replaced it with proper use of LLVM_CMAKE_DIR. We now pass
-DLLVM_CMAKE_DIR instead of DLLVM_CONFIG
-- Libclc expects to invoke some LLVM tools. We explicitly set
LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR to ensure it finds these tools. [11]
-- Remove LLAsm_COMPILER and CLC_COMPILER [12]
-- LIBUNWIND_INSTALL_HEADERS is On by default [13]
-- Update spirv-llvm-translator to align with LLVM 20.1.5
Release:
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/releases/tag/v20.1.2
[1] 9dd01a5241
[2] d2b158e29e
[3] 176db3b3ab
[4] 6ce8727248
[5] df239a6c17
[6] 96962d5512
[7] 8216910395
[8] e1b88c8a09
[9] 0af67d167d
[10] b264787453
[11] 0aeeff3059
[12] 72f9881c3f
[13] f8409af354
Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr>
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
[Bernd: rebased, removed gcc-15 patches for llvm 15, bumped to 20.1.5]
used 'git describe' to set the version number for spirv-llvm-translator]
[Mehdi: changed llvm-runtimes version to $(LLVM_PROJECT_VERSION)]
Signed-off-by: Julien Olivain <ju.o@free.fr>
In order to add gcc 15 support in follow-up commits, introduce
BR2_TOOLCHAIN_GCC_AT_LEAST_15 symbol.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
We currently check for unsafe paths right between adding our arguments,
and adding the one passed from the command line. This not very
consistent.
Unsafe paths can only come from the command line, as we are not adding
any of our own (hopefully, we know better!), so we can run the check as
early as possible.
Move the check very early, but not before we handle --help.
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
The ARMV7-A toolchains are capable to compile binaries for ARMv8-A CPU
in AArch32 execution state.
This adds the BR2_ARM_CPU_ARMV8A option in the 'conditions' to allow
ARMV8-A CPU such as Cortex-A53 or Cortex-A72 to use ARMV7-A toolchains.
Signed-off-by: Gaël PORTAY <gael.portay+rtone@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Now that binutils-bare-metal, gcc-bare-metal and newlib-bare-metal packages
have been upgraded to support a list of architecture tuples, this patch
updates the toolchain-bare-metal-buildroot help text to describe the new
capability.
BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is still backwards compatible with
its prior definition as defining a single tuple with this new definition
works exactly the same as before.
Signed-off-by: Neal Frager <neal.frager@amd.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Fixes: https://gitlab.com/buildroot.org/buildroot/-/issues/55
When gcc sees a linker option (-Wl,..) it executes the linker, leading to
confusing error messages if no source files are provided, E.G.:
% gcc
gcc: fatal error: no input files
compilation terminated.
% gcc -Wl,-z,now
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
It is not really trivial to detect in the wrapper if linking will be done,
but we can at least check if any non-option arguments (E.G. source/object
files) are passed and skip the -Wl,.. options if not.
% ./host/bin/aarch64-linux-gcc
aarch64-linux-gcc.br_real: fatal error: no input files
compilation terminated.
With this fixed we no longer need the special case for --help -v from commit
9954315fc5 ("toolchain/toolchain-wrapper: make gcc --help -v work
correctly"), so drop that.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
We are going to remove nios2 support, so remove the Bootlin nios2
external toolchain.
Remove this toolchain from the Buildroot testsuite.
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
BR2_ARCH_NEEDS_GCC_AT_LEAST_X guards has been introduced by [1] to
prevent selecting an external toolchain that did not support the GCC
arch tuning the user had selected.
But it was not changed while updating to version 13.2-rel1.
Fixes: 50ae5ea963
[1] eed1670d8a
Cc: Antoine Coutant <antoine.coutant@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
BR2_ARCH_NEEDS_GCC_AT_LEAST_X guards has been introduced by [1] to
prevent selecting an external toolchain that did not support the GCC
arch tuning the user had selected.
But it was not changed while updating to version 13.2-rel1.
Fixes: 7b4b3c2c78
[1] eed1670d8a
Cc: Antoine Coutant <antoine.coutant@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
BR2_ARCH_NEEDS_GCC_AT_LEAST_X guards has been introduced by [1] to
prevent selecting an external toolchain that did not support the GCC
arch tuning the user had selected.
But it was not updated while updating to version 13.2-rel1.
Fixes: 0dd599d171
[1] eed1670d8a
Cc: Antoine Coutant <antoine.coutant@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
The ARC toolchains from Synopsys unfortunately are not "pure"
toolchains: their sysroot no only contains the C library, but also
additional libraries, most notably libncurses and libexpat.
This confuses Buildroot, and causes build issues, and is anyway not a
supported situation. Until the toolchains get fixed, let's mark them
as broken.
Fixes:
http://autobuild.buildroot.net/results/38766332c391ce97a566c6e2255a947e6074152b/
(and possibly a number of others)
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
The option BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC just depends on
BR2_arc, but the choice of toolchains that appears once
BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC=y only has choices for:
depends on BR2_arc750d || BR2_arc770d
and
depends on BR2_archs38_64mpy || BR2_archs38_full || \
BR2_archs4x_rel31 || BR2_archs4x
which means that if you have a BR2_archs38=y configuration, you end up
with no choice of toolchain, and the build fails with "No C library
selected". Fix this by making sure BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC
can only be selected when an actual toolchain is available.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
With the introduction of ARM FDPIC support, we need to make sure that
the existing ARM FLAT external toolchains are not made
visible/available when ARM FDPIC is selected. This commit updates the
gen-bootlin-toolchains script to take this into account.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Until now only one option was shown, and we were automatically
selecting the ARC700/ARChs and LE/BE toolchains based on the
architecture selection. However now, Synopsys offers glibc/uClibc
toolchains, and we can't decide that automatically, so let's add an
explicit choice for the user to chose between the different variants
of Synopsys toolchains available.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[yann.morin.1998@free.fr: fix glibc toolchain prompt to mention ARC HS]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
similar to previous problems with nios2 and not-available atomic ints
the build for Boost.Atomics also fails for ARC Targets which don't
have the ATOMICS_EXT flag set.
according to [0] "Boost.Atomic has a hard requirement of the native
atomic operations on bytes". The same tests mentioned there fail for
ARC without the atomic extension.
Disable BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS for BR2_arc
without BR2_ARC_ATOMIC_EXT.
Fixes:
http://autobuild.buildroot.net/results/4ca54a85672d7b9328b1909b457e548c6032a493
[0] https://github.com/boostorg/atomic/issues/42#issuecomment-734130348
Signed-off-by: Michael Nosthoff <buildroot@heine.tech>
[Arnout: add to BR2_TOOLCHAIN_SUPPORTS_ALWAYS_LOCKFREE_ATOMIC_INTS
instead of updating all packages]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
In order to add gcc 14 support in follow-up commits, introduce
BR2_TOOLCHAIN_GCC_AT_LEAST_13 symbol.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This toolchain is pretty old and unlikely used. It's also affected by
binutils bug 27597, so let's remove it.
Remove BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII from pixman package.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
[Romain: remove BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Note: this commit only deals with glibc and its internal libcrypt (or
lack thereof); other C libraries, musl and uClibc-NG, are not considered.
libcrypt from glibc has been deprecated for a long time, and it has now
been entirely dropped with glibc 2.39. Now, packages that need crypt(3)
features need to explicitly depend on the libxcrypt pacakge.
However, the set of files installed both by glibc and libxcrypt is not
empty:
glibc libxcrypt
/usr/include/crypt.h /usr/include/crypt.h
/usr/lib/libcrypt.a /usr/lib/libcrypt.a
/usr/lib/libcrypt.so /usr/lib/libcrypt.so
/lib/libcrypt.so.1
/lib/libcrypt-2.23.so
/usr/lib/libcrypt.so.2
The two libraries have different SO_NAME, so they do not conflict on the
library filename. However, the .so synlink is present in both, and thus
conflicts. The header and the static library also conflict.
So, the situation is that, with a glibc 2.39 or later, packages have to
use libxcrypt, which is a drop-in replacement. With glibc 2.38 or
earlier, they can use either.
Since we already bumped to glibc 2.39 for the internal toolchain, we
have already converted quite a few packages to use libxcrypt. That works
well with an internl toolchain, because glibc does not install the
conflicting files.
However, for external toolchains, we may very well end up in three
situations:
- a glibc 2.39 or later, without libcrypt
- a glibc 2.39 or later, without libcrypt, but with libxcrypt [0]
- a glibc 2.38 or earlier with libcrypt
In the first case, all is OK and we are in a situation similar to the
internal toolchain, but in the latter two cases, we end up with a
conflict.
We could introduce BR2_TOOLCHAIN_EXTERNAL_HAS_LIBCRYPT os something
along those lines, but this is going to be a bit complex on packages,
which would have to select LIBXCRYPT if GLIBC && !_HAS_LIBCRYPT.
So, to simplify things, we want to get the external toolchains into a
situation similar to the internal one, where libcrypt is not provided by
the toolchain; packages have to select libxcrypt for glibc toolchains,
without having to care whether this is an internal or external toolchain
or some more complex conditions.
So, we remove from staging whatever could be used to compile and link
with libcrypt. We however keep the SO_NAME file, if it exists, and we
also install it in target/, for those pre-built binaries that may be
linked with it [1]. The glibc SO_NAME has always been libcrypt.so.1, so
this is what we copy exactly, to avoid copying the libxcrypt one, which
is libcrypt.so.2.
[0] that could happen if a toolchain provider tried to be helpful and
suplies a toolchain with libxcrypt to be trasnparent to users, in which
case that would conflict with ours...
[1] if such a prebuilt binary (executable or library) is used with a
glibc 2.39 or later toolchain, it will obviously not work at all.
libxcrypt is supposed to be a drop-in replacement for glibc's libcrypt,
so we could look into symlinking libcrypt.so.1 to libcrypt.so.2. In a
later patch, maybe...
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>