Commit Graph

6 Commits

Author SHA1 Message Date
Dmitry Kozlyuk
8050b61562 buildtools: allow string constant padding
Size of string constant symbol may be larger than its length
measured up to NUL terminator. In this case pmdinfogen included padding
bytes after NUL terminator in generated source, yielding incorrect code.

Always trim string data to NUL terminator while reading ELF.
It was already done for COFF because there's no symbol size.

Bugzilla ID: 720
Fixes: f0f93a7adf ("buildtools: use Python pmdinfogen")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-06-17 18:44:30 +02:00
Dmitry Kozlyuk
65ef14c576 buildtools: fix pmdinfogen with pyelftools < 0.24
pyelftools had some breaking changes [1] and API enhancements [2]
between 0.23 (used in Ubuntu 16.04) and 0.24. Ensure compatibility with
both legacy and modern versions.

[1]: https://github.com/eliben/pyelftools/pull/76
[2]: https://github.com/eliben/pyelftools/pull/56

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-01-26 00:39:34 +01:00
Dmitry Kozlyuk
e6e9730c70 buildtools: support object file extraction for Windows
clang archiver tool is llvm-ar on Windows and ar on other platforms.
MinGW always uses ar. Replace shell script (Unix-only) that calls ar
with a Python script (OS-independent) that calls an appropriate archiver
tool selected at configuration time. Move the logic not to generate
empty sources into pmdinfogen.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-01-25 23:23:50 +01:00
Dmitry Kozlyuk
0fe5c4e5ad buildtools: allow multiple input files in pmdinfogen
Process any number of input object files and write a unified output.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-01-25 23:23:49 +01:00
Dmitry Kozlyuk
5031436f45 buildtools: support COFF in pmdinfogen
Common Object File Format (COFF) is used on Windows in place of ELF.

Add COFF parser to pmdinfogen. Also add an argument to specify input
file format, which is selected at configure time based on the target.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
2021-01-25 23:23:48 +01:00
Dmitry Kozlyuk
6c4bf8f424 buildtools: add Python pmdinfogen
Using a high-level, interpreted language simplifies maintenance and
build process. Furthermore, ELF handling is delegated to pyelftools
package. Original logic is kept, the copyright recognizes that.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Jie Zhou <jizh@microsoft.com>
2021-01-25 23:23:30 +01:00