Skip to contentSkip to conversation

x86: Don't build some unused objects in TPL

PATCH New Tom Rini 3 participants 3 messages Jun 27, 2020 – Jun 29, 2020 x86

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 x86: Don't build some unused objects in TPL

In the future if we have separate symbols for DM_SPI_FLASH and SPL_DM_SPI_FLASH we will not always have function declarations available for some DM calls. This in turn leads to build warnings but not failures as the code isn't used and is discarded at link time. Restructure things to not build code we won't use for TPL anyways.

---
I ran in to this as part of testing
http://patchwork.ozlabs.org/project/uboot/patch/20200604151153.3980-4-Zhiqiang.Hou at nxp.com/ which we do need to bring in. I think we might be building a lot of
codde that's then discarded for TPL builds, but didn't think this is the
right place to tackle that in.

---
 arch/x86/cpu/apollolake/Makefile | 2 +-
 arch/x86/lib/Makefile            | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/cpu/apollolake/Makefile +1 -1
index 3aa2a556765a..11621256aebc 100644
@@ -3,7 +3,6 @@
 # Copyright 2019 Google LLC
 
 obj-$(CONFIG_SPL_BUILD) += cpu_spl.o
-obj-$(CONFIG_SPL_BUILD) += spl.o
 obj-$(CONFIG_SPL_BUILD) += systemagent.o
 obj-y += cpu_common.o
 
@@ -12,6 +11,7 @@ obj-y += cpu.o
 obj-y += punit.o
 obj-y += fsp_bindings.o
 ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
 obj-y += fsp_m.o
 endif
 endif
arch/x86/lib/Makefile +3 -1
index 5cd458748038..1079bf20226a 100644
@@ -22,7 +22,6 @@ obj-y	+= init_helpers.o
 obj-y	+= interrupts.o
 obj-y	+= lpc-uclass.o
 obj-y	+= mpspec.o
-obj-$(CONFIG_ENABLE_MRC_CACHE) += mrccache.o
 obj-y	+= northbridge-uclass.o
 obj-$(CONFIG_I8259_PIC) += i8259.o
 obj-$(CONFIG_I8254_TIMER) += i8254.o
@@ -45,9 +44,12 @@ ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 endif
 obj-$(CONFIG_USE_HOB) += hob.o
+ifndef CONFIG_TPL_BUILD
+obj-$(CONFIG_ENABLE_MRC_CACHE) += mrccache.o
 obj-$(CONFIG_HAVE_FSP) += fsp/
 obj-$(CONFIG_FSP_VERSION1) += fsp1/
 obj-$(CONFIG_FSP_VERSION2) += fsp2/
+endif
 
 ifdef CONFIG_SPL_BUILD
 ifdef CONFIG_TPL_BUILD
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 x86: Don't build some unused objects in TPL

+Simon,

Quoted 15 lines · Tom Rini

In the future if we have separate symbols for DM_SPI_FLASH and SPL_DM_SPI_FLASH we will not always have function declarations available for some DM calls. This in turn leads to build warnings but not failures as the code isn't used and is discarded at link time. Restructure things to not build code we won't use for TPL anyways.

---
I ran in to this as part of testing
http://patchwork.ozlabs.org/project/uboot/patch/20200604151153.3980-4-Zhiqiang.Hou at nxp.com/ which we do need to bring in. I think we might be building a lot of
codde that's then discarded for TPL builds, but didn't think this is the
right place to tackle that in.

Quoted 5 lines
---
 arch/x86/cpu/apollolake/Makefile | 2 +-
 arch/x86/lib/Makefile            | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
#2 lore raw

PATCH 1/1 x86: Don't build some unused objects in TPL

Quoted 19 lines · Bin Meng

+Simon,

Quoted 15 lines · Tom Rini

In the future if we have separate symbols for DM_SPI_FLASH and SPL_DM_SPI_FLASH we will not always have function declarations available for some DM calls. This in turn leads to build warnings but not failures as the code isn't used and is discarded at link time. Restructure things to not build code we won't use for TPL anyways.

---
I ran in to this as part of testing
http://patchwork.ozlabs.org/project/uboot/patch/20200604151153.3980-4-Zhiqiang.Hou at nxp.com/ which we do need to bring in. I think we might be building a lot of
codde that's then discarded for TPL builds, but didn't think this is the
right place to tackle that in.

Yes we build far too much with TPL at present I think.

Quoted 7 lines
Quoted 5 lines
---
 arch/x86/cpu/apollolake/Makefile | 2 +-
 arch/x86/lib/Makefile            | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)