[PATCH] D72973: using symbol index+symbol name + storage mapping class as label for llvm-objdump -D

Digger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 13:59:43 PST 2020


DiggerLin marked an inline comment as done.
DiggerLin added inline comments.


================
Comment at: llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h:23
 	StringRef Name;
-	uint8_t   Type;
+        int16_t TypeOrSmc;
+        int64_t Index;
----------------
daltenty wrote:
> I think using a union or inheritance is probably better than dual purposing this field.
I am prefer to keep current  implement , in the binaryformat/ELF.h , there is no  enum type for  // Symbol types.
enum {
  STT_NOTYPE = 0,     // Symbol's type is not specified
  STT_OBJECT = 1,     // Symbol is a data object (variable, array, etc.)
  STT_FUNC = 2,       // Symbol is executable code (function, etc.)
  STT_SECTION = 3,    // Symbol refers to a section
  STT_FILE = 4,       // Local, absolute symbol that refers to a file
  STT_COMMON = 5,     // An uninitialized common block
  STT_TLS = 6,        // Thread local data object
  STT_GNU_IFUNC = 10, // GNU indirect function
  STT_LOOS = 10,      // Lowest operating system-specific symbol type
  STT_HIOS = 12,      // Highest operating system-specific symbol type
  STT_LOPROC = 13,    // Lowest processor-specific symbol type
  STT_HIPROC = 15,    // Highest processor-specific symbol type

  // AMDGPU symbol types
  STT_AMDGPU_HSA_KERNEL = 10
};

as we discuss offline , if we use the union for the this field, we need to modify the 
ELF.h and add enum name first. I do not want this patch to go further.

I can add comment here in the source code.
        int16_t TypeOrSmc;  ///< For Elf, it stores the symbol type,
                           ///< for XCOFF, it store the storage mapping class if there is, other wise it store -1. 

even if I use the union here for example.
union {
 ELFType Type;
 StorageMappingClass Smc;
 }

how can I use the union , for example 
AllSymbols[*SecI].emplace_back(  .....) ;

or I need the code like 
if(obj->isXCOFF())
   AllSymbols[*SecI].emplace_back( .... )
else if (obj->isELF())
   AllSymbols[*SecI].emplace_back(..... )





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72973





More information about the llvm-commits mailing list