[PATCH] D144783: [ELF] Move getSectionAndRelocations to ELF.cpp from ELFDumper.cpp

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 09:50:03 PST 2023


aidengrossman added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:7052
+
+  for (const auto &CGMapEntry : *SecToRelocMapOrErr) {
     const Elf_Shdr *CGSection = CGMapEntry.first;
----------------
rahmanl wrote:
> Just noticed this loop doesn't check that the map value is not nullptr.
> 
> If you're willing to fix it, please add something similar:
> ```
>     // Warn about call graph profile sections without a relocation section.
>     if (!CGRelSection) {
>       reportWarning(createError("SHT_LLVM_CALL_GRAPH_PROFILE (" + describe(*CGSection) +
>                                 ") does not have a corresponding "
>                                 "relocation section"),
>                     FileName);
>       continue;
>     }
> ```
It does, just within the `getSymbolIndices()` function. Lines 7008 and 7025 in the revision you submitted this comment on.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144783/new/

https://reviews.llvm.org/D144783



More information about the llvm-commits mailing list