> -----Original Message----- > From: David Marchand <david.march...@redhat.com> > Sent: Thursday, July 11, 2024 7:39 PM > To: dev@dpdk.org > Cc: sta...@dpdk.org; Ali Alnubani <alia...@nvidia.com>; Jiale, SongX > <songx.ji...@intel.com>; Dmitry Kozlyuk <dmitry.kozl...@gmail.com> > Subject: [PATCH] buildtools: fix build with clang 17 and ASan > > ASan included in clang 17 and later suffixes symbols. > $ nm build/drivers/libtmp_rte_net_null.a | grep this_pmd > 0000000000000000 r this_pmd_name3 > 0000000000000000 n > this_pmd_name3.f2cd16678ab09dba8fd23405d8d11fce > > This breaks the detection of driver symbols in pmdinfogen which then creates > duplicate symbols "_pmd_info" in many drivers. Such duplicate symbols > trigger a link error. > > $ grep -w _pmd_info build/drivers/rte_net_*.pmd.c > build/drivers/rte_net_af_packet.pmd.c:const char _pmd_info[] > __attribute__((used)) = > "PMD_INFO_STRING= {\"name\": \"\", \"pci_ids\": []}"; > build/drivers/rte_net_null.pmd.c:const char _pmd_info[] > __attribute__((used)) = > "PMD_INFO_STRING= {\"name\": \"\", \"pci_ids\": []}"; > > A simple reproducer: > $ CC=clang meson setup build -Denable_apps=test-pmd -Ddisable_libs=* \ > -Denable_drivers=net/null,net/af_packet -Dtests=false \ > -Db_lundef=false -Db_sanitize=address > > $ ninja -C build > > Before this patch, the pmdinfogen script was relying on a symbol name > starting with this_pmd_name. > On the other hand, what this script needs is symbols whose names are > this_pmd_name ## __COUNTER__, see below an example for PCI driver > symbols (the same applies to other buses). > > $ git grep -w RTE_PMD_EXPORT_NAME drivers/bus/pci/bus_pci_driver.h > drivers/bus/pci/bus_pci_driver.h:RTE_PMD_EXPORT_NAME(nm, > __COUNTER__) $ git grep -B1 this_pmd_name lib/eal/ > lib/eal/include/rte_dev.h-#define RTE_PMD_EXPORT_NAME(name, idx) \ > lib/eal/include/rte_dev.h:static const char > RTE_PMD_EXPORT_NAME_ARRAY(this_pmd_name, idx) \ $ git grep > define.RTE_PMD_EXPORT_NAME_ARRAY lib/eal/include/rte_dev.h > lib/eal/include/rte_dev.h:#define > RTE_PMD_EXPORT_NAME_ARRAY(n, idx) n##idx[] > > Adjust the symbol filter for both ELF and COFF implementations. > > Bugzilla ID: 1466 > Cc: sta...@dpdk.org > > Reported-by: Ali Alnubani <alia...@nvidia.com> > Reported-by: Song Jiale <songx.ji...@intel.com> > Signed-off-by: David Marchand <david.march...@redhat.com> > --- Tested-by: Jiale Song <songx.ji...@intel.com>
Can confirm it fixes the build failure in my environment. Thanks.