[PATCH] D144653: do not collect CFI info on empty functions

Sebastian Pop via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 15:06:27 PST 2023


sebpop added a comment.

The following patch fixes the issue by checking whether the Address is at the beginning of the new symbol.
If the Address is at the beginning of a new symbol, the decode type should not inherit the decode type of the previous symbol:
it should revert back to the default disassembly mode.

  --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
  +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
  @@ -1006,19 +1006,21 @@ static bool shouldAdjustVA(const SectionRef &Section) {
   }
   
   
   typedef std::pair<uint64_t, char> MappingSymbolPair;
   static char getMappingSymbolKind(ArrayRef<MappingSymbolPair> MappingSymbols,
  -                                 uint64_t Address) {
  +                                 uint64_t Address, uint64_t Size) {
     auto It =
         partition_point(MappingSymbols, [Address](const MappingSymbolPair &Val) {
           return Val.first <= Address;
         });
     // Return zero for any address before the first mapping symbol; this means
     // we should use the default disassembly mode, depending on the target.
     if (It == MappingSymbols.begin())
       return '\x00';
  +  if ((It - 1)->first + Size == Address)
  +    return '\x00';
     return (It - 1)->second;
   }
   
   static uint64_t dumpARMELFData(uint64_t SectionAddr, uint64_t Index,
                                  uint64_t End, const ObjectFile &Obj,
  @@ -1751,11 +1753,11 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
           // ARM and AArch64 ELF binaries can interleave data and text in the
           // same section. We rely on the markers introduced to understand what
           // we need to dump. If the data marker is within a function, it is
           // denoted as a word/short etc.
           if (!MappingSymbols.empty()) {
  -          char Kind = getMappingSymbolKind(MappingSymbols, Index);
  +          char Kind = getMappingSymbolKind(MappingSymbols, Index, Size);
             DumpARMELFData = Kind == 'd';
             if (SecondarySTI) {
               if (Kind == 'a') {
                 STI = PrimaryIsThumb ? SecondarySTI : PrimarySTI;
                 DisAsm = PrimaryIsThumb ? SecondaryDisAsm : PrimaryDisAsm;


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

https://reviews.llvm.org/D144653



More information about the llvm-commits mailing list