diff mbox series

[9/9] doc: clang: Update and correct support notes

Message ID 20230405234859.1446811-10-trini@konsulko.com
State Changes Requested, archived
Delegated to: Heinrich Schuchardt
Headers show
Series Update clang support for ARM | expand

Commit Message

Tom Rini April 5, 2023, 11:48 p.m. UTC
At this point, clang can be used on both 32bit and 64bit targets without
issue.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 doc/build/clang.rst | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Simon Glass April 7, 2023, 5:31 a.m. UTC | #1
On Thu, 6 Apr 2023 at 11:51, Tom Rini <trini@konsulko.com> wrote:
>
> At this point, clang can be used on both 32bit and 64bit targets without
> issue.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> ---
>  doc/build/clang.rst | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt Nov. 21, 2023, 1:26 p.m. UTC | #2
On 4/6/23 01:48, Tom Rini wrote:
> At this point, clang can be used on both 32bit and 64bit targets without
> issue.
>
> Signed-off-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
>   doc/build/clang.rst | 16 ++++------------
>   1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/doc/build/clang.rst b/doc/build/clang.rst
> index 1d35616eb5ef..222487032ce0 100644
> --- a/doc/build/clang.rst
> +++ b/doc/build/clang.rst
> @@ -11,14 +11,6 @@ The ARM backend can be instructed not to use the r9 and x18 registers using
>   supported inline assembly is needed to get and set the r9 or x18 value. This
>   leads to larger code then strictly necessary, but at least works.
>
> -**NOTE:** target compilation only work for _some_ ARM boards at the moment.
> -Also AArch64 is not supported currently due to a lack of private libgcc
> -support. Boards which reassign gd in c will also fail to compile, but there is
> -in no strict reason to do so in the ARM world, since crt0.S takes care of this.
> -These assignments can be avoided by changing the init calls but this is not in
> -mainline yet.
> -
> -
>   Debian based
>   ------------
>
> @@ -28,14 +20,14 @@ Required packages can be installed via apt, e.g.
>
>       sudo apt-get install clang
>
> -Note that we still use binutils for some tools so we must continue to set
> -CROSS_COMPILE. To compile U-Boot with Clang on Linux without IAS use e.g.
> +Note that we make use of the CROSS_COMPILE variable to determine what to tell
> +clang to use as the build target.
> +To compile U-Boot with Clang on Linux without IAS use e.g.

I had a hard time understanding this text block.

Do you mean:

"We use of the CROSS_COMPILE variable to derive the build target which
is passed as -target parameter to clang.

The CROSS_COMPILE variable further determines the paths to other build
tools. As assembler we use the binary pointed to by '$(CROSS_COMPILE)as'
instead of the LLVM integrated assembler (IAS).

Here is an example demonstrating building U-Boot for the Raspberry Pi 2
using clang:"

Best regards

Heinrich

>
>   .. code-block:: bash
>
>       make HOSTCC=clang rpi_2_defconfig
> -    make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
> -         CC="clang -target arm-linux-gnueabi" -j8
> +    make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- CC=clang -j8
>
>   It can also be used to compile sandbox:
>
Tom Rini Nov. 21, 2023, 1:40 p.m. UTC | #3
On Tue, Nov 21, 2023 at 02:26:14PM +0100, Heinrich Schuchardt wrote:
> On 4/6/23 01:48, Tom Rini wrote:
> > At this point, clang can be used on both 32bit and 64bit targets without
> > issue.
> > 
> > Signed-off-by: Tom Rini <trini@konsulko.com>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > ---
> >   doc/build/clang.rst | 16 ++++------------
> >   1 file changed, 4 insertions(+), 12 deletions(-)
> > 
> > diff --git a/doc/build/clang.rst b/doc/build/clang.rst
> > index 1d35616eb5ef..222487032ce0 100644
> > --- a/doc/build/clang.rst
> > +++ b/doc/build/clang.rst
> > @@ -11,14 +11,6 @@ The ARM backend can be instructed not to use the r9 and x18 registers using
> >   supported inline assembly is needed to get and set the r9 or x18 value. This
> >   leads to larger code then strictly necessary, but at least works.
> > 
> > -**NOTE:** target compilation only work for _some_ ARM boards at the moment.
> > -Also AArch64 is not supported currently due to a lack of private libgcc
> > -support. Boards which reassign gd in c will also fail to compile, but there is
> > -in no strict reason to do so in the ARM world, since crt0.S takes care of this.
> > -These assignments can be avoided by changing the init calls but this is not in
> > -mainline yet.
> > -
> > -
> >   Debian based
> >   ------------
> > 
> > @@ -28,14 +20,14 @@ Required packages can be installed via apt, e.g.
> > 
> >       sudo apt-get install clang
> > 
> > -Note that we still use binutils for some tools so we must continue to set
> > -CROSS_COMPILE. To compile U-Boot with Clang on Linux without IAS use e.g.
> > +Note that we make use of the CROSS_COMPILE variable to determine what to tell
> > +clang to use as the build target.
> > +To compile U-Boot with Clang on Linux without IAS use e.g.
> 
> I had a hard time understanding this text block.

Note that the logic in question (from the top-level Makefile) is:
ifeq ($(cc-name),clang)
ifneq ($(CROSS_COMPILE),)
CLANG_TARGET    := --target=$(notdir $(CROSS_COMPILE:%-=%))
...

So yes, "make CROSS_COMPILE=arm-linux-gnueabi- CC=clang" should in turn
invoke "clang --target=arm-linux-gnueabi".

> Do you mean:
> 
> "We use of the CROSS_COMPILE variable to derive the build target which
> is passed as -target parameter to clang.
> 
> The CROSS_COMPILE variable further determines the paths to other build
> tools. As assembler we use the binary pointed to by '$(CROSS_COMPILE)as'
> instead of the LLVM integrated assembler (IAS).
> 
> Here is an example demonstrating building U-Boot for the Raspberry Pi 2
> using clang:"

That is clearer, yes, thanks. And then I see my example needs fixing
again too. I'll v2 this patch at some point soon, thanks.
diff mbox series

Patch

diff --git a/doc/build/clang.rst b/doc/build/clang.rst
index 1d35616eb5ef..222487032ce0 100644
--- a/doc/build/clang.rst
+++ b/doc/build/clang.rst
@@ -11,14 +11,6 @@  The ARM backend can be instructed not to use the r9 and x18 registers using
 supported inline assembly is needed to get and set the r9 or x18 value. This
 leads to larger code then strictly necessary, but at least works.
 
-**NOTE:** target compilation only work for _some_ ARM boards at the moment.
-Also AArch64 is not supported currently due to a lack of private libgcc
-support. Boards which reassign gd in c will also fail to compile, but there is
-in no strict reason to do so in the ARM world, since crt0.S takes care of this.
-These assignments can be avoided by changing the init calls but this is not in
-mainline yet.
-
-
 Debian based
 ------------
 
@@ -28,14 +20,14 @@  Required packages can be installed via apt, e.g.
 
     sudo apt-get install clang
 
-Note that we still use binutils for some tools so we must continue to set
-CROSS_COMPILE. To compile U-Boot with Clang on Linux without IAS use e.g.
+Note that we make use of the CROSS_COMPILE variable to determine what to tell
+clang to use as the build target.
+To compile U-Boot with Clang on Linux without IAS use e.g.
 
 .. code-block:: bash
 
     make HOSTCC=clang rpi_2_defconfig
-    make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- \
-         CC="clang -target arm-linux-gnueabi" -j8
+    make HOSTCC=clang CROSS_COMPILE=arm-linux-gnueabi- CC=clang -j8
 
 It can also be used to compile sandbox: