[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty
authorPatrick Oppenlander <patrick.oppenlander@gmail.com>
Mon, 1 Feb 2021 23:01:25 +0000 (15:01 -0800)
committerFangrui Song <i@maskray.me>
Mon, 1 Feb 2021 23:01:25 +0000 (15:01 -0800)
commit93345e825a0733f6a67898f6d6d156ff56db80e7
treec67f56829fd046dc3f9384d99eee005a92b10141
parent8e661d3d9c52ea9e5e68cbf699701d9cfa071a8f
[llvm-objcopy] -O binary: consider SHT_NOBITS sections to be empty

This is consistent with BFD objcopy.

Previously llvm objcopy would allocate space for SHT_NOBITS sections
often resulting in enormous binary files.

New test case (binary-paddr.test %t6).

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D95569
llvm/test/tools/llvm-objcopy/ELF/binary-paddr.test
llvm/tools/llvm-objcopy/ELF/Object.cpp