[dpdk-dev] [RFC PATCH 0/2] pmdinfogen: rewrite in Python
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Mon Jun 22 02:45:01 CEST 2020
This is a PoC rewrite of pmdinfogen in Python with missing bits
described below and in commits. Community input is desired.
Pros:
1. Simpler build process without host apps.
2. Less build requirements (host libelf).
3. Easier debugging and maintenance with a high-level language.
4. Easier porting on Windows (only add new object format).
Cons:
1. No standard ELF or COFF module for Python
(amount of Python code without libelf on par with C code using it).
2. struct rte_pci_id must be synchronized with header file
(it's a few lines that never change).
There are no built-in or widely used Python libraries for ELF or COFF.
Some ELF-parsing libraries exist on PyPI, but they're not very handy for
the task and their installation would complicate build requirements.
Thus, elf.py implements its own parsing.
COFF support is underway, it's just not included in this RFC.
Amount of code is similar to elf.py.
Build is only tested on Linux x64_64.
If the community deems this RFC worth finishing, there are a few opens:
1. Support for >65K section headers seems present in current pmdinfogen.
However, the data it reads is not used after. Is it really needed?
2. How much error-handling is required? This is a build-time tool,
and Python gives nice stacktraces. However, segfaults are possible
in Python version due to pointer handling. IMO, error checking
must be just sufficient to prevent silent segfaults.
3. On Unix, pmdinfogen is called for each object file extracted with ar
from an .a library by a shell script. On Windows, other tools
have to be used, shell script will not work. On the other hand, COFF
library format is quite simple. Would it be appropriate for
pmdinfogen to handle it to avoid intermediate script?
---
Dmitry Kozlyuk (2):
pmdinfogen: prototype in Python
build: use Python pmdinfogen
buildtools/elf.py | 194 +++++++++++++++++++++++++++++++++++++++
buildtools/meson.build | 3 +-
buildtools/pmdinfogen.py | 144 +++++++++++++++++++++++++++++
drivers/meson.build | 2 +-
4 files changed, 340 insertions(+), 3 deletions(-)
create mode 100644 buildtools/elf.py
create mode 100755 buildtools/pmdinfogen.py
--
2.25.4
More information about the dev
mailing list