On Fri, Feb 23, 2024 at 11:03:13AM +0100, Sumanth Korikkar wrote: > In the random config generated by lkp test robot > > CONFIG_TI_CPSW=m > CONFIG_TI_DAVINCI_EMAC=y > > In drivers/net/ethernet/ti/Makefile: > 11 obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o > 12 ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o > ... > 16 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o > 17 ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o > > Here davinci_cpdma.o is used in both obj-$(CONFIG_TI_DAVINCI_EMAC) and > obj-$(CONFIG_TI_CPSW), one built as inbuilt and one built as module > correspondingly (randconfig) > > This leads to conflict in Kbuild and results in linking davinci_cpdma.o > in vmlinux. > * However, davinci_cpdma.o is built with -DMODULE -fPIC. > * vmlinux is built with -fno-PIE. > > This leads to R_390_GOTENT and R_390_GOTDBL entries in vmlinux, which is > not expected when building kernel with -fno-PIE. Nice. I suppose the current s390 memory model wouldn't support removing -fPIC for modules? Otherwise each driver could get its own copy of the object file: diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index d8590304f3df..ef6591b6a4c9 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile @@ -9,14 +9,14 @@ obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o obj-$(CONFIG_TLAN) += tlan.o obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o -ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o +ti_davinci_emac-y := davinci_emac.o emac_cpdma.o obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o obj-$(CONFIG_TI_CPTS) += cpts.o obj-$(CONFIG_TI_CPSW) += ti_cpsw.o -ti_cpsw-y := cpsw.o davinci_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o +ti_cpsw-y := cpsw.o cpsw_cpdma.o cpsw_ale.o cpsw_priv.o cpsw_sl.o cpsw_ethtool.o obj-$(CONFIG_TI_CPSW_SWITCHDEV) += ti_cpsw_new.o -ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o davinci_cpdma.o cpsw_ale.o cpsw_sl.o cpsw_priv.o cpsw_ethtool.o +ti_cpsw_new-y := cpsw_switchdev.o cpsw_new.o cpsw_new_cpdma.o cpsw_ale.o cpsw_sl.o cpsw_priv.o cpsw_ethtool.o obj-$(CONFIG_TI_KEYSTONE_NETCP) += keystone_netcp.o keystone_netcp-y := netcp_core.o cpsw_ale.o diff --git a/drivers/net/ethernet/ti/cpsw_cpdma.c b/drivers/net/ethernet/ti/cpsw_cpdma.c new file mode 100644 index 000000000000..017156225e7f --- /dev/null +++ b/drivers/net/ethernet/ti/cpsw_cpdma.c @@ -0,0 +1 @@ +#include "davinci_cpdma.c" diff --git a/drivers/net/ethernet/ti/cpsw_new_cpdma.c b/drivers/net/ethernet/ti/cpsw_new_cpdma.c new file mode 100644 index 000000000000..017156225e7f --- /dev/null +++ b/drivers/net/ethernet/ti/cpsw_new_cpdma.c @@ -0,0 +1 @@ +#include "davinci_cpdma.c" diff --git a/drivers/net/ethernet/ti/emac_cpdma.c b/drivers/net/ethernet/ti/emac_cpdma.c new file mode 100644 index 000000000000..017156225e7f --- /dev/null +++ b/drivers/net/ethernet/ti/emac_cpdma.c @@ -0,0 +1 @@ +#include "davinci_cpdma.c"