title: How to display the symbol's type like the nm command?
body: <p>I'm studying the ELF format right now. I have to code a simple nm fonction (without the options).
  I'm already printing on the output the symbol's value and the symbol's name.</p>
  
  <p>Here's the nm output :</p>
  
  <pre><code>value             type    name
  0000000000600e30  D       __DTOR_END__
  </code></pre>
  
  <p>I have the same one, but without the 'type'. I am using the ELF64_Sym structure, as follow :</p>
  
  <pre><code>typedef struct {
      Elf64_Word      st_name;
      unsigned char   st_info;
      unsigned char   st_other;
      Elf64_Half      st_shndx;
      Elf64_Addr      st_value;
      Elf64_Xword     st_size; 
  } Elf64_Sym;
  </code></pre>
  
  <p>I know that I have to use the st_info variable and this macro :</p>
  
  <pre><code>#define ELF64_ST_TYPE(info)          ((info) &amp; 0xf)
  </code></pre>
  
  <p>to get the symbol's type. But, the symbol type can be a macro as follow :</p>
  
  <pre><code>NAME            VALUE
  STT_NOTYPE      0
  STT_OBJECT      1
  STT_FUNC        2
  STT_SECTION     3
  STT_FILE        4
  STT_LOPROC      13
  STT_HIOPROC     15
  </code></pre>
  
  <p>And I would like to know is how can I get from these macros the letters printed by nm, example:</p>
  
  <pre><code> U, u, A, a, T, t, R, r, W, w
  </code></pre>