[llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flags
authorJordan Rupprecht <rupprecht@google.com>
Tue, 2 Apr 2019 16:49:56 +0000 (16:49 +0000)
committerJordan Rupprecht <rupprecht@google.com>
Tue, 2 Apr 2019 16:49:56 +0000 (16:49 +0000)
commit017deaf1ae3aa84211a416a37e2c895a18c2a5e3
tree21eab025bd9e13e8fd5bf324afb2a48ee8436bf9
parent5050586860140b55a0cc68c77dd1438f44a23ca5
[llvm-objcopy] Change SHT_NOBITS to SHT_PROBITS for some --set-section-flags

Summary:
Some flags accepted by --set-section-flags and --rename-section can change a SHT_NOBITS section to a SHT_PROGBITS section. Note that none of them can change a SHT_PROGBITS to SHT_NOBITS.

The full list (found via experimentation of individually setting each flag) that does this is: contents, load, noload, code, data, rom, and debug.

This was found by testing llvm-objcopy with the gnu binutils test suite, specifically this test case: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/testsuite/binutils-all/copy-1.d;h=f2b0d9e90df738c2891b4d5c7b62f62894b556ca;hb=HEAD

Reviewers: jhenderson, grimar, jakehehrlich, alexshap, espindola

Reviewed By: jhenderson

Subscribers: emaste, arichardson, MaskRay, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59958

llvm-svn: 357492
llvm/test/tools/llvm-objcopy/ELF/rename-section-flag.test
llvm/test/tools/llvm-objcopy/ELF/set-section-flags.test
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp