I am studying the ELF format right now. I have to encode a simple nm diagram (without options). I already print the output of the symbol value and the name of the symbol.
Here's the nm output:
value type name 0000000000600e30 D __DTOR_END__
I have the same one, but without the "type". I use the ELF64_Sym structure as shown below:
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;
I know that I need to use the st_info variable and this macro:
#define ELF64_ST_TYPE(info) ((info) & 0xf)
to get the type of character. But the character type can be a macro as follows:
NAME VALUE STT_NOTYPE 0 STT_OBJECT 1 STT_FUNC 2 STT_SECTION 3 STT_FILE 4 STT_LOPROC 13 STT_HIOPROC 15
And I would like to know how I can get letters printed by nm from these macros, for example:
U, u, A, a, T, t, R, r, W, w
Jérémie charrier
source share