U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance
@ 2014-03-05  7:59 Masahiro Yamada
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Masahiro Yamada @ 2014-03-05  7:59 UTC (permalink / raw)
  To: u-boot

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

1/4 through 3/4 are preparation for 4/4.

4/4 is what we really want to do.
By applying it, I think Kbuild will get much faster.

I confirmed this series can apply on commit 32907339.


Masahiro Yamada (4):
  kbuild,blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
  kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
  config.mk: specify the exact path to standalone linker script
  kbuild: improve Kbuild speed

 Makefile                                | 13 +++++++------
 arch/arm/cpu/arm720t/tegra114/config.mk | 19 -------------------
 arch/arm/cpu/arm720t/tegra124/config.mk |  7 -------
 arch/arm/cpu/arm720t/tegra20/config.mk  | 10 ----------
 arch/arm/cpu/arm720t/tegra30/config.mk  | 19 -------------------
 arch/arm/lib/Makefile                   | 13 ++-----------
 arch/blackfin/config.mk                 |  1 +
 arch/mips/cpu/mips32/config.mk          |  3 ++-
 arch/mips/cpu/mips64/config.mk          |  3 ++-
 arch/mips/cpu/xburst/config.mk          |  3 ++-
 arch/mips/lib/Makefile                  |  7 +------
 arch/nds32/config.mk                    |  3 ++-
 arch/powerpc/lib/Makefile               |  6 +-----
 arch/sh/lib/Makefile                    | 14 ++------------
 arch/sparc/config.mk                    |  4 +++-
 arch/x86/config.mk                      |  2 +-
 board/bct-brettl2/config.mk             | 13 -------------
 board/bf518f-ezbrd/config.mk            | 13 -------------
 board/bf526-ezbrd/config.mk             | 13 -------------
 board/bf527-ad7160-eval/config.mk       | 13 -------------
 board/bf527-ezkit/config.mk             | 13 -------------
 board/bf527-sdp/config.mk               |  5 -----
 board/bf533-ezkit/config.mk             |  5 -----
 board/bf533-stamp/config.mk             |  5 -----
 board/bf537-stamp/config.mk             |  5 -----
 board/bf538f-ezkit/config.mk            |  5 -----
 board/bf548-ezkit/config.mk             |  5 -----
 board/bf561-acvilon/config.mk           |  5 -----
 board/bf561-ezkit/config.mk             |  5 -----
 board/br4/config.mk                     | 15 ---------------
 board/cm-bf527/config.mk                | 13 -------------
 board/cm-bf533/config.mk                |  5 -----
 board/cm-bf537e/config.mk               |  5 -----
 board/cm-bf537u/config.mk               |  5 -----
 board/cm-bf548/config.mk                |  5 -----
 board/cm-bf561/config.mk                |  5 -----
 board/ip04/config.mk                    |  5 -----
 board/pr1/config.mk                     | 15 ---------------
 board/tcm-bf518/config.mk               | 13 -------------
 board/tcm-bf537/config.mk               |  5 -----
 config.mk                               | 28 ++++++++++++++++++++--------
 examples/standalone/Makefile            |  5 ++---
 include/configs/bct-brettl2.h           |  2 +-
 include/configs/bf518f-ezbrd.h          |  2 +-
 include/configs/bf526-ezbrd.h           |  1 +
 include/configs/bf527-ad7160-eval.h     |  2 +-
 include/configs/bf527-ezkit.h           |  2 +-
 include/configs/bf527-sdp.h             |  2 +-
 include/configs/bf533-ezkit.h           |  2 +-
 include/configs/bf533-stamp.h           |  1 +
 include/configs/bf537-stamp.h           |  1 +
 include/configs/bf538f-ezkit.h          |  2 +-
 include/configs/bf548-ezkit.h           |  1 +
 include/configs/bf561-acvilon.h         |  2 +-
 include/configs/bf561-ezkit.h           |  1 +
 include/configs/br4.h                   |  2 +-
 include/configs/cm-bf527.h              |  2 +-
 include/configs/cm-bf533.h              |  2 +-
 include/configs/cm-bf537e.h             |  1 +
 include/configs/cm-bf537u.h             |  2 +-
 include/configs/cm-bf548.h              |  1 +
 include/configs/cm-bf561.h              |  2 +-
 include/configs/ip04.h                  |  1 +
 include/configs/pr1.h                   |  2 +-
 include/configs/tcm-bf518.h             |  2 +-
 include/configs/tcm-bf537.h             |  2 +-
 include/configs/tegra-common.h          |  4 ++++
 lib/Makefile                            |  2 ++
 scripts/Makefile.build                  | 10 +++++-----
 scripts/Makefile.lib                    |  7 +++----
 spl/Makefile                            | 17 ++++++++---------
 71 files changed, 94 insertions(+), 342 deletions(-)
 delete mode 100644 arch/arm/cpu/arm720t/tegra114/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra20/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk
 delete mode 100644 board/bct-brettl2/config.mk
 delete mode 100644 board/bf518f-ezbrd/config.mk
 delete mode 100644 board/bf526-ezbrd/config.mk
 delete mode 100644 board/bf527-ad7160-eval/config.mk
 delete mode 100644 board/bf527-ezkit/config.mk
 delete mode 100644 board/br4/config.mk
 delete mode 100644 board/cm-bf527/config.mk
 delete mode 100644 board/pr1/config.mk
 delete mode 100644 board/tcm-bf518/config.mk

-- 
1.8.3.2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
  2014-03-05  7:59 [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance Masahiro Yamada
@ 2014-03-05  7:59 ` Masahiro Yamada
  2014-03-07 22:13   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Masahiro Yamada @ 2014-03-05  7:59 UTC (permalink / raw)
  To: u-boot

Many (but not all) of Blackfin boards give -O2 option
to compile under lib/ directory.
That means lib/ should be speed-optimized,
whereas other parts should be size-optimized.

We want to keep the same behavior,
but do not want to parse board/*/config.mk again and again.
We've got no choice but to invent a new method.

CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled,
gives -O2 flag only for building under lib/ directory.

Dirty codes which I had marked as "FIX ME"
in board/${BOARD}/config.mk have been deleted.
Instead, CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED has been
defined in include/configs/${BOARD}.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Sonic Zhang <sonic.zhang@analog.com>
---

Changes in v3: None
Changes in v2: None

 board/bct-brettl2/config.mk         | 13 -------------
 board/bf518f-ezbrd/config.mk        | 13 -------------
 board/bf526-ezbrd/config.mk         | 13 -------------
 board/bf527-ad7160-eval/config.mk   | 13 -------------
 board/bf527-ezkit/config.mk         | 13 -------------
 board/bf527-sdp/config.mk           |  5 -----
 board/bf533-ezkit/config.mk         |  5 -----
 board/bf533-stamp/config.mk         |  5 -----
 board/bf537-stamp/config.mk         |  5 -----
 board/bf538f-ezkit/config.mk        |  5 -----
 board/bf548-ezkit/config.mk         |  5 -----
 board/bf561-acvilon/config.mk       |  5 -----
 board/bf561-ezkit/config.mk         |  5 -----
 board/br4/config.mk                 | 15 ---------------
 board/cm-bf527/config.mk            | 13 -------------
 board/cm-bf533/config.mk            |  5 -----
 board/cm-bf537e/config.mk           |  5 -----
 board/cm-bf537u/config.mk           |  5 -----
 board/cm-bf548/config.mk            |  5 -----
 board/cm-bf561/config.mk            |  5 -----
 board/ip04/config.mk                |  5 -----
 board/pr1/config.mk                 | 15 ---------------
 board/tcm-bf518/config.mk           | 13 -------------
 board/tcm-bf537/config.mk           |  5 -----
 include/configs/bct-brettl2.h       |  2 +-
 include/configs/bf518f-ezbrd.h      |  2 +-
 include/configs/bf526-ezbrd.h       |  1 +
 include/configs/bf527-ad7160-eval.h |  2 +-
 include/configs/bf527-ezkit.h       |  2 +-
 include/configs/bf527-sdp.h         |  2 +-
 include/configs/bf533-ezkit.h       |  2 +-
 include/configs/bf533-stamp.h       |  1 +
 include/configs/bf537-stamp.h       |  1 +
 include/configs/bf538f-ezkit.h      |  2 +-
 include/configs/bf548-ezkit.h       |  1 +
 include/configs/bf561-acvilon.h     |  2 +-
 include/configs/bf561-ezkit.h       |  1 +
 include/configs/br4.h               |  2 +-
 include/configs/cm-bf527.h          |  2 +-
 include/configs/cm-bf533.h          |  2 +-
 include/configs/cm-bf537e.h         |  1 +
 include/configs/cm-bf537u.h         |  2 +-
 include/configs/cm-bf548.h          |  1 +
 include/configs/cm-bf561.h          |  2 +-
 include/configs/ip04.h              |  1 +
 include/configs/pr1.h               |  2 +-
 include/configs/tcm-bf518.h         |  2 +-
 include/configs/tcm-bf537.h         |  2 +-
 lib/Makefile                        |  2 ++
 49 files changed, 26 insertions(+), 212 deletions(-)
 delete mode 100644 board/bct-brettl2/config.mk
 delete mode 100644 board/bf518f-ezbrd/config.mk
 delete mode 100644 board/bf526-ezbrd/config.mk
 delete mode 100644 board/bf527-ad7160-eval/config.mk
 delete mode 100644 board/bf527-ezkit/config.mk
 delete mode 100644 board/br4/config.mk
 delete mode 100644 board/cm-bf527/config.mk
 delete mode 100644 board/pr1/config.mk
 delete mode 100644 board/tcm-bf518/config.mk

diff --git a/board/bct-brettl2/config.mk b/board/bct-brettl2/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/bct-brettl2/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/bf518f-ezbrd/config.mk b/board/bf518f-ezbrd/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/bf518f-ezbrd/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/bf526-ezbrd/config.mk b/board/bf526-ezbrd/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/bf526-ezbrd/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/bf527-ad7160-eval/config.mk b/board/bf527-ad7160-eval/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/bf527-ad7160-eval/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/bf527-ezkit/config.mk b/board/bf527-ezkit/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/bf527-ezkit/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/bf527-sdp/config.mk b/board/bf527-sdp/config.mk
index af299f5..1d46cfc 100644
--- a/board/bf527-sdp/config.mk
+++ b/board/bf527-sdp/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 6
diff --git a/board/bf533-ezkit/config.mk b/board/bf533-ezkit/config.mk
index 97eaafe..7f9138b 100644
--- a/board/bf533-ezkit/config.mk
+++ b/board/bf533-ezkit/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf533-stamp/config.mk b/board/bf533-stamp/config.mk
index 97eaafe..7f9138b 100644
--- a/board/bf533-stamp/config.mk
+++ b/board/bf533-stamp/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf537-stamp/config.mk b/board/bf537-stamp/config.mk
index bc0e747..ab0fbec 100644
--- a/board/bf537-stamp/config.mk
+++ b/board/bf537-stamp/config.mk
@@ -7,11 +7,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
 LDR_FLAGS-BFIN_BOOT_UART := --port g --gpio 6
diff --git a/board/bf538f-ezkit/config.mk b/board/bf538f-ezkit/config.mk
index 97eaafe..7f9138b 100644
--- a/board/bf538f-ezkit/config.mk
+++ b/board/bf538f-ezkit/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf548-ezkit/config.mk b/board/bf548-ezkit/config.mk
index 8d2c60f..7bb8e9c 100644
--- a/board/bf548-ezkit/config.mk
+++ b/board/bf548-ezkit/config.mk
@@ -7,11 +7,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA       := --dma 6
 LDR_FLAGS-BFIN_BOOT_FIFO       := --dma 1
diff --git a/board/bf561-acvilon/config.mk b/board/bf561-acvilon/config.mk
index ce94715..854d7db 100644
--- a/board/bf561-acvilon/config.mk
+++ b/board/bf561-acvilon/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/bf561-ezkit/config.mk b/board/bf561-ezkit/config.mk
index ce94715..854d7db 100644
--- a/board/bf561-ezkit/config.mk
+++ b/board/bf561-ezkit/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/br4/config.mk b/board/br4/config.mk
deleted file mode 100644
index 2436ec0..0000000
--- a/board/br4/config.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Copyright (c) Switchfin Org. <dpn@switchfin.org>
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/cm-bf527/config.mk b/board/cm-bf527/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/cm-bf527/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/cm-bf533/config.mk b/board/cm-bf533/config.mk
index 97eaafe..7f9138b 100644
--- a/board/cm-bf533/config.mk
+++ b/board/cm-bf533/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf537e/config.mk b/board/cm-bf537e/config.mk
index 97eaafe..7f9138b 100644
--- a/board/cm-bf537e/config.mk
+++ b/board/cm-bf537e/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf537u/config.mk b/board/cm-bf537u/config.mk
index 97eaafe..7f9138b 100644
--- a/board/cm-bf537u/config.mk
+++ b/board/cm-bf537u/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf548/config.mk b/board/cm-bf548/config.mk
index 289c8a4..beb9834 100644
--- a/board/cm-bf548/config.mk
+++ b/board/cm-bf548/config.mk
@@ -7,11 +7,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA       := --dma 6
 LDR_FLAGS-BFIN_BOOT_FIFO       := --dma 1
diff --git a/board/cm-bf561/config.mk b/board/cm-bf561/config.mk
index ce94715..854d7db 100644
--- a/board/cm-bf561/config.mk
+++ b/board/cm-bf561/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/ip04/config.mk b/board/ip04/config.mk
index bc0e747..ab0fbec 100644
--- a/board/ip04/config.mk
+++ b/board/ip04/config.mk
@@ -7,11 +7,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
 LDR_FLAGS-BFIN_BOOT_UART := --port g --gpio 6
diff --git a/board/pr1/config.mk b/board/pr1/config.mk
deleted file mode 100644
index 2436ec0..0000000
--- a/board/pr1/config.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Copyright (c) Switchfin Org. <dpn@switchfin.org>
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/tcm-bf518/config.mk b/board/tcm-bf518/config.mk
deleted file mode 100644
index 0d3df2d..0000000
--- a/board/tcm-bf518/config.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Copyright (c) 2005-2008 Analog Device Inc.
-#
-# (C) Copyright 2001
-# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
diff --git a/board/tcm-bf537/config.mk b/board/tcm-bf537/config.mk
index 97eaafe..7f9138b 100644
--- a/board/tcm-bf537/config.mk
+++ b/board/tcm-bf537/config.mk
@@ -7,10 +7,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# FIX ME
-ifneq ($(filter lib lib/lzma lib/zlib, $(obj)),)
-ccflags-y := -O2
-endif
-
 # Set some default LDR flags based on boot mode.
 LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/include/configs/bct-brettl2.h b/include/configs/bct-brettl2.h
index 5b09b45..06f095c 100644
--- a/include/configs/bct-brettl2.h
+++ b/include/configs/bct-brettl2.h
@@ -136,7 +136,7 @@
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_PARTITIONS
 #define CONFIG_SYS_HUSH_PARSER
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf518f-ezbrd.h b/include/configs/bf518f-ezbrd.h
index a97972b..9eb85eb 100644
--- a/include/configs/bf518f-ezbrd.h
+++ b/include/configs/bf518f-ezbrd.h
@@ -155,7 +155,7 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h
index 0031093..3065d22 100644
--- a/include/configs/bf526-ezbrd.h
+++ b/include/configs/bf526-ezbrd.h
@@ -153,6 +153,7 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* define to enable run status via led */
 /* #define CONFIG_STATUS_LED */
diff --git a/include/configs/bf527-ad7160-eval.h b/include/configs/bf527-ad7160-eval.h
index fa05103..c0dfe26 100644
--- a/include/configs/bf527-ad7160-eval.h
+++ b/include/configs/bf527-ad7160-eval.h
@@ -136,7 +136,7 @@
  */
 #define CONFIG_MISC_INIT_R
 #define CONFIG_UART_CONSOLE	0
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf527-ezkit.h b/include/configs/bf527-ezkit.h
index db1b613..748ddb3 100644
--- a/include/configs/bf527-ezkit.h
+++ b/include/configs/bf527-ezkit.h
@@ -179,7 +179,7 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf527-sdp.h b/include/configs/bf527-sdp.h
index c0e8b5a..458868a 100644
--- a/include/configs/bf527-sdp.h
+++ b/include/configs/bf527-sdp.h
@@ -112,7 +112,7 @@
  */
 #define CONFIG_MISC_INIT_R
 #define CONFIG_UART_CONSOLE	0
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h
index beab127..b503528 100644
--- a/include/configs/bf533-ezkit.h
+++ b/include/configs/bf533-ezkit.h
@@ -110,7 +110,7 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index f5b9658..d82c5b2 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -185,6 +185,7 @@
  */
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* FLASH/ETHERNET uses the same async bank */
 #define SHARED_RESOURCES 	1
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index 02945be..e1705ca 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -254,6 +254,7 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /* Define if want to do post memory test */
 #undef CONFIG_POST
diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h
index ffb0caf..742c299 100644
--- a/include/configs/bf538f-ezkit.h
+++ b/include/configs/bf538f-ezkit.h
@@ -134,7 +134,7 @@
  */
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	0
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf548-ezkit.h b/include/configs/bf548-ezkit.h
index da5f029..1a245a2 100644
--- a/include/configs/bf548-ezkit.h
+++ b/include/configs/bf548-ezkit.h
@@ -181,6 +181,7 @@
 #define CONFIG_RTC_BFIN
 #define CONFIG_UART_CONSOLE	1
 #define CONFIG_BFIN_SPI_IMG_SIZE 0x50000
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #define CONFIG_ADI_GPIO2
 
diff --git a/include/configs/bf561-acvilon.h b/include/configs/bf561-acvilon.h
index 15ca1af..3db917e 100644
--- a/include/configs/bf561-acvilon.h
+++ b/include/configs/bf561-acvilon.h
@@ -160,7 +160,7 @@
 #define CONFIG_UART_CONSOLE			0
 #define CONFIG_BAUDRATE				57600
 #define CONFIG_SYS_PROMPT "Acvilon> "
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h
index fb6f948..0a309d9 100644
--- a/include/configs/bf561-ezkit.h
+++ b/include/configs/bf561-ezkit.h
@@ -102,6 +102,7 @@
  * Misc Settings
  */
 #define CONFIG_UART_CONSOLE	0
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Run core 1 from L1 SRAM start address when init uboot on core 0
diff --git a/include/configs/br4.h b/include/configs/br4.h
index ef3752d..f8d3158 100644
--- a/include/configs/br4.h
+++ b/include/configs/br4.h
@@ -135,7 +135,7 @@
 #define CONFIG_BOOTCOMMAND	"run nandboot"
 #define CONFIG_BOOTDELAY	2
 #define CONFIG_LOADADDR		0x2000000
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf527.h b/include/configs/cm-bf527.h
index b15a1eb..384d871 100644
--- a/include/configs/cm-bf527.h
+++ b/include/configs/cm-bf527.h
@@ -128,7 +128,7 @@
 #define FLASHBOOT_ENV_SETTINGS \
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf533.h b/include/configs/cm-bf533.h
index e2b954c..8bd499a 100644
--- a/include/configs/cm-bf533.h
+++ b/include/configs/cm-bf533.h
@@ -97,7 +97,7 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf537e.h b/include/configs/cm-bf537e.h
index 2838012..67cf801 100644
--- a/include/configs/cm-bf537e.h
+++ b/include/configs/cm-bf537e.h
@@ -146,6 +146,7 @@
 	"flashboot=flread 20040000 1000000 3c0000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf537u.h b/include/configs/cm-bf537u.h
index da4cc67..34ce75b 100644
--- a/include/configs/cm-bf537u.h
+++ b/include/configs/cm-bf537u.h
@@ -143,7 +143,7 @@
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/cm-bf548.h b/include/configs/cm-bf548.h
index 7f27eda..346e27f 100644
--- a/include/configs/cm-bf548.h
+++ b/include/configs/cm-bf548.h
@@ -117,6 +117,7 @@
 #define CONFIG_UART_CONSOLE	1
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #define CONFIG_ADI_GPIO2
 
diff --git a/include/configs/cm-bf561.h b/include/configs/cm-bf561.h
index 93e3c86..5265e5f 100644
--- a/include/configs/cm-bf561.h
+++ b/include/configs/cm-bf561.h
@@ -99,7 +99,7 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/ip04.h b/include/configs/ip04.h
index d36ae43..0efa2b7 100644
--- a/include/configs/ip04.h
+++ b/include/configs/ip04.h
@@ -132,6 +132,7 @@
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_MISC_INIT_R	/* needed for MAC address */
 #define CONFIG_UART_CONSOLE	0
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 #undef CONFIG_SHOW_BOOT_PROGRESS
 /* Enable this if bootretry required; currently it's disabled */
diff --git a/include/configs/pr1.h b/include/configs/pr1.h
index 03d4269..e96ed4b 100644
--- a/include/configs/pr1.h
+++ b/include/configs/pr1.h
@@ -135,7 +135,7 @@
 #define CONFIG_BOOTCOMMAND	"run nandboot"
 #define CONFIG_BOOTDELAY	2
 #define CONFIG_LOADADDR		0x2000000
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/tcm-bf518.h b/include/configs/tcm-bf518.h
index 241f210..1ff34d5 100644
--- a/include/configs/tcm-bf518.h
+++ b/include/configs/tcm-bf518.h
@@ -116,7 +116,7 @@
 #define CONFIG_UART_CONSOLE	0
 #define CONFIG_BOOTCOMMAND	"run flashboot"
 #define FLASHBOOT_ENV_SETTINGS	"flashboot=bootm 0x20040000\0"
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/include/configs/tcm-bf537.h b/include/configs/tcm-bf537.h
index 58bcdc8..370d97f 100644
--- a/include/configs/tcm-bf537.h
+++ b/include/configs/tcm-bf537.h
@@ -145,7 +145,7 @@
 	"flashboot=flread 20040000 1000000 300000;" \
 	"bootm 0x1000000\0"
 #define CONFIG_BOARD_SIZE_LIMIT $$((384 * 1024))
-
+#define CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
 
 /*
  * Pull in common ADI header for remaining command/environment setup
diff --git a/lib/Makefile b/lib/Makefile
index dedb97b..8814ff9 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -65,3 +65,5 @@ obj-y += vsprintf.o
 obj-$(CONFIG_RANDOM_MACADDR) += rand.o
 obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
 obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
+
+subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
  2014-03-05  7:59 [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance Masahiro Yamada
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
@ 2014-03-05  7:59 ` Masahiro Yamada
  2014-03-07 22:15   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script Masahiro Yamada
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 4/4] kbuild: improve Kbuild speed Masahiro Yamada
  3 siblings, 2 replies; 12+ messages in thread
From: Masahiro Yamada @ 2014-03-05  7:59 UTC (permalink / raw)
  To: u-boot

Before this commit, USE_PRIVATE_LIBGCC was defined in
arch-specific config.mk and referenced in
arch/$(ARCH)/lib/Makefile.

We are not happy about parsing config.mk again and again.
We have to keep the same behavior with a different way.

By adding "CONFIG_" prefix, this macro appears
in include/autoconf.mk, include/spl-autoconf.mk.
(And treating USE_PRIVATE_LIBGCC as CONFIG macro
is reasonable enough.)

Tegra SoC family defined USE_PRIVATE_LIBGCC as "yes"
in arch/arm/cpu/arm720t/tegra*/config.mk,
whereas did not define it in arch/arm/cpu/armv7/tegra*/config.mk.

It means Tegra enables PRIVATE_LIBGCC only for SPL.
We can describe the same behavior by adding

  #ifdef CONFIG_SPL_BUILD
  # define CONFIG_USE_PRIVATE_LIBGCC
  #endif

to include/configs/tegra-common.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
---

Changes in v3: None
Changes in v2:
  - Fix the subject and commit description
     s/USE_PRIVATE_LIBS/USE_PRIVATE_LIBGCC/

 Makefile                                |  6 +++---
 arch/arm/cpu/arm720t/tegra114/config.mk | 19 -------------------
 arch/arm/cpu/arm720t/tegra124/config.mk |  7 -------
 arch/arm/cpu/arm720t/tegra20/config.mk  | 10 ----------
 arch/arm/cpu/arm720t/tegra30/config.mk  | 19 -------------------
 arch/arm/lib/Makefile                   | 13 ++-----------
 arch/mips/lib/Makefile                  |  7 +------
 arch/powerpc/lib/Makefile               |  6 +-----
 arch/sh/lib/Makefile                    | 14 ++------------
 arch/x86/config.mk                      |  2 +-
 include/configs/tegra-common.h          |  4 ++++
 spl/Makefile                            |  2 +-
 12 files changed, 15 insertions(+), 94 deletions(-)
 delete mode 100644 arch/arm/cpu/arm720t/tegra114/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra124/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra20/config.mk
 delete mode 100644 arch/arm/cpu/arm720t/tegra30/config.mk

diff --git a/Makefile b/Makefile
index 5b7e5e6..b546d76 100644
--- a/Makefile
+++ b/Makefile
@@ -651,11 +651,11 @@ u-boot-main := $(libs-y)
 
 
 # Add GCC lib
-ifdef USE_PRIVATE_LIBGCC
-ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
+ifdef CONFIG_USE_PRIVATE_LIBGCC
+ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
 PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
 else
-PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
+PLATFORM_LIBGCC = -L $(CONFIG_USE_PRIVATE_LIBGCC) -lgcc
 endif
 else
 PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
diff --git a/arch/arm/cpu/arm720t/tegra114/config.mk b/arch/arm/cpu/arm720t/tegra114/config.mk
deleted file mode 100644
index 7947b50..0000000
--- a/arch/arm/cpu/arm720t/tegra114/config.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-USE_PRIVATE_LIBGCC = yes
diff --git a/arch/arm/cpu/arm720t/tegra124/config.mk b/arch/arm/cpu/arm720t/tegra124/config.mk
deleted file mode 100644
index 5e10701..0000000
--- a/arch/arm/cpu/arm720t/tegra124/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# (C) Copyright 2010-2013
-# NVIDIA Corporation <www.nvidia.com>
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#/
-USE_PRIVATE_LIBGCC = yes
diff --git a/arch/arm/cpu/arm720t/tegra20/config.mk b/arch/arm/cpu/arm720t/tegra20/config.mk
deleted file mode 100644
index e073345..0000000
--- a/arch/arm/cpu/arm720t/tegra20/config.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# (C) Copyright 2010,2011
-# NVIDIA Corporation <www.nvidia.com>
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-USE_PRIVATE_LIBGCC = yes
diff --git a/arch/arm/cpu/arm720t/tegra30/config.mk b/arch/arm/cpu/arm720t/tegra30/config.mk
deleted file mode 100644
index 2388c56..0000000
--- a/arch/arm/cpu/arm720t/tegra30/config.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-USE_PRIVATE_LIBGCC = yes
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 45febcf..9fc81cd 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -5,17 +5,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-# Build private libgcc only when asked for
-ifdef USE_PRIVATE_LIBGCC
-lib-y	+= _ashldi3.o
-lib-y	+= _ashrdi3.o
-lib-y	+= _divsi3.o
-lib-y	+= _lshrdi3.o
-lib-y	+= _modsi3.o
-lib-y	+= _udivsi3.o
-lib-y	+= _umodsi3.o
-lib-y	+= div0.o
-endif
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _divsi3.o \
+			_lshrdi3.o _modsi3.o _udivsi3.o _umodsi3.o div0.o
 
 ifdef CONFIG_ARM64
 obj-y	+= crt0_64.o
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 3705926..fabeb83 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -8,9 +8,4 @@
 obj-y	+= board.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 
-# Build private libgcc only when asked for
-ifdef USE_PRIVATE_LIBGCC
-lib-y	+= ashldi3.o
-lib-y	+= ashrdi3.o
-lib-y	+= lshrdi3.o
-endif
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index e6d8be5..0f62982 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -7,11 +7,7 @@
 
 ## Build a couple of necessary functions into a private libgcc
 ## if the user asked for it
-ifdef USE_PRIVATE_LIBGCC
-lib-y	+= _ashldi3.o
-lib-y	+= _ashrdi3.o
-lib-y	+= _lshrdi3.o
-endif
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _ashldi3.o _ashrdi3.o _lshrdi3.o
 
 MINIMAL=
 
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index 5fc9d9d..8a84b24 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -15,15 +15,5 @@ obj-y	+= time.o
 endif
 obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o
 
-
-
-# Build private libgcc only when asked for
-ifdef USE_PRIVATE_LIBGCC
-lib-y	+= ashiftrt.o
-lib-y	+= ashiftlt.o
-lib-y	+= lshiftrt.o
-lib-y	+= ashldi3.o
-lib-y	+= ashrsi3.o
-lib-y	+= lshrdi3.o
-lib-y	+= movmem.o
-endif
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashiftrt.o ashiftlt.o lshiftrt.o \
+				    ashldi3.o ashrsi3.o lshrdi3.o movmem.o
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 58dff14..1e52a5e 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -31,4 +31,4 @@ LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
 export NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
 PREFIXED_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/$(shell basename $(NORMAL_LIBGCC))
 
-export USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC))
+CONFIG_USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC))
diff --git a/include/configs/tegra-common.h b/include/configs/tegra-common.h
index 0b102aa..9247aef 100644
--- a/include/configs/tegra-common.h
+++ b/include/configs/tegra-common.h
@@ -151,6 +151,10 @@
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_GPIO_SUPPORT
 
+#ifdef CONFIG_SPL_BUILD
+# define CONFIG_USE_PRIVATE_LIBGCC
+#endif
+
 #define CONFIG_SYS_GENERIC_BOARD
 
 /* Misc utility code */
diff --git a/spl/Makefile b/spl/Makefile
index 57bd43b..e1a0601 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -132,7 +132,7 @@ u-boot-spl-dirs	:= $(patsubst %/,%,$(filter %/, $(libs-y)))
 libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
 
 # Add GCC lib
-ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
+ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
 PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
 PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
 endif
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script
  2014-03-05  7:59 [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance Masahiro Yamada
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC Masahiro Yamada
@ 2014-03-05  7:59 ` Masahiro Yamada
  2014-03-07 22:17   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 4/4] kbuild: improve Kbuild speed Masahiro Yamada
  3 siblings, 2 replies; 12+ messages in thread
From: Masahiro Yamada @ 2014-03-05  7:59 UTC (permalink / raw)
  To: u-boot

We want to change the build system to include config.mk
only from ./Makefile and spl/Makefile.
We must prepare for that in this commit.

$(src) is a moving target and not handy for our purpose.
We must replace it with a fixed path.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Changes in v3: None
Changes in v2: None

 arch/mips/cpu/mips32/config.mk | 3 ++-
 arch/mips/cpu/mips64/config.mk | 3 ++-
 arch/mips/cpu/xburst/config.mk | 3 ++-
 arch/nds32/config.mk           | 3 ++-
 arch/sparc/config.mk           | 2 +-
 5 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index 7ee7faa..cd4ce7a 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -21,4 +21,5 @@ else
 PLATFORM_LDFLAGS  += -m elf32ltsmip
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
+			       -T $(srctree)/examples/standalone/mips.lds
diff --git a/arch/mips/cpu/mips64/config.mk b/arch/mips/cpu/mips64/config.mk
index 02113a1..3c01136 100644
--- a/arch/mips/cpu/mips64/config.mk
+++ b/arch/mips/cpu/mips64/config.mk
@@ -21,4 +21,5 @@ else
 PLATFORM_LDFLAGS  += -m elf64ltsmip
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 -T $(srctree)/$(src)/mips64.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0xffffffff80200000 \
+			       -T $(srctree)/examples/standalone/mips64.lds
diff --git a/arch/mips/cpu/xburst/config.mk b/arch/mips/cpu/xburst/config.mk
index 00b0fd9..b8e53e5 100644
--- a/arch/mips/cpu/xburst/config.mk
+++ b/arch/mips/cpu/xburst/config.mk
@@ -12,4 +12,5 @@ else
 PLATFORM_LDFLAGS  += -m elf32ltsmip
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 -T $(srctree)/$(src)/mips.lds
+CONFIG_STANDALONE_LOAD_ADDR ?= 0x80200000 \
+			       -T $(srctree)/examples/standalone/mips.lds
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index 0cbc4ad..1024852 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -12,7 +12,8 @@ ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := nds32le-linux-
 endif
 
-CONFIG_STANDALONE_LOAD_ADDR = 0x300000 -T $(srctree)/$(src)/nds32.lds
+CONFIG_STANDALONE_LOAD_ADDR = 0x300000 \
+			      -T $(srctree)/examples/standalone/nds32.lds
 
 PLATFORM_RELFLAGS	+= -fno-strict-aliasing -fno-common -mrelax
 PLATFORM_RELFLAGS	+= -gdwarf-2
diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk
index e2327ec..6dbf20f 100644
--- a/arch/sparc/config.mk
+++ b/arch/sparc/config.mk
@@ -10,6 +10,6 @@ CROSS_COMPILE := sparc-elf-
 endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
-			-T $(srctree)/$(src)/sparc.lds
+			       -T $(srctree)/examples/standalone/sparc.lds
 
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 4/4] kbuild: improve Kbuild speed
  2014-03-05  7:59 [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance Masahiro Yamada
                   ` (2 preceding siblings ...)
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script Masahiro Yamada
@ 2014-03-05  7:59 ` Masahiro Yamada
  2014-03-07 22:29   ` [U-Boot] [U-Boot,v3,4/4] " Tom Rini
  3 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2014-03-05  7:59 UTC (permalink / raw)
  To: u-boot

Kbuild brought about many advantages for us but a significant
performance regression was reported by Simon Glass.

After some discussions and analysis, it turned out
its main cause is in $(call cc-option,...).

Historically, U-Boot parses all config.mk
(arch/*/config.mk and board/*/config.mk)
every time descending into subdirectories.
That means cc-options are evaluated over and over again.

$(call cc-option,...) is useful but costly.
So we want to evaluate them only in ./Makefile
and spl/Makefile and export compiler flags.

This commit changes the build system as follows:

  - Modify scripts/Makefile.build to not include config.mk
    Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
    cppflags-y.

  - Export many variables
    Going forward, Kbuild will not parse config.mk files
    when it descends into subdirectories.
    If we want to set variables in config.mk and use them
    in subdirectories, they must be exported.

    This is the list of variables to get exported:
      PLATFORM_CPPFLAGS
      CPUDIR
      BOARDDIR
      OBJCOPYFLAGS
      LDFLAGS
      LDFLAGS_FINAL
        (used in nand_spl/board/*/*/Makefile)
      CONFIG_STANDALONE_LOAD_ADDR
        (used in examples/standalone/Makefile)
      SYM_PREFIX
        (used in examples/standalone/Makefile)
      RELFLAGS
        (used in examples/standalone/Makefile)

  - Delete CPPFLAGS
    This variable has been replaced with PLATFORM_CPPFLAGS

  - Copy gcclibdir from example/standalone/Makefile
    to arch/sparc/config.mk
    The reference in CONFIG_STANDALONE_LOAD_ADDR must be
    resolved before it is exported.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]
---

Changes in v3:
  - Modify spl/Makefile:
     Move
       KBUILD_CFLAGS += -ffunction-sections -fdata-sections
       LDFLAGS_FINAL += --gc-sections
     after
       include $(TOPDIR)/config.mk
     because $(TOPDIR)/config.mk resets the state of LDFLAGS_FINAL.
     Otherwise, microblaze-generic board will be broken.

Changes in v2: None

 Makefile                     |  7 ++++---
 arch/blackfin/config.mk      |  1 +
 arch/sparc/config.mk         |  2 ++
 config.mk                    | 28 ++++++++++++++++++++--------
 examples/standalone/Makefile |  5 ++---
 scripts/Makefile.build       | 10 +++++-----
 scripts/Makefile.lib         |  7 +++----
 spl/Makefile                 | 15 +++++++--------
 8 files changed, 44 insertions(+), 31 deletions(-)

diff --git a/Makefile b/Makefile
index b546d76..9e91509 100644
--- a/Makefile
+++ b/Makefile
@@ -358,13 +358,13 @@ UBOOTRELEASE = $(shell cat include/config/uboot.release 2> /dev/null)
 UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
 
 export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION
-export ARCH CPU BOARD VENDOR SOC
+export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
 export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM LDR STRIP OBJCOPY OBJDUMP
 export MAKE AWK
 export DTC CHECK CHECKFLAGS
 
-export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE
+export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS KBUILD_AFLAGS
 
 # When compiling out-of-tree modules, put MODVERDIR in the module
@@ -567,7 +567,8 @@ NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     += $(NOSTDINC_FLAGS)
 
 # FIX ME
-cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
+cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
+							$(NOSTDINC_FLAGS)
 c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 
 #########################################################################
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index adc9712..fcaa44f 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -43,6 +43,7 @@ CREATE_LDR_ENV =
 endif
 
 SYM_PREFIX = _
+export SYM_PREFIX
 
 LDR_FLAGS-y :=
 LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J
diff --git a/arch/sparc/config.mk b/arch/sparc/config.mk
index 6dbf20f..be59f58 100644
--- a/arch/sparc/config.mk
+++ b/arch/sparc/config.mk
@@ -9,6 +9,8 @@ ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE := sparc-elf-
 endif
 
+gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
+
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x00000000 -L $(gcclibdir) \
 			       -T $(srctree)/examples/standalone/sparc.lds
 
diff --git a/config.mk b/config.mk
index af25c11..4657577 100644
--- a/config.mk
+++ b/config.mk
@@ -6,11 +6,18 @@
 #
 #########################################################################
 
-# clean the slate ...
-PLATFORM_RELFLAGS =
-PLATFORM_CPPFLAGS =
-PLATFORM_LDFLAGS =
-
+# This file is included from ./Makefile and spl/Makefile.
+# Clean the state to avoid the same flags added twice.
+#
+# (Tegra needs different flags for SPL.
+#  That's the reason why this file must be included from spl/Makefile too.
+#  If we did not have Tegra SoCs, build system would be much simpler...)
+PLATFORM_RELFLAGS :=
+PLATFORM_CPPFLAGS :=
+PLATFORM_LDFLAGS :=
+LDFLAGS :=
+LDFLAGS_FINAL :=
+OBJCOPYFLAGS :=
 #########################################################################
 
 # Some architecture config.mk files need to know what CPUDIR is set to,
@@ -41,12 +48,17 @@ endif
 
 #########################################################################
 
-RELFLAGS= $(PLATFORM_RELFLAGS)
+RELFLAGS := $(PLATFORM_RELFLAGS)
 
 OBJCOPYFLAGS += --gap-fill=0xff
 
-CPPFLAGS = $(RELFLAGS)
-CPPFLAGS += -pipe $(PLATFORM_CPPFLAGS)
+PLATFORM_CPPFLAGS += $(RELFLAGS)
+PLATFORM_CPPFLAGS += -pipe
 
 LDFLAGS += $(PLATFORM_LDFLAGS)
 LDFLAGS_FINAL += -Bstatic
+
+export PLATFORM_CPPFLAGS
+export RELFLAGS
+export LDFLAGS_FINAL
+export CONFIG_STANDALONE_LOAD_ADDR
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 5b227cd..7e0e5b7 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -44,9 +44,8 @@ gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 # relocatable executable.  The relocation data is not needed, and
 # also causes the entry point of the standalone application to be
 # inconsistent.
-ifeq ($(ARCH),powerpc)
-# FIX ME
-CPPFLAGS := $(filter-out $(RELFLAGS), $(CPPFLAGS))
+ifeq ($(CONFIG_PPC),y)
+PLATFORM_CPPFLAGS := $(filter-out $(RELFLAGS),$(PLATFORM_CPPFLAGS))
 endif
 
 # We don't want gcc reordering functions if possible.  This ensures that an
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 59361f4..36346fd 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -55,11 +55,6 @@ endif
 
 include scripts/Kbuild.include
 
-# Added for U-Boot
-# We must include config.mk after Kbuild.include
-# so that some config.mk can use cc-option.
-include config.mk
-
 # For backward compatibility check that these variables do not change
 save-cflags := $(CFLAGS)
 
@@ -68,6 +63,11 @@ kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
 kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
 include $(kbuild-file)
 
+# Added for U-Boot
+asflags-y  += $(PLATFORM_CPPFLAGS)
+ccflags-y  += $(PLATFORM_CPPFLAGS)
+cppflags-y += $(PLATFORM_CPPFLAGS)
+
 # If the save-* variables changed error out
 ifeq ($(KBUILD_NOPEDANTIC),)
         ifneq ("$(save-cflags)","$(CFLAGS)")
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 02b17b1..d568fde 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -101,13 +101,12 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
 modname_flags  = $(if $(filter 1,$(words $(modname))),\
                  -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
 
-# U-Boot also uses $(CPPFLAGS)
-orig_c_flags   = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
+orig_c_flags   = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
                  $(ccflags-y) $(CFLAGS_$(basetarget).o)
 _c_flags       = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
-_a_flags       = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
+_a_flags       = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS) $(KBUILD_SUBDIR_ASFLAGS) \
                  $(asflags-y) $(AFLAGS_$(basetarget).o)
-_cpp_flags     = $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
+_cpp_flags     = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
 
 #
 # Enable gcov profiling flags for a file, directory or for all files depending
diff --git a/spl/Makefile b/spl/Makefile
index e1a0601..bb3d349 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -29,10 +29,6 @@ ifeq ($(CONFIG_TPL_BUILD),y)
 KBUILD_CPPFLAGS += -DCONFIG_TPL_BUILD
 endif
 
-# Enable garbage collection of un-used sections for SPL
-KBUILD_CFLAGS += -ffunction-sections -fdata-sections
-LDFLAGS_FINAL += --gc-sections
-
 ifeq ($(CONFIG_TPL_BUILD),y)
 export CONFIG_TPL_BUILD
 SPL_BIN := u-boot-tpl
@@ -50,8 +46,14 @@ endif
 
 include $(TOPDIR)/config.mk
 
+# Enable garbage collection of un-used sections for SPL
+KBUILD_CFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS_FINAL += --gc-sections
+
 # FIX ME
-c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
+cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \
+							$(NOSTDINC_FLAGS)
+c_flags := $(KBUILD_CFLAGS) $(cpp_flags)
 
 # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
 quiet_cmd_autoconf = GEN     $@
@@ -228,9 +230,6 @@ PHONY += $(u-boot-spl-dirs)
 $(u-boot-spl-dirs):
 	$(Q)$(MAKE) $(build)=$@
 
-# FIX ME
-cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
-
 quiet_cmd_cpp_lds = LDS     $@
 cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \
 		-x assembler-with-cpp -P -o $@ $<
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
@ 2014-03-07 22:13   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2014-03-07 22:13 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 5 March 2014 00:59, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> Many (but not all) of Blackfin boards give -O2 option
> to compile under lib/ directory.
> That means lib/ should be speed-optimized,
> whereas other parts should be size-optimized.
>
> We want to keep the same behavior,
> but do not want to parse board/*/config.mk again and again.
> We've got no choice but to invent a new method.
>
> CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled,
> gives -O2 flag only for building under lib/ directory.
>
> Dirty codes which I had marked as "FIX ME"
> in board/${BOARD}/config.mk have been deleted.
> Instead, CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED has been
> defined in include/configs/${BOARD}.h.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Sonic Zhang <sonic.zhang@analog.com>

Acked-by: Simon Glass <sjg@chromium.org>

> diff --git a/lib/Makefile b/lib/Makefile
> index dedb97b..8814ff9 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -65,3 +65,5 @@ obj-y += vsprintf.o
>  obj-$(CONFIG_RANDOM_MACADDR) += rand.o
>  obj-$(CONFIG_BOOTP_RANDOM_DELAY) += rand.o
>  obj-$(CONFIG_CMD_LINK_LOCAL) += rand.o
> +
> +subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2


I guess this gets added after the -Os so supersedes it. I wonder what
happens if debugging is enabled? Still this is the same as before I
think.

Regards,
Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC Masahiro Yamada
@ 2014-03-07 22:15   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2014-03-07 22:15 UTC (permalink / raw)
  To: u-boot

On 5 March 2014 00:59, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> Before this commit, USE_PRIVATE_LIBGCC was defined in
> arch-specific config.mk and referenced in
> arch/$(ARCH)/lib/Makefile.
>
> We are not happy about parsing config.mk again and again.
> We have to keep the same behavior with a different way.
>
> By adding "CONFIG_" prefix, this macro appears
> in include/autoconf.mk, include/spl-autoconf.mk.
> (And treating USE_PRIVATE_LIBGCC as CONFIG macro
> is reasonable enough.)
>
> Tegra SoC family defined USE_PRIVATE_LIBGCC as "yes"
> in arch/arm/cpu/arm720t/tegra*/config.mk,
> whereas did not define it in arch/arm/cpu/armv7/tegra*/config.mk.
>
> It means Tegra enables PRIVATE_LIBGCC only for SPL.
> We can describe the same behavior by adding
>
>   #ifdef CONFIG_SPL_BUILD
>   # define CONFIG_USE_PRIVATE_LIBGCC
>   #endif
>
> to include/configs/tegra-common.h.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Warren <twarren@nvidia.com>
> Cc: Simon Glass <sjg@chromium.org>
> Acked-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script Masahiro Yamada
@ 2014-03-07 22:17   ` Simon Glass
  2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2014-03-07 22:17 UTC (permalink / raw)
  To: u-boot

On 5 March 2014 00:59, Masahiro Yamada <yamada.m@jp.panasonic.com> wrote:
> We want to change the build system to include config.mk
> only from ./Makefile and spl/Makefile.
> We must prepare for that in this commit.
>
> $(src) is a moving target and not handy for our purpose.
> We must replace it with a fixed path.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [U-Boot, v3, 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
  2014-03-07 22:13   ` Simon Glass
@ 2014-03-07 22:29   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2014-03-07 22:29 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 04:59:37PM +0900, Masahiro Yamada wrote:

> Many (but not all) of Blackfin boards give -O2 option
> to compile under lib/ directory.
> That means lib/ should be speed-optimized,
> whereas other parts should be size-optimized.
> 
> We want to keep the same behavior,
> but do not want to parse board/*/config.mk again and again.
> We've got no choice but to invent a new method.
> 
> CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED, if it is enabled,
> gives -O2 flag only for building under lib/ directory.
> 
> Dirty codes which I had marked as "FIX ME"
> in board/${BOARD}/config.mk have been deleted.
> Instead, CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED has been
> defined in include/configs/${BOARD}.h.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Sonic Zhang <sonic.zhang@analog.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/9bd9d496/attachment.pgp>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [U-Boot, v3, 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC Masahiro Yamada
  2014-03-07 22:15   ` Simon Glass
@ 2014-03-07 22:29   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2014-03-07 22:29 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 04:59:38PM +0900, Masahiro Yamada wrote:

> Before this commit, USE_PRIVATE_LIBGCC was defined in
> arch-specific config.mk and referenced in
> arch/$(ARCH)/lib/Makefile.
> 
> We are not happy about parsing config.mk again and again.
> We have to keep the same behavior with a different way.
> 
> By adding "CONFIG_" prefix, this macro appears
> in include/autoconf.mk, include/spl-autoconf.mk.
> (And treating USE_PRIVATE_LIBGCC as CONFIG macro
> is reasonable enough.)
> 
> Tegra SoC family defined USE_PRIVATE_LIBGCC as "yes"
> in arch/arm/cpu/arm720t/tegra*/config.mk,
> whereas did not define it in arch/arm/cpu/armv7/tegra*/config.mk.
> 
> It means Tegra enables PRIVATE_LIBGCC only for SPL.
> We can describe the same behavior by adding
> 
>   #ifdef CONFIG_SPL_BUILD
>   # define CONFIG_USE_PRIVATE_LIBGCC
>   #endif
> 
> to include/configs/tegra-common.h.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Tom Warren <twarren@nvidia.com>
> Cc: Simon Glass <sjg@chromium.org>
> Acked-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/8e80c71c/attachment.pgp>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [U-Boot, v3, 3/4] config.mk: specify the exact path to standalone linker script
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script Masahiro Yamada
  2014-03-07 22:17   ` Simon Glass
@ 2014-03-07 22:29   ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2014-03-07 22:29 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 04:59:39PM +0900, Masahiro Yamada wrote:

> We want to change the build system to include config.mk
> only from ./Makefile and spl/Makefile.
> We must prepare for that in this commit.
> 
> $(src) is a moving target and not handy for our purpose.
> We must replace it with a fixed path.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/6ca4348b/attachment.pgp>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [U-Boot,v3,4/4] kbuild: improve Kbuild speed
  2014-03-05  7:59 ` [U-Boot] [PATCH v3 4/4] kbuild: improve Kbuild speed Masahiro Yamada
@ 2014-03-07 22:29   ` Tom Rini
  0 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2014-03-07 22:29 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 05, 2014 at 04:59:40PM +0900, Masahiro Yamada wrote:

> Kbuild brought about many advantages for us but a significant
> performance regression was reported by Simon Glass.
> 
> After some discussions and analysis, it turned out
> its main cause is in $(call cc-option,...).
> 
> Historically, U-Boot parses all config.mk
> (arch/*/config.mk and board/*/config.mk)
> every time descending into subdirectories.
> That means cc-options are evaluated over and over again.
> 
> $(call cc-option,...) is useful but costly.
> So we want to evaluate them only in ./Makefile
> and spl/Makefile and export compiler flags.
> 
> This commit changes the build system as follows:
> 
>   - Modify scripts/Makefile.build to not include config.mk
>     Instead, add $(PLATFORM_CPPFLAGS) to asflags-y, ccflags-y,
>     cppflags-y.
> 
>   - Export many variables
>     Going forward, Kbuild will not parse config.mk files
>     when it descends into subdirectories.
>     If we want to set variables in config.mk and use them
>     in subdirectories, they must be exported.
> 
>     This is the list of variables to get exported:
>       PLATFORM_CPPFLAGS
>       CPUDIR
>       BOARDDIR
>       OBJCOPYFLAGS
>       LDFLAGS
>       LDFLAGS_FINAL
>         (used in nand_spl/board/*/*/Makefile)
>       CONFIG_STANDALONE_LOAD_ADDR
>         (used in examples/standalone/Makefile)
>       SYM_PREFIX
>         (used in examples/standalone/Makefile)
>       RELFLAGS
>         (used in examples/standalone/Makefile)
> 
>   - Delete CPPFLAGS
>     This variable has been replaced with PLATFORM_CPPFLAGS
> 
>   - Copy gcclibdir from example/standalone/Makefile
>     to arch/sparc/config.mk
>     The reference in CONFIG_STANDALONE_LOAD_ADDR must be
>     resolved before it is exported.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Reported-by: Simon Glass <sjg@chromium.org>
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested-by: Simon Glass <sjg@chromium.org> [on Sandbox]
> Tested-by: Stephen Warren <swarren@nvidia.com> [on Tegra]

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140307/a1513c4f/attachment.pgp>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-03-07 22:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-05  7:59 [U-Boot] [PATCH v3 0/4] Big acceleration of Kbuild performance Masahiro Yamada
2014-03-05  7:59 ` [U-Boot] [PATCH v3 1/4] kbuild, blackfin: Add CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED Masahiro Yamada
2014-03-07 22:13   ` Simon Glass
2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2014-03-05  7:59 ` [U-Boot] [PATCH v3 2/4] kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC Masahiro Yamada
2014-03-07 22:15   ` Simon Glass
2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2014-03-05  7:59 ` [U-Boot] [PATCH v3 3/4] config.mk: specify the exact path to standalone linker script Masahiro Yamada
2014-03-07 22:17   ` Simon Glass
2014-03-07 22:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2014-03-05  7:59 ` [U-Boot] [PATCH v3 4/4] kbuild: improve Kbuild speed Masahiro Yamada
2014-03-07 22:29   ` [U-Boot] [U-Boot,v3,4/4] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox