[PATCH v2 0/3] PE compression/corruption fixes with related test case
Tobias Deiminger
tobias.deiminger@linutronix.de
Thu Nov 26 08:51:52 GMT 2026
Here are two loosely related bugfixes for BFD PE formats, covered by a
new test case that verifies a debug symbol compress-decompress round
trip for all BFD targets that are reachable by converting a compiled
test program. The test needs both fixes to succeed.
I initially found the --compress-debug-sections issue for pei-* while
doing some toolchain interoperability evaluation. Fixing and testing it
then revealed the bigobj issue. Both fixes are required to make the test
pass, so I submit them as one series.
Changes in v2:
- Rebased onto current master.
- bfd: fix reading compressed debug sections of pei-* images
- Change title and description
- v1 reported the bug wrongly as always existing. It was rather a
recent regression and is now fixed by allowing zero padding for
non-ELF again. The v1 approach has been tried before in PR 18087,
and has been decided to be invalid.
- bfd/PE: don't write an OptionalHeader to object files
- Change title and description
- Drop EXEC_P for all PE objects, not only bigobj.
- Keep OptionalHeader size in the swap tables, so existing PE objects with
OptionalHeader remain readable.
- No more special handling of auto-promotion. EXEC_P is dropped early
instead.
- No more warning about discarded exec flag and start address. Silent
dropping seems to be an established pattern in comparable cases.
- binutils/testsuite: test compress-debug-info round trip
- Determine a test target candidate set by filtering for architecture
and endianness, to lower test time and "unsupported" noise.
- One test result per target instead of separate compress and
decompress results.
- Exclude a.out-*, drop coff-x86-64.
- Exclude conversion failures during test preparation as "unsupported".
v1: https://patchwork.sourceware.org/project/binutils/cover/20260928090146.4016188-1-tobias.deiminger@linutronix.de/
Tobias Deiminger (3):
bfd: fix reading compressed debug sections of pei-* images
bfd/PE: don't write an OptionalHeader to object files
binutils/testsuite: test compress-debug-info round trip
bfd/coff-aarch64.c | 4 +-
bfd/coff-i386.c | 4 +-
bfd/coff-ia64.c | 2 +-
bfd/coff-loongarch64.c | 2 +-
bfd/coff-riscv64.c | 2 +-
bfd/coff-x86_64.c | 4 +-
bfd/coffcode.h | 23 ++-
bfd/compress.c | 28 +++-
binutils/testsuite/binutils-all/compress.exp | 156 ++++++++++++++++++-
9 files changed, 204 insertions(+), 21 deletions(-)
base-commit: 4ca329532e26f527e0635e8fb19d9c348284a62d
--
2.55.0
More information about the Binutils
mailing list