[llvm-objcopy][ELF] Add --set-section-type
authorFangrui Song <i@maskray.me>
Wed, 13 Jul 2022 17:04:21 +0000 (10:04 -0700)
committerFangrui Song <i@maskray.me>
Wed, 13 Jul 2022 17:04:21 +0000 (10:04 -0700)
commitb28412d5397dc5a23f172d6ebeac760c82a82248
treea05095acda126839c245f260d53d4157023d8029
parent31cccebb5c811a3d63146005d15a4e3b4f819980
[llvm-objcopy][ELF] Add --set-section-type

The request is mentioned on D129053. I feel that having this functionality is
mildly useful (not strong).

* Rename .ctors to .init_array and change sh_type to SHT_INIT_ARRAY (GNU objcopy
  detects the special name but we don't).
* Craft tests for a new SHT_LLVM_* extension

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D129337
llvm/docs/CommandGuide/llvm-objcopy.rst
llvm/include/llvm/ObjCopy/CommonConfig.h
llvm/lib/ObjCopy/ConfigManager.cpp
llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
llvm/test/tools/llvm-objcopy/ELF/add-section-and-set-attr.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/ELF/add-section-and-set-flags.test [deleted file]
llvm/test/tools/llvm-objcopy/ELF/set-section-alignment.test
llvm/test/tools/llvm-objcopy/ELF/set-section-attr-and-rename.test
llvm/test/tools/llvm-objcopy/ELF/set-section-type.test [new file with mode: 0644]
llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
llvm/tools/llvm-objcopy/ObjcopyOpts.td