[clang] [llvm] [MC,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 06:51:15 PDT 2024


================
@@ -292,6 +293,9 @@ 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;
----------------
smithp35 wrote:

Are there any thread-safety concerns here?

It looks like this can be modified when obtaining an iterator? 

Just thinking of a use case where multiple threads given a const reference to an ELFObjectFile iterate through different CREL sections in the same object.

There may be no expectation that this would work though.

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


More information about the cfe-commits mailing list