================
@@ -292,6 +295,11 @@ template <class ELFT> class ELFObjectFile : public 
ELFObjectFileBase {
   const Elf_Shdr *DotSymtabSec = nullptr; // Symbol table section.
   const Elf_Shdr *DotSymtabShndxSec = nullptr; // SHT_SYMTAB_SHNDX section.
 
+  // Hold CREL relocations for SectionRef::relocations().
+  mutable SmallVector<SmallVector<Elf_Crel, 0>, 0> Crels;
+  // Hold CREL decoding errors.
+  mutable SmallVector<std::string, 0> CrelErrs;
----------------
smithp35 wrote:

I expect that most objects would have no decoding errors, yet it looks like 
we're allocating a potentially large (intermediate ELF file as output of LTO 
for example) amount of empty strings.

An alternative could be an unordered_map of section indexes to strings. This 
would also look a bit cleaner than just checking if the string is empty for no 
errors.

I don't have a strong opinion though.

https://github.com/llvm/llvm-project/pull/97382
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to