> -----Original Message-----
> From: David Marchand <[email protected]>
> Sent: Thursday, July 11, 2024 7:39 PM
> To: [email protected]
> Cc: [email protected]; Ali Alnubani <[email protected]>; Jiale, SongX
> <[email protected]>; Dmitry Kozlyuk <[email protected]>
> 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: [email protected]
> 
> Reported-by: Ali Alnubani <[email protected]>
> Reported-by: Song Jiale <[email protected]>
> Signed-off-by: David Marchand <[email protected]>
> ---
Tested-by: Jiale Song <[email protected]>

Can confirm it fixes the build failure in my environment.

Thanks.

Reply via email to