diff mbox series

dtoc: Allow overriding cc with $CC

Message ID 20210607094804.1.I0c040ab195ac33d48fe03ebed67fbd8c424334c2@changeid
State Rejected
Delegated to: Simon Glass
Headers show
Series dtoc: Allow overriding cc with $CC | expand

Commit Message

Simon Glass June 7, 2021, 3:48 p.m. UTC
From: Patrick Georgi <pgeorgi@google.com>

The Chromium OS build system isn't particularly happy about using cc
directly and fails the build when doing so.

Update it to allow overriding this.

Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/dtoc/fdt_util.py | 1 +
 1 file changed, 1 insertion(+)

Comments

Alper Nebi Yasak June 7, 2021, 6:08 p.m. UTC | #1
On 07/06/2021 18:48, Simon Glass wrote:
> From: Patrick Georgi <pgeorgi@google.com>
> 
> The Chromium OS build system isn't particularly happy about using cc
> directly and fails the build when doing so.
> 
> Update it to allow overriding this.
> 
> Signed-off-by: Patrick Georgi <pgeorgi@google.com>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  tools/dtoc/fdt_util.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
> index 37e96b98642..34e1844ff18 100644
> --- a/tools/dtoc/fdt_util.py
> +++ b/tools/dtoc/fdt_util.py
> @@ -74,6 +74,7 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False):

Some important diff context:

       cc, args = tools.GetTargetCompileTool('cc')
       [...]
>      for path in search_paths:
>          args.extend(['-I', path])
>      args += ['-o', dts_input, fname]
> +    cc = os.environ.get('CC') or 'cc'
>      command.Run(cc, *args)

Since commit 1e4687aa47ed ("binman: Use target-specific tools when
cross-compiling") this should already be using the value from the CC
environment variable, handled in GetTargetCompileTool call above.

In fact, it should have been defaulting to "gcc" with no environment
variables set, but it doesn't do that. I'll send a patch.

>  
>      # If we don't have a directory, put it in the tools tempdir
>
diff mbox series

Patch

diff --git a/tools/dtoc/fdt_util.py b/tools/dtoc/fdt_util.py
index 37e96b98642..34e1844ff18 100644
--- a/tools/dtoc/fdt_util.py
+++ b/tools/dtoc/fdt_util.py
@@ -74,6 +74,7 @@  def EnsureCompiled(fname, tmpdir=None, capture_stderr=False):
     for path in search_paths:
         args.extend(['-I', path])
     args += ['-o', dts_input, fname]
+    cc = os.environ.get('CC') or 'cc'
     command.Run(cc, *args)
 
     # If we don't have a directory, put it in the tools tempdir