| #
c879bd89 |
| 24-Feb-2025 |
Casey Connolly <casey.connolly@linaro.org> |
build: support building on ARM64 host
On ARM64 hosts we don't want to set CROSS_COMPILE when building for arm64. Don't set a fallback value in this case.
Signed-off-by: Casey Connolly <casey.connol
build: support building on ARM64 host
On ARM64 hosts we don't want to set CROSS_COMPILE when building for arm64. Don't set a fallback value in this case.
Signed-off-by: Casey Connolly <casey.connolly@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| #
3d5c2dd8 |
| 28-Apr-2025 |
Jerome Forissier <jerome.forissier@linaro.org> |
clang: do not link against the compiler's compiler-rt library
Since commit 45fecab08117 ("Deprecate libgcc for OP-TEE core and ldelf") libgcc is not needed to link the TEE core and ldelf. Therefore,
clang: do not link against the compiler's compiler-rt library
Since commit 45fecab08117 ("Deprecate libgcc for OP-TEE core and ldelf") libgcc is not needed to link the TEE core and ldelf. Therefore, its Clang counterpart (compiler-rt) is not needed anymore either. Note that C++ in TAs has never been supported with Clang, therefore there is nothing to worry about in this regard (while we still have CFG_TA_LIBGCC for GCC).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
96c162c8 |
| 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
mk/clang.mk: -Wno-gnu-alignof-expression
Add -Wno-gnu-alignof-expression to the warnings flag for Clang in order to avoid warnings like: '_Alignof' applied to an expression is a GNU extension [-Werr
mk/clang.mk: -Wno-gnu-alignof-expression
Add -Wno-gnu-alignof-expression to the warnings flag for Clang in order to avoid warnings like: '_Alignof' applied to an expression is a GNU extension [-Werror,-Wgnu-alignof-expression] when alignof() is applied on an expression like dereferencing a pointer to get the alignment of type.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
71f2c921 |
| 16-Aug-2022 |
Jerome Forissier <jerome.forissier@linaro.org> |
clang.mk: fix build on AArch64 host
When building on an AArch64 host and using OP-TEE's build.git [1], the AArch64 cross compiler prefix is "aarch64-linux-" instead of the usual "aarch64-linux-gnu-"
clang.mk: fix build on AArch64 host
When building on an AArch64 host and using OP-TEE's build.git [1], the AArch64 cross compiler prefix is "aarch64-linux-" instead of the usual "aarch64-linux-gnu-". This happens due to [2]. Clang still expects --target=aarch64-linux-gnu so for convenience map the prefix accordingly in mk/clang.mk.
Link: [1] https://github.com/OP-TEE/build.git Link: [2] https://github.com/OP-TEE/build/blob/3.18.0/toolchain.mk#L97 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
d9321934 |
| 01-Apr-2022 |
Andrii Chepurnyi <andrii_chepurnyi@epam.com> |
Introduce OPTEE_CLANG_COMPILER_PATH variable
AOSP comes with several prebuilt clang versions. Introduce OPTEE_CLANG_COMPILER_PATH variable to be able to chose exact clang toolchain.
Acked-by: Jerom
Introduce OPTEE_CLANG_COMPILER_PATH variable
AOSP comes with several prebuilt clang versions. Introduce OPTEE_CLANG_COMPILER_PATH variable to be able to chose exact clang toolchain.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
show more ...
|
| #
be3bc461 |
| 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: experimental C++ support
Update the TA makefiles to support C++ (file extension: .cpp).
This allows the use of C++ in TA and libraries, with limitations (see below). I consider this work experi
ta: experimental C++ support
Update the TA makefiles to support C++ (file extension: .cpp).
This allows the use of C++ in TA and libraries, with limitations (see below). I consider this work experimental because it was only tested with simple cases in xtest, introducing the required changes and addressing issues one after another. Therefore, some features may be missing for more complex use cases (additional relocation types or runtime support...).
Tested with the arm-linux-gnueabihf- and aarch64-linux-gnu- toolchains (GCC 8.3).
Limitations:
- Clang is not supported at the moment - Exception handling: shared libraries cannot throw, catch or propagate exceptions. Doing so would require linking the libraries and the main program with the shared libgcc [1] which is not straightforward due to the many dependencies on the GNU libc. Exceptions *can* be used in the main program however, as well as in static libraries directly linked with the main program. - ldelf stack unwinding does not support C++ frames so crash/panic dumps will likely be truncated when they involve C++ code.
Link: [1] https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html see "-shared-libgcc" Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, QEMUv8, HiKey960) Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
9e4ebcdc |
| 26-May-2020 |
Jerome Forissier <jerome@forissier.org> |
Cleanup unused comp-cflags$(sm) from libgcc lookup commands
The compiler is not expected to need any flag from $(comp-cflags$(sm)) to locate the compiler runtime libraries, and in fact this variable
Cleanup unused comp-cflags$(sm) from libgcc lookup commands
The compiler is not expected to need any flag from $(comp-cflags$(sm)) to locate the compiler runtime libraries, and in fact this variable is always undefined at the point it is used. Indeed, comp-cflags$(sm) is set in mk/compile.mk, i.e., after mk/gcc.mk (or mk/clang.mk) has been included.
Therefore, remove the useless flags.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
16013599 |
| 07-May-2020 |
Victor Chong <victor.chong@linaro.org> |
clang.mk: use the compiler-rt runtime instead of libgcc
Add the `-rtlib` option to `clang -print-libgcc-file-name` so that the compiler-rt runtime is used instead of libgcc, as the AOSP (also any ot
clang.mk: use the compiler-rt runtime instead of libgcc
Add the `-rtlib` option to `clang -print-libgcc-file-name` so that the compiler-rt runtime is used instead of libgcc, as the AOSP (also any other Clang-only) build environment comes with compiler-rt but not libgcc.
Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (QEMUv8, Clang 9.0.1)
show more ...
|
| #
8731e19c |
| 24-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
core: clang: pager: use the normal linker (ld.lld)
Since LLVM commit [1] ("[ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand"), ld.lld behaves like GNU ld rega
core: clang: pager: use the normal linker (ld.lld)
Since LLVM commit [1] ("[ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand"), ld.lld behaves like GNU ld regarding output section names. So, we can remove our temporary hack.
This also fixes a build issue when a newer Clang (v11 master) is used together with an older GNU ld (8.3 for instance) due to the latter not supporting some GNU_PROPERTY_* values generated by the Clang compiler:
LD out/arm/core/tee.elf bin/aarch64-linux-gnu-ld: warning: out/arm/core/ta_pub_key.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000 ...
Link: [1] https://github.com/llvm/llvm-project/commit/9e33c096476a Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
b77aa8a0 |
| 24-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
core: clang: add --apply-dynamic-relocs linker flag
Core ASLR relies on the executable being ready to run from its preferred load address, because some symbols are used before the MMU is enabled and
core: clang: add --apply-dynamic-relocs linker flag
Core ASLR relies on the executable being ready to run from its preferred load address, because some symbols are used before the MMU is enabled and relocations are applied. Clang (ld.lld) on Aarch64 needs a special flag for this: --apply-dynamic-relocs. Without the flag the R_AARCH64_RELATIVE places are initially filled with zeros.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
c12b5608 |
| 21-Apr-2020 |
Victor Chong <victor.chong@linaro.org> |
mk: clang.mk: use 'clang -E' instead of clang-cpp
AOSP's prebuilt versions of Clang [1] don't contain the clang-cpp symlink to clang, so use the equivalent command of 'clang -E' instead.
LINK: [1]
mk: clang.mk: use 'clang -E' instead of clang-cpp
AOSP's prebuilt versions of Clang [1] don't contain the clang-cpp symlink to clang, so use the equivalent command of 'clang -E' instead.
LINK: [1] https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/heads/master LINK: [2] https://github.com/llvm/llvm-project/tree/llvmorg-9.0.1 LINK: [3] https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86/+/refs/heads/master/clang-r370808/bin/clang
Suggested by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Victor Chong <victor.chong@linaro.org> Tested-by: Victor Chong <victor.chong@linaro.org> (builds only with clang-v9.0.1 [2] and AOSP clang v10.0.1 [3]) Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
8287cbcf |
| 20-Apr-2020 |
Jerome Forissier <jerome@forissier.org> |
mk/clang.mk: define libgcc$(sm)
Adds missing definition for libgcc$(sm) (the compiler runtime library) to mk/clang.mk.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklande
mk/clang.mk: define libgcc$(sm)
Adds missing definition for libgcc$(sm) (the compiler runtime library) to mk/clang.mk.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
787d2737 |
| 21-Feb-2020 |
Jerome Forissier <jerome@forissier.org> |
clang: use llvm-objdump
Clang version 9.0.0 has a llvm-objdump tool that provides equivalent output to the binutils version. Let's use it and remove the hack in mk/clang.mk.
With this, it is possib
clang: use llvm-objdump
Clang version 9.0.0 has a llvm-objdump tool that provides equivalent output to the binutils version. Let's use it and remove the hack in mk/clang.mk.
With this, it is possible to build OP-TEE with Clang and without a GCC toolchain.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| #
33017d85 |
| 22-Nov-2019 |
Jerome Forissier <jerome@forissier.org> |
Remove script/llvm-objcopy-wrapper
The llvm-objcopy-wrapper script was introduced in commit 98d863a5c0b2 ("Experimental Clang support") because llvm-objcopy would not support some options needed to
Remove script/llvm-objcopy-wrapper
The llvm-objcopy-wrapper script was introduced in commit 98d863a5c0b2 ("Experimental Clang support") because llvm-objcopy would not support some options needed to produce the final TEE binaries from tee.elf or cause errors when building them. However, since commit 1a9edabc0ed4 ("core: link.mk: use gen_tee_bin.py"), objcopy is not used for this purpose anymore. Thus we can safely use llvm-objcopy.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
38f4260c |
| 17-Sep-2019 |
Jerome Forissier <jerome@forissier.org> |
TA dev kit: Clang support
Updates ta/mk/ta_dev_kit.mk and other makefiles so that the COMPILER variable can be used when building TAs: make COMPILER=clang ...
Signed-off-by: Jerome Forissier <jerom
TA dev kit: Clang support
Updates ta/mk/ta_dev_kit.mk and other makefiles so that the COMPILER variable can be used when building TAs: make COMPILER=clang ...
Signed-off-by: Jerome Forissier <jerome@forissier.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
98d863a5 |
| 05-Jul-2019 |
Jerome Forissier <jerome@forissier.org> |
Experimental Clang support
Allows building with Clang with "make COMPILER=clang [other flags...]". The clang command has to be in the $PATH, as well as the associated tools (clang-cpp, ld.lld, llvm-
Experimental Clang support
Allows building with Clang with "make COMPILER=clang [other flags...]". The clang command has to be in the $PATH, as well as the associated tools (clang-cpp, ld.lld, llvm-ar, llvm-nm, llvm-objcopy and llvm-readelf).
Tested with Clang built from the master branch of [1] (development version for 9.0):
mkdir build; cd build cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=~/llvm-install \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_TARGETS_TO_BUILD="AArch64;ARM" \ ~/llvm-project/llvm ninja && ninja install
Limitations:
- CFG_CORE_SANITIZE_KADDRESS=y is not supported. - CFG_WITH_PAGER is supported, but requires that the TEE core be linked with the GNU linker. The reason is documented in mk/clang.mk.
Bug:
- ldelf assertion failure in xtest 1019 when CFG_ULIBS_SHARED=y (QEMU) E/LD: assertion 'maps[map_idx].sz == sz' failed at ldelf/ta_elf.c:1114 in ta_elf_print_mappings() Prevents ldelf from displaying the TA mappings on abort or panic, but does not seem to cause any other problem.
Link: [1] https://github.com/llvm/llvm-project/commits/8351c327647 Signed-off-by: Jerome Forissier <jerome@forissier.org> Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU pager/no pager) Tested-by: Jerome Forissier <jerome@forissier.org> (QEMUv8, pager/no pager) Tested-by: Jerome Forissier <jerome@forissier.org> (HiKey960, 32/64, GP) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|