llvm-project/llvm/test/tools/llvm-objcopy/COFF
Martin Storsjö 30d5b755ea [llvm-objcopy] [COFF] Always set PointerToRawData when writing a COFF file
If we don't want to set PointerToRawData, for an empty section,
we do must set it to zero explicitly. Some object file generators
do set it to zero for empty sections, while others set a nonzero
value pointing at the end of the previous section.

If the value was nonzero on input, we need to update it - either
setting it to zero, or to a valid offset in the output file (not
out of bounds)

This fixes https://github.com/mstorsjo/llvm-mingw/issues/313.

Testing this is tricky, because we can't use yaml2obj, since that
doesn't produce object files with nonzero PointerToRawData for
empty sections. We can use llvm-mc to assemble a small file
(assuming that LLVM's MC layer keeps this behaviour), or bundle
a small binary object file. I opted for using llvm-mc for now here
(with a test that it actually does keep this property), but I don't
mind changing it to a canned object file to make the test less brittle.

Differential Revision: https://reviews.llvm.org/D138783
2022-11-28 22:40:00 +02:00
..
Inputs
add-gnu-debuglink.test
add-section-and-set-flags.test
add-section.test
basic-copy.test
bigobj.test
check-debug-dir-present.test
debug-dir-unmapped.test
debug-entry-no-payload.test
discard-all.test
empty-sections.s [llvm-objcopy] [COFF] Always set PointerToRawData when writing a COFF file 2022-11-28 22:40:00 +02:00
only-keep-debug.test [llvm-objcopy] Make llvm-strip --only-keep-debug suppress default --strip-all 2022-04-18 14:16:10 -07:00
only-section.test
patch-debug-dir.test
patch-debug-dir2.test
pe-fields.test
redefine-symbol.test
remove-section.test
section-name-encoding.s
set-section-flags.test
strip-all.test
strip-debug.test
strip-reloc-symbol.test
strip-symbol.test
strip-unneeded.test
subsystem.test
update-section.test
weak-external.test