buildtools: fix build with clang 17
PATCH 1/1 buildtools: fix build with clang 17
On Fedora 39 with Clang 17.0.3 and ASan enabled, RTE_PMD_EXPORT_NAME seems to be done twice for a single lib, which results in load_drivers() returning a list consisting of 2 drivers (e.g., ['mlx5_common_pci', '']). image.find_by_prefix("this_pmd_name") returns 2 symbols in this case, "mlx5_common_pci" and an empty string ''. This didn't reproduce with clang version 16.0.6.
This patch ensures that a symbol with an empty string_value doesn't cause an addition to the list of drivers.
Bugzilla ID: 1313
--- buildtools/pmdinfogen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
buildtools/pmdinfogen.py +3 -1
@@ -71,7 +71,9 @@ def find_by_prefix(self, prefix): for i in range(self._symtab.num_symbols()): symbol = self._symtab.get_symbol(i) if symbol.name.startswith(prefix): - yield ELFSymbol(self._image, symbol) + elf_symbol = ELFSymbol(self._image, symbol) + if elf_symbol.string_value: + yield elf_symbol class COFFSymbol:
Signature · 1 line
2.25.1
Hello Ali, Thomas,
Quoted 11 lines · Ali Alnubani
On Fedora 39 with Clang 17.0.3 and ASan enabled,
RTE_PMD_EXPORT_NAMEseems to be done twice for a single lib, which results inload_drivers()returning a list consisting of 2 drivers (e.g., ['mlx5_common_pci', '']).image.find_by_prefix("this_pmd_name")returns 2 symbols in this case, "mlx5_common_pci" and an empty string ''. This didn't reproduce with clang version 16.0.6.This patch ensures that a symbol with an empty
string_valuedoesn't cause an addition to the list of drivers.
I suppose this comes from ASan instrumenting the code:
# nm /root/dpdk/build-clang/drivers/libtmp_rte_common_mlx5.a | grep this_pmd 0000000000000000 r this_pmd_name3 0000000000000000 n this_pmd_name3.e5676185d74e2e1a9de646deebca963f 0000000000000000 r this_pmd_name3 0000000000000000 n this_pmd_name3.a2533baf7a46959f41383725087d4086
The name of the symbols this script should look for has a clear format, which is this_pmd_name[0-9]+.
Filtering with this pattern, there would be no need to go and interpret a symbol content.
Signature · 1 line
David Marchand
Quoted 23 lines · David Marchand
Hello Ali, Thomas,
Quoted 11 lines · Ali Alnubani
On Fedora 39 with Clang 17.0.3 and ASan enabled,
RTE_PMD_EXPORT_NAMEseems to be done twice for a single lib, which results inload_drivers()returning a list consisting of 2 drivers (e.g., ['mlx5_common_pci', '']).image.find_by_prefix("this_pmd_name")returns 2 symbols in this case, "mlx5_common_pci" and an empty string ''. This didn't reproduce with clang version 16.0.6.This patch ensures that a symbol with an empty
string_valuedoesn't cause an addition to the list of drivers.I suppose this comes from ASan instrumenting the code:
# nm /root/dpdk/build-clang/drivers/libtmp_rte_common_mlx5.a | grep this_pmd 0000000000000000 r this_pmd_name3 0000000000000000 n this_pmd_name3.e5676185d74e2e1a9de646deebca963f 0000000000000000 r this_pmd_name3 0000000000000000 n this_pmd_name3.a2533baf7a46959f41383725087d4086
Quoted 4 lines
The name of the symbols this script should look for has a clear format, which is this_pmd_name[0-9]+.
Filtering with this pattern, there would be no need to go and interpret a symbol content.
Ali, can you send a v2?
Signature · 1 line
David Marchand
Quoted 35 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, June 27, 2024 3:37 PM
To: Ali Alnubani <[email protected]>
Cc: [email protected]; NBU-Contact-Thomas Monjalon (EXTERNAL) <[email protected]>; [email protected]; Bruce Richardson <[email protected]>; Mingjin Ye <[email protected]>
Subject: Re: [PATCH] buildtools: fix build with clang 17Quoted 13 lines · David Marchand
Hello Ali, Thomas,
Quoted 9 lines · Ali Alnubani
On Fedora 39 with Clang 17.0.3 and ASan enabled,
RTE_PMD_EXPORT_NAMEseems to be done twice for a single lib, which results inload_drivers()returning a list consisting of 2 drivers (e.g., ['mlx5_common_pci', '']).image.find_by_prefix("this_pmd_name")returns 2 symbols in this case, "mlx5_common_pci" and an empty string ''. This didn't reproduce with clang version 16.0.6.Quoted 5 lines
Quoted 2 lines
This patch ensures that a symbol with an empty
string_valuedoesn't cause an addition to the list of drivers.I suppose this comes from ASan instrumenting the code:
# nm /root/dpdk/build-clang/drivers/libtmp_rte_common_mlx5.a | grep
this_pmdQuoted 5 lines
0000000000000000 r
this_pmd_name3
0000000000000000 n this_pmd_name3.e5676185d74e2e1a9de646deebca963f 0000000000000000 rthis_pmd_name3
0000000000000000 n this_pmd_name3.a2533baf7a46959f41383725087d4086
Quoted 7 lines
Quoted 4 lines
The name of the symbols this script should look for has a clear format, which is this_pmd_name[0-9]+.
Filtering with this pattern, there would be no need to go and interpret a symbol content.Ali, can you send a v2?
Hi David,
Apologies for the delay, will continue working on this as soon as possible.
Regards,
Ali