[v3] buildtools: fix invalid symbols

Message ID 20240705082550.1670765-1-mingjinx.ye@intel.com (mailing list archive)
State Rejected
Delegated to: David Marchand
Headers
Series [v3] buildtools: fix invalid symbols |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-arm64-testing pending Testing pending
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing pending Testing pending
ci/iol-sample-apps-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Mingjin Ye July 5, 2024, 8:25 a.m. UTC
  In scenarios where a higher clang compiler is used and ASAN is enabled,
the generated ELF file will additionally insert undefined debug symbols
with the same prefix. This causes duplicate C code to be generated.

This patch fixes this issue by skipping the unspecified symbol type.

Fixes: 6c4bf8f42432 ("buildtools: add Python pmdinfogen")
Cc: stable@dpdk.org

Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
---
 buildtools/pmdinfogen.py | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Ali Alnubani July 5, 2024, 6:08 p.m. UTC | #1
> -----Original Message-----
> From: Mingjin Ye <mingjinx.ye@intel.com>
> Sent: Friday, July 5, 2024 11:26 AM
> To: dev@dpdk.org
> Cc: david.marchand@redhat.com; Ali Alnubani <alialnu@nvidia.com>; Mingjin Ye
> <mingjinx.ye@intel.com>; stable@dpdk.org; Dmitry Kozlyuk
> <dmitry.kozliuk@gmail.com>
> Subject: [PATCH v3] buildtools: fix invalid symbols
> 
> In scenarios where a higher clang compiler is used and ASAN is enabled,
> the generated ELF file will additionally insert undefined debug symbols
> with the same prefix. This causes duplicate C code to be generated.
> 
> This patch fixes this issue by skipping the unspecified symbol type.
> 
> Fixes: 6c4bf8f42432 ("buildtools: add Python pmdinfogen")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---

Can confirm it fixes the build failure in my environment, thanks Mingjin.

Tested-by: Ali Alnubani <alialnu@nvidia.com>

Regards,
Ali
  
Jiale, SongX July 11, 2024, 9:20 a.m. UTC | #2
> -----Original Message-----
> From: Mingjin Ye <mingjinx.ye@intel.com>
> Sent: Friday, July 5, 2024 4:26 PM
> To: dev@dpdk.org
> Cc: Marchand, David <david.marchand@redhat.com>; alialnu@nvidia.com;
> Ye, MingjinX <mingjinx.ye@intel.com>; stable@dpdk.org; Dmitry Kozlyuk
> <dmitry.kozliuk@gmail.com>
> Subject: [PATCH v3] buildtools: fix invalid symbols
> 
> In scenarios where a higher clang compiler is used and ASAN is enabled, the
> generated ELF file will additionally insert undefined debug symbols with the
> same prefix. This causes duplicate C code to be generated.
> 
> This patch fixes this issue by skipping the unspecified symbol type.
> 
> Fixes: 6c4bf8f42432 ("buildtools: add Python pmdinfogen")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mingjin Ye <mingjinx.ye@intel.com>
> ---
Tested-by: Jiale Song <songx.jiale@intel.com>
  
David Marchand July 11, 2024, 11:39 a.m. UTC | #3
On Fri, Jul 5, 2024 at 10:49 AM Mingjin Ye <mingjinx.ye@intel.com> wrote:
>
> In scenarios where a higher clang compiler is used and ASAN is enabled,
> the generated ELF file will additionally insert undefined debug symbols
> with the same prefix. This causes duplicate C code to be generated.
>
> This patch fixes this issue by skipping the unspecified symbol type.

You did not reply to my comments on v3 and here we have a new hack.
This hack is ugly and not future proof (I can imagine some other
symbols may appear in the future. If those symbols are not of type
"STT_NOTYPE" we will have to find another filter at this point...).

Please have a try with:
https://patchwork.dpdk.org/project/dpdk/patch/20240711113851.975368-1-david.marchand@redhat.com/


Thanks.
  

Patch

diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py
index 2a44f17bda..9896f107dc 100755
--- a/buildtools/pmdinfogen.py
+++ b/buildtools/pmdinfogen.py
@@ -70,6 +70,9 @@  def find_by_prefix(self, prefix):
         prefix = prefix.encode("utf-8") if self._legacy_elftools else prefix
         for i in range(self._symtab.num_symbols()):
             symbol = self._symtab.get_symbol(i)
+            # Skip unspecified symbol type
+            if symbol.entry.st_info['type'] == "STT_NOTYPE":
+                continue
             if symbol.name.startswith(prefix):
                 yield ELFSymbol(self._image, symbol)