kbuild: add CONFIG_ prefix to USE_PRIVATE_LIBGCC
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Wed, 5 Mar 2014 07:59:38 +0000 (16:59 +0900)
committerTom Rini <trini@ti.com>
Fri, 7 Mar 2014 15:59:06 +0000 (10:59 -0500)
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>
12 files changed:
Makefile
arch/arm/cpu/arm720t/tegra114/config.mk [deleted file]
arch/arm/cpu/arm720t/tegra124/config.mk [deleted file]
arch/arm/cpu/arm720t/tegra20/config.mk [deleted file]
arch/arm/cpu/arm720t/tegra30/config.mk [deleted file]
arch/arm/lib/Makefile
arch/mips/lib/Makefile
arch/powerpc/lib/Makefile
arch/sh/lib/Makefile
arch/x86/config.mk
include/configs/tegra-common.h
spl/Makefile

index 23c604608ca6d021eda806d73613c4b906276b2b..4e61ae914c8b7cfe3175983b838ec9a75af8e2aa 100644 (file)
--- 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 (file)
index 7947b50..0000000
+++ /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 (file)
index 5e10701..0000000
+++ /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 (file)
index e073345..0000000
+++ /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 (file)
index 2388c56..0000000
+++ /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
index 45febcfd98afa349fb537a0edb03f3631ae7d450..9fc81cd012996ba6970ae1b541973ca9b05e39db 100644 (file)
@@ -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
index 370592668e3e7ad2b2c7cf7b9fc57346622835c9..fabeb83f7e9fd910c340c2abefaef94abf361451 100644 (file)
@@ -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
index e6d8be51cae831a60367cc233299e1fd98ef0811..0f6298269a7764181286b789947ddc7827c85b56 100644 (file)
@@ -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=
 
index 5fc9d9d66d46e9e5c6bdf616b6a5ed41f93a2d4d..8a84b24af193d771d8dc87139594cfb2aba4a749 100644 (file)
@@ -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
index 58dff1467d366200560d5122c3c572a6fe1098a6..1e52a5e9b0ae7b7a0ced065c933f4a2f95ec88c8 100644 (file)
@@ -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))
index 0b102aa289f4da8f886853b11f8c6afde0260754..9247aefdb37b840a13e162d1451f238b89e006c3 100644 (file)
 #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 */
index 57bd43bf4536e7dce8df8f9d9c6fb4796fe268c3..e1a0601a0220e73777274bd3d81aa7f68493bd1c 100644 (file)
@@ -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