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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 01:00:44 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,
----------------
jh7370 wrote:

Rather than pass the iterator (which in turn requires knowing the container type when it's irrelevant to the code), could you pass the section (or section pointer/reference) itself?

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


More information about the llvm-commits mailing list