Merge changes from topic "hm/make-refactor" into integration

* changes:
  docs(prerequisites): use LLVM utilities to build with clang
  build(make): use clang binutils to compile
This commit is contained in:
Manish Pandey 2022-05-04 14:17:38 +02:00 committed by TrustedFirmware Code Review
commit b7bd9863dc
3 changed files with 33 additions and 33 deletions

View file

@ -263,24 +263,24 @@ ENABLE_FEAT_RNG = $(if $(findstring rng,${arch-features}),1,0)
# Determine if FEAT_SB is supported # Determine if FEAT_SB is supported
ENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0) ENABLE_FEAT_SB = $(if $(findstring sb,${arch-features}),1,0)
ifneq ($(findstring armclang,$(notdir $(CC))),) ifneq ($(findstring clang,$(notdir $(CC))),)
TF_CFLAGS_aarch32 = -target arm-arm-none-eabi $(march32-directive) ifneq ($(findstring armclang,$(notdir $(CC))),)
TF_CFLAGS_aarch64 = -target aarch64-arm-none-eabi $(march64-directive) TF_CFLAGS_aarch32 := -target arm-arm-none-eabi $(march32-directive)
LD = $(LINKER) TF_CFLAGS_aarch64 := -target aarch64-arm-none-eabi $(march64-directive)
AS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) LD := $(LINKER)
CPP = $(CC) -E $(TF_CFLAGS_$(ARCH)) else
PP = $(CC) -E $(TF_CFLAGS_$(ARCH)) TF_CFLAGS_aarch32 := $(target32-directive) $(march32-directive)
else ifneq ($(findstring clang,$(notdir $(CC))),) TF_CFLAGS_aarch64 := -target aarch64-elf $(march64-directive)
CLANG_CCDIR = $(if $(filter-out ./,$(dir $(CC))),$(dir $(CC)),) LD := $(shell $(CC) --print-prog-name ld.lld)
TF_CFLAGS_aarch32 = $(target32-directive) $(march32-directive)
TF_CFLAGS_aarch64 = -target aarch64-elf $(march64-directive) AR := $(shell $(CC) --print-prog-name llvm-ar)
LD = $(CLANG_CCDIR)ld.lld OD := $(shell $(CC) --print-prog-name llvm-objdump)
ifeq (, $(shell which $(LD))) OC := $(shell $(CC) --print-prog-name llvm-objcopy)
$(error "No $(LD) in PATH, make sure it is installed or set LD to a different linker") endif
endif
AS = $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH)) CPP := $(CC) -E $(TF_CFLAGS_$(ARCH))
CPP = $(CC) -E PP := $(CC) -E $(TF_CFLAGS_$(ARCH))
PP = $(CC) -E AS := $(CC) -c -x assembler-with-cpp $(TF_CFLAGS_$(ARCH))
else ifneq ($(findstring gcc,$(notdir $(CC))),) else ifneq ($(findstring gcc,$(notdir $(CC))),)
TF_CFLAGS_aarch32 = $(march32-directive) TF_CFLAGS_aarch32 = $(march32-directive)
TF_CFLAGS_aarch64 = $(march64-directive) TF_CFLAGS_aarch64 = $(march64-directive)

View file

@ -18,16 +18,12 @@ Performing an Initial Build
It is possible to build TF-A using Clang or Arm Compiler 6. To do so It is possible to build TF-A using Clang or Arm Compiler 6. To do so
``CC`` needs to point to the clang or armclang binary, which will ``CC`` needs to point to the clang or armclang binary, which will
also select the clang or armclang assembler. Be aware that for Arm Compiler, also select the clang or armclang assembler. Arm Compiler 6 will be selected
the GNU linker is used by default. However for Clang LLVM linker (LLD) when the base name of the path assigned to ``CC`` matches the string
is used by default. In case of being needed the linker can be overridden 'armclang'. GNU binutils are required since the TF-A build system doesn't
using the ``LD`` variable. LLVM linker (LLD) version 9 is currently support Arm Scatter files. Meaning the GNU linker is used by
known to work with TF-A. default for Arm Compiler 6. Because of this dependency, ``CROSS_COMPILE``
should be set as described above.
In both cases ``CROSS_COMPILE`` should be set as described above.
Arm Compiler 6 will be selected when the base name of the path assigned
to ``CC`` matches the string 'armclang'.
For AArch64 using Arm Compiler 6: For AArch64 using Arm Compiler 6:
@ -36,6 +32,11 @@ Performing an Initial Build
export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf- export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all make CC=<path-to-armclang>/bin/armclang PLAT=<platform> all
On the other hand, Clang uses LLVM linker (LLD) and other LLVM binutils by
default instead of GNU utilities (LLVM linker (LLD) 14.0.0 is known to
work with TF-A). ``CROSS_COMPILE`` need not be set for Clang. Please note,
that the default linker may be manually overridden using the ``LD`` variable.
Clang will be selected when the base name of the path assigned to ``CC`` Clang will be selected when the base name of the path assigned to ``CC``
contains the string 'clang'. This is to allow both clang and clang-X.Y contains the string 'clang'. This is to allow both clang and clang-X.Y
to work. to work.
@ -44,7 +45,6 @@ Performing an Initial Build
.. code:: shell .. code:: shell
export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-none-elf-
make CC=<path-to-clang>/bin/clang PLAT=<platform> all make CC=<path-to-clang>/bin/clang PLAT=<platform> all
- Change to the root directory of the TF-A source tree and build. - Change to the root directory of the TF-A source tree and build.
@ -115,4 +115,4 @@ Performing an Initial Build
-------------- --------------
*Copyright (c) 2020, Arm Limited. All rights reserved.* *Copyright (c) 2020-2022, Arm Limited. All rights reserved.*

View file

@ -27,8 +27,8 @@ Toolchain
target the Armv7-A or Armv8-A architectures: target the Armv7-A or Armv8-A architectures:
- GCC >= 11.2-2022.02 (from the `Arm Developer website`_) - GCC >= 11.2-2022.02 (from the `Arm Developer website`_)
- Clang >= 4.0 - Clang >= 14.0.0
- Arm Compiler >= 6.0 - Arm Compiler >= 6.18
In addition, a native compiler is required to build the supporting tools. In addition, a native compiler is required to build the supporting tools.
@ -160,7 +160,7 @@ documentation, available `here <https://git-scm.com/docs/githooks>`_.
-------------- --------------
*Copyright (c) 2021, Arm Limited. All rights reserved.* *Copyright (c) 2021-2022, Arm Limited. All rights reserved.*
.. _Arm Developer website: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads .. _Arm Developer website: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads
.. _Gerrit Code Review: https://www.gerritcodereview.com/ .. _Gerrit Code Review: https://www.gerritcodereview.com/