[llvm] [llvm-objcopy][ELF] Add an option to remove notes (PR #118739)

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 20:46:24 PST 2025


================
@@ -2154,25 +2154,20 @@ ELFWriter<ELFT>::ELFWriter(Object &Obj, raw_ostream &Buf, bool WSH,
     : Writer(Obj, Buf), WriteSectionHeaders(WSH && Obj.HadShdrs),
       OnlyKeepDebug(OnlyKeepDebug) {}
 
-Error Object::updateSection(StringRef Name, ArrayRef<uint8_t> Data) {
-  auto It = llvm::find_if(Sections,
-                          [&](const SecPtr &Sec) { return Sec->Name == Name; });
-  if (It == Sections.end())
-    return createStringError(errc::invalid_argument, "section '%s' not found",
-                             Name.str().c_str());
-
+Error Object::updateSectionData(std::vector<SecPtr>::iterator It,
----------------
igorkudrin wrote:

On the other hand, we can pass `SecPtr&` instead of an iterator, which simplifies the code, and still allows the element of the container to be updated. Fixed, thanks.

https://github.com/llvm/llvm-project/pull/118739


More information about the llvm-commits mailing list