Skip to contentSkip to conversation

hw/arm: Use more CONFIG switches to decide which object files should be linked

PATCH In review Thomas Huth 3 participants 4 messages Mar 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm: Use more CONFIG switches to decide which object files should be linked

A lot of ARM object files are linked into the executable unconditionally, even though we have corresponding CONFIG switches like CONFIG_PXA2XX or CONFIG_OMAP. We should make sure to use these switches in the Makefile so that the users can disable certain unwanted boards and devices more easily. Also introduce the new switch CONFIG_STRONGARM to be able to disable the "Collie" machine if it is not wanted.

---
 default-configs/arm-softmmu.mak |  2 ++
 hw/arm/Makefile.objs            | 26 +++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
default-configs/arm-softmmu.mak +2 -0
index ca34cf4..43f382a 100644
@@ -133,3 +133,5 @@ CONFIG_GPIO_KEY=y
 CONFIG_MSF2=y
 CONFIG_FW_CFG_DMA=y
 CONFIG_XILINX_AXI=y
+
+CONFIG_STRONGARM=y
hw/arm/Makefile.objs +17 -9
index 1c896ba..5e1e0a9 100644
@@ -1,15 +1,23 @@
-obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-$(CONFIG_DIGIC) += digic_boards.o
-obj-y += integratorcp.o mainstone.o musicpal.o nseries.o
-obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
-obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
+obj-y += boot.o virt.o sysbus-fdt.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
-obj-y += netduino2.o
-obj-y += sysbus-fdt.o
+obj-$(CONFIG_ARM_V7M) += highbank.o netduino2.o vexpress.o
+obj-$(CONFIG_ASPEED_SOC) += integratorcp.o musicpal.o versatilepb.o
+obj-$(CONFIG_DIGIC) += digic_boards.o
+obj-$(CONFIG_EXYNOS4) += exynos4_boards.o
+obj-$(CONFIG_NSERIES) += nseries.o
+obj-$(CONFIG_OMAP) += omap_sx1.o palm.o
+obj-$(CONFIG_PXA2XX) += gumstix.o spitz.o mainstone.o tosa.o z2.o
+obj-$(CONFIG_REALVIEW) += realview.o
+obj-$(CONFIG_STELLARIS) += stellaris.o
+obj-$(CONFIG_STRONGARM) += collie.o
+obj-$(CONFIG_ZYNQ) += xilinx_zynq.o
 
-obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
+obj-$(CONFIG_ARM_V7M) += armv7m.o
+obj-$(CONFIG_EXYNOS4) += exynos4210.o
+obj-$(CONFIG_PXA2XX) += pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
 obj-$(CONFIG_DIGIC) += digic.o
-obj-y += omap1.o omap2.o strongarm.o
+obj-$(CONFIG_OMAP) += omap1.o omap2.o
+obj-$(CONFIG_STRONGARM) += strongarm.o
 obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o
 obj-$(CONFIG_RASPI) += bcm2835_peripherals.o bcm2836.o raspi.o
 obj-$(CONFIG_STM32F205_SOC) += stm32f205_soc.o
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 28 lines · Thomas Huth

A lot of ARM object files are linked into the executable unconditionally, even though we have corresponding CONFIG switches like CONFIG_PXA2XX or CONFIG_OMAP. We should make sure to use these switches in the Makefile so that the users can disable certain unwanted boards and devices more easily. Also introduce the new switch CONFIG_STRONGARM to be able to disable the "Collie" machine if it is not wanted.

---
 default-configs/arm-softmmu.mak |  2 ++
 hw/arm/Makefile.objs            | 26 +++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
default-configs/arm-softmmu.mak +2 -0
index ca34cf4..43f382a 100644
@@ -133,3 +133,5 @@ CONFIG_GPIO_KEY=y
 CONFIG_MSF2=y
 CONFIG_FW_CFG_DMA=y
 CONFIG_XILINX_AXI=y
+
+CONFIG_STRONGARM=y
hw/arm/Makefile.objs +0 -0
index 1c896ba..5e1e0a9 100644

hw/arm/Makefile.objs line 3

Quoted 10 lines
hw/arm/Makefile.objs +2 -7
@@ -1,15 +1,23 @@
-obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-$(CONFIG_DIGIC) += digic_boards.o
-obj-y += integratorcp.o mainstone.o musicpal.o nseries.o
-obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
-obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
+obj-y += boot.o virt.o sysbus-fdt.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
-obj-y += netduino2.o
-obj-y += sysbus-fdt.o
+obj-$(CONFIG_ARM_V7M) += highbank.o netduino2.o vexpress.o

This is definitely wrong -- highbank and vexpress are not V7M platforms. Netduino2 is a v7M platform, but I don't think we should be making it conditional on ARM_V7M -- we have per-board configs for other boards, so you'd have a CONFIG_NETDUINO2 here if you wanted it.

hw/arm/Makefile.objs line 4

Quoted 1 line
hw/arm/Makefile.objs +1 -0
+obj-$(CONFIG_ASPEED_SOC) += integratorcp.o musicpal.o versatilepb.o

This is wrong too -- none of these are aspeed-based devices.

thanks
-- PMM

#2 lore raw
Quoted 34 lines · Peter Maydell
Quoted 33 lines · Thomas Huth

A lot of ARM object files are linked into the executable unconditionally, even though we have corresponding CONFIG switches like CONFIG_PXA2XX or CONFIG_OMAP. We should make sure to use these switches in the Makefile so that the users can disable certain unwanted boards and devices more easily. Also introduce the new switch CONFIG_STRONGARM to be able to disable the "Collie" machine if it is not wanted.

---
 default-configs/arm-softmmu.mak |  2 ++
 hw/arm/Makefile.objs            | 26 +++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
default-configs/arm-softmmu.mak +2 -0
index ca34cf4..43f382a 100644
@@ -133,3 +133,5 @@ CONFIG_GPIO_KEY=y
 CONFIG_MSF2=y
 CONFIG_FW_CFG_DMA=y
 CONFIG_XILINX_AXI=y
+
+CONFIG_STRONGARM=y
hw/arm/Makefile.objs +0 -5
index 1c896ba..5e1e0a9 100644
@@ -1,15 +1,23 @@
-obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-$(CONFIG_DIGIC) += digic_boards.o
-obj-y += integratorcp.o mainstone.o musicpal.o nseries.o
-obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
-obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
Quoted 8 lines

hw/arm/Makefile.objs line 3

Quoted 5 lines
hw/arm/Makefile.objs +2 -2
+obj-y += boot.o virt.o sysbus-fdt.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
-obj-y += netduino2.o
-obj-y += sysbus-fdt.o
+obj-$(CONFIG_ARM_V7M) += highbank.o netduino2.o vexpress.o

This is definitely wrong -- highbank and vexpress are not V7M platforms.

Ooops, sorry, seems like I mixed up V7M with v7-A :-(

Quoted 4 lines

Netduino2 is a v7M platform, but I don't think we should be making it conditional on ARM_V7M -- we have per-board configs for other boards, so you'd have a CONFIG_NETDUINO2 here if you wanted it.

OK, I think I'll simply introduce proper config switches for all three boards.

Quoted 3 lines

hw/arm/Makefile.objs line 4

Quoted 1 line
hw/arm/Makefile.objs +1 -0
+obj-$(CONFIG_ASPEED_SOC) += integratorcp.o musicpal.o versatilepb.o

This is wrong too -- none of these are aspeed-based devices.

*facepalm* ... looks like I grep'ed that wrong (I was searching for "arm926" IIRC) ... I'll add proper config switches for those boards, too.

Thomas

#3 lore raw

Hi Thomas,

Quoted 54 lines · Thomas Huth
Quoted 34 lines · Peter Maydell
Quoted 33 lines · Thomas Huth

A lot of ARM object files are linked into the executable unconditionally, even though we have corresponding CONFIG switches like CONFIG_PXA2XX or CONFIG_OMAP. We should make sure to use these switches in the Makefile so that the users can disable certain unwanted boards and devices more easily. Also introduce the new switch CONFIG_STRONGARM to be able to disable the "Collie" machine if it is not wanted.

---
 default-configs/arm-softmmu.mak |  2 ++
 hw/arm/Makefile.objs            | 26 +++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)
default-configs/arm-softmmu.mak +2 -0
index ca34cf4..43f382a 100644
@@ -133,3 +133,5 @@ CONFIG_GPIO_KEY=y
 CONFIG_MSF2=y
 CONFIG_FW_CFG_DMA=y
 CONFIG_XILINX_AXI=y
+
+CONFIG_STRONGARM=y
hw/arm/Makefile.objs +0 -5
index 1c896ba..5e1e0a9 100644
@@ -1,15 +1,23 @@
-obj-y += boot.o collie.o exynos4_boards.o gumstix.o highbank.o
-obj-$(CONFIG_DIGIC) += digic_boards.o
-obj-y += integratorcp.o mainstone.o musicpal.o nseries.o
-obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
-obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
Quoted 8 lines

hw/arm/Makefile.objs line 3

Quoted 5 lines
hw/arm/Makefile.objs +2 -2
+obj-y += boot.o virt.o sysbus-fdt.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
-obj-y += netduino2.o
-obj-y += sysbus-fdt.o
+obj-$(CONFIG_ARM_V7M) += highbank.o netduino2.o vexpress.o

This is definitely wrong -- highbank and vexpress are not V7M platforms.

Ooops, sorry, seems like I mixed up V7M with v7-A :-(

Quoted 4 lines

Netduino2 is a v7M platform, but I don't think we should be making it conditional on ARM_V7M -- we have per-board configs for other boards, so you'd have a CONFIG_NETDUINO2 here if you wanted it.

OK, I think I'll simply introduce proper config switches for all three boards.

Quoted 6 lines
Quoted 3 lines

hw/arm/Makefile.objs line 4

Quoted 1 line
hw/arm/Makefile.objs +1 -0
+obj-$(CONFIG_ASPEED_SOC) += integratorcp.o musicpal.o versatilepb.o

This is wrong too -- none of these are aspeed-based devices.

*facepalm* ... looks like I grep'ed that wrong (I was searching for "arm926" IIRC) ... I'll add proper config switches for those boards, too.

I went on this path some time ago, but stopped it after hearing, while distributor are interested in shorten the binary size (reduce code coverage for security...), the upstream project prefer to always compile most of his code (easier to test).

Except show few missing includes, this is true there is not big win using those CONFIG selectors, since very few devices are not compiled (all ARM cores are always compiled).

I pushed the WIP series in case you find it useful:
https://github.com/philmd/qemu/commits/armeb-softmmu-wip

Regards,

Phil.