diff options
author | Igor Kudrin <ikudrin@accesssoftek.com> | 2025-01-23 14:57:29 -0800 |
---|---|---|
committer | Igor Kudrin <ikudrin@accesssoftek.com> | 2025-01-23 14:57:29 -0800 |
commit | 621e5cd8204596874c2ec7c8c169044d8e6865e3 (patch) | |
tree | 2735e3fbd7c6f1213c5bcfdf99af2616e7e9be6a /llvm/tools/llvm-objcopy | |
parent | 4f0325873faccfbe171bae4babceb65975ca892e (diff) | |
download | llvm-621e5cd8204596874c2ec7c8c169044d8e6865e3.zip llvm-621e5cd8204596874c2ec7c8c169044d8e6865e3.tar.gz llvm-621e5cd8204596874c2ec7c8c169044d8e6865e3.tar.bz2 |
Revert "[llvm-objcopy][ELF] Add an option to remove notes (#118739)"
This reverts commit 9324e6a7a5c5adc5b5c38c3e3cbecd7e1e98876a.
Diffstat (limited to 'llvm/tools/llvm-objcopy')
-rw-r--r-- | llvm/tools/llvm-objcopy/ObjcopyOptions.cpp | 55 | ||||
-rw-r--r-- | llvm/tools/llvm-objcopy/ObjcopyOpts.td | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 2 |
3 files changed, 0 insertions, 61 deletions
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp index 0d20959..0925fc5 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp +++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp @@ -538,38 +538,6 @@ static Expected<NewSymbolInfo> parseNewSymbolInfo(StringRef FlagValue) { return SI; } -static Expected<RemoveNoteInfo> parseRemoveNoteInfo(StringRef FlagValue) { - // Parse value given with --remove-note option. The format is: - // - // [name/]type_id - // - // where: - // <name> - optional note name. If not given, all notes with the specified - // <type_id> are removed. - // <type_id> - note type value, can be decimal or hexadecimal number prefixed - // with 0x. - RemoveNoteInfo NI; - StringRef TypeIdStr; - if (auto Idx = FlagValue.find('/'); Idx != StringRef::npos) { - if (Idx == 0) - return createStringError( - errc::invalid_argument, - "bad format for --remove-note, note name is empty"); - NI.Name = FlagValue.slice(0, Idx); - TypeIdStr = FlagValue.substr(Idx + 1); - } else { - TypeIdStr = FlagValue; - } - if (TypeIdStr.empty()) - return createStringError(errc::invalid_argument, - "bad format for --remove-note, missing type_id"); - if (TypeIdStr.getAsInteger(0, NI.TypeId)) - return createStringError(errc::invalid_argument, - "bad note type_id for --remove-note: '%s'", - TypeIdStr.str().c_str()); - return NI; -} - // Parse input option \p ArgValue and load section data. This function // extracts section name and name of the file keeping section data from // ArgValue, loads data from the file, and stores section name and data @@ -1253,29 +1221,6 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> ArgsArr, }; } - for (auto *Arg : InputArgs.filtered(OBJCOPY_remove_note)) { - Expected<RemoveNoteInfo> NoteInfo = parseRemoveNoteInfo(Arg->getValue()); - if (!NoteInfo) - return NoteInfo.takeError(); - - ELFConfig.NotesToRemove.push_back(*NoteInfo); - } - - if (!ELFConfig.NotesToRemove.empty()) { - if (!Config.ToRemove.empty()) - return createStringError( - errc::invalid_argument, - "cannot specify both --remove-note and --remove-section"); - if (!Config.AddSection.empty()) - return createStringError( - errc::invalid_argument, - "cannot specify both --remove-note and --add-section"); - if (!Config.UpdateSection.empty()) - return createStringError( - errc::invalid_argument, - "cannot specify both --remove-note and --update-section"); - } - if (Config.DecompressDebugSections && Config.CompressionType != DebugCompressionType::None) { return createStringError( diff --git a/llvm/tools/llvm-objcopy/ObjcopyOpts.td b/llvm/tools/llvm-objcopy/ObjcopyOpts.td index fbc6a59..434b5ff 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOpts.td +++ b/llvm/tools/llvm-objcopy/ObjcopyOpts.td @@ -297,7 +297,3 @@ defm pad_to "of zero or the value specified by the --gap-fill option. " "This option is only supported for ELF input and binary output">, MetaVarName<"address">; - -defm remove_note - : Eq<"remove-note", "Remove note(s) with <type_id> and optional <name>">, - MetaVarName<"[name/]type_id">; diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index 7e708e3..ad3e604 100644 --- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -248,8 +248,6 @@ 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; |