[all-commits] [llvm/llvm-project] 589927: [llvm-objcopy] Exclude empty sections in IHexWrite...
Ian McIntyre via All-commits
all-commits at lists.llvm.org
Sat Jun 12 12:23:25 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5899278758b66a5e72c1ae9695651c2aef7406c4
https://github.com/llvm/llvm-project/commit/5899278758b66a5e72c1ae9695651c2aef7406c4
Author: Ian McIntyre <ianpmcintyre at gmail.com>
Date: 2021-06-12 (Sat, 12 Jun 2021)
Changed paths:
M llvm/test/tools/llvm-objcopy/ELF/Inputs/ihex-elf-sections2.yaml
A llvm/test/tools/llvm-objcopy/ELF/ihex-writer-empty-sections.test
M llvm/tools/llvm-objcopy/ELF/Object.cpp
Log Message:
-----------
[llvm-objcopy] Exclude empty sections in IHexWriter output
IHexWriter was evaluating a section's physical address when deciding if
that section should be written to an output. This approach does not
account for a zero-sized section that has the same physical address as a
sized section. The behavior varies from GNU objcopy, and may result in a
HEX file that does not include all program sections.
The IHexWriter now excludes zero-sized sections when deciding what
should be written to the output. This affects the contents of the
writer's `Sections` collection; we will not try to insert multiple
sections that could have the same physical address. The behavior seems
consistent with GNU objcopy, which always excludes empty sections,
no matter the address.
The new test case evaluates the IHexWriter behavior when provided a
variety of empty sections that overlap or append a filled section. See
the input file's comments for more information. Given that test input,
and the change to the IHexWriter, GNU objcopy and llvm-objcopy produce
the same output.
Reviewed By: jhenderson, MaskRay, evgeny777
Differential Revision: https://reviews.llvm.org/D101332
More information about the All-commits
mailing list