aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin@accesssoftek.com>2025-01-23 14:27:40 -0800
committerGitHub <noreply@github.com>2025-01-23 14:27:40 -0800
commit9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a (patch)
treeaaad4d1c5e6f3a8fc7d6af98ad467e2cf92b61ab /llvm/tools/llvm-objcopy/llvm-objcopy.cpp
parentf5bd623d060051f6f6715c153aa60a577df6f540 (diff)
downloadllvm-9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a.zip
llvm-9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a.tar.gz
llvm-9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a.tar.bz2
[llvm-objcopy][ELF] Add an option to remove notes (#118739)
This adds an option `--remove-note=[name/]type` to selectively delete notes in ELF files, where `type` is the numeric value of the note type and `name` is the name of the originator. The name can be omitted, in which case all notes of the specified type will be removed. For now, only `SHT_NOTE` sections that are not associated with segments are handled. The implementation can be extended later as needed. RFC: https://discourse.llvm.org/t/rfc-llvm-objcopy-feature-for-editing-notes/83491
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/llvm-objcopy.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index ad3e604..7e708e3 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -248,6 +248,8 @@ int llvm_objcopy_main(int argc, char **argv, const llvm::ToolContext &) {
return 1;
}
for (ConfigManager &ConfigMgr : DriverConfig->CopyConfigs) {
+ assert(!ConfigMgr.Common.ErrorCallback);
+ ConfigMgr.Common.ErrorCallback = reportWarning;
if (Error E = executeObjcopy(ConfigMgr)) {
logAllUnhandledErrors(std::move(E), WithColor::error(errs(), ToolName));
return 1;