News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Linux Equates and Structures

Started by guga, May 21, 2012, 09:17:42 AM

Previous topic - Next topic

guga

Here are some Linux equates and structures related to the header of Elf files.

They are in RosAsm syntax.
Equates = A simple string name followed by the correspondent hexadecimal value
Structure = Internal rosasm format. Below is the unfolded ones.
Notation:
D$ = dword
W$ = word
B$ = byte
Q$ = qword
#& = equate that was dupped


[Elf32_Ehdr:
e_ident: B$ 0 #&EI_NIDENT
e_type: W$ 0
e_machine: W$ 0
e_version: D$ 0
e_entry: D$ 0
e_phoff: D$ 0
e_shoff: D$ 0
e_flags: D$ 0
e_ehsize: W$ 0
e_phentsize: W$ 0
e_phnum: W$ 0
e_shentsize: W$ 0
e_shnum: W$ 0
e_shstrndx: W$ 0]

[Elf64_Ehdr:
e_ident: B$ 0 #&EI_NIDENT
e_type: W$ 0
e_machine: W$ 0
e_version: D$ 0
e_entry: Q$ 0
e_phoff: Q$ 0
e_shoff: Q$ 0
e_flags: D$ 0
e_ehsize: W$ 0
e_phentsize: W$ 0
e_phnum: W$ 0
e_shentsize: W$ 0
e_shnum: W$ 0
e_shstrndx: W$ 0]

[Elf32_Shdr:
sh_name: D$ 0
sh_type: D$ 0
sh_flags: D$ 0
sh_addr: D$ 0
sh_offset: D$ 0
sh_size: D$ 0
sh_link: D$ 0
sh_info: D$ 0
sh_addralign: D$ 0
sh_entsize: D$ 0]

[Elf64_Shdr:
sh_name: D$ 0
sh_type: D$ 0
sh_flags: Q$ 0
sh_addr: Q$ 0
sh_offset: Q$ 0
sh_size: Q$ 0
sh_link: D$ 0
sh_info: D$ 0
sh_addralign: Q$ 0
sh_entsize: Q$ 0]

[Elf32_Sym:
st_name: D$ 0
st_value: D$ 0
st_size: D$ 0
st_info: B$ 0
st_other: B$ 0
st_shndx: W$ 0]

[Elf64_Sym:
st_name: D$ 0
st_info: B$ 0
st_other: B$ 0
st_shndx: W$ 0
st_value: Q$ 0
st_size: Q$ 0]

[Elf32_Syminfo:
si_boundto: W$ 0
si_flags: W$ 0]

[Elf64_Syminfo:
si_boundto: W$ 0
si_flags: W$ 0]

[Elf32_Rel:
r_offset: D$ 0
r_info: D$ 0]

[Elf64_Rel:
r_offset: Q$ 0
r_info: Q$ 0]

[Elf32_Rela:
r_offset: D$ 0
r_info: D$ 0
r_addend: D$ 0]

[Elf64_Rela:
r_offset: Q$ 0
r_info: Q$ 0
r_addend: Q$ 0]

[Elf32_Phdr:
p_type: D$ 0
p_offset: D$ 0
p_vaddr: D$ 0
p_paddr: D$ 0
p_filesz: D$ 0
p_memsz: D$ 0
p_flags: D$ 0
p_align: D$ 0]

[Elf64_Phdr:
p_type: D$ 0
p_flags: D$ 0
p_offset: Q$ 0
p_vaddr: Q$ 0
p_paddr: Q$ 0
p_filesz: Q$ 0
p_memsz: Q$ 0
p_align: Q$ 0]

[Elf32_Dyn:
d_tag: D$ 0
d_val: d_ptr: D$ 0]

[Elf64_Dyn:
d_tag: Q$ 0
d_val: d_ptr: Q$ 0]

Elf32_Verdef:
vd_version: W$ 0
vd_flags: W$ 0
vd_ndx: W$ 0
vd_cnt: W$ 0
vd_hash: D$ 0
vd_aux: D$ 0
vd_next: D$ 0]

[Elf64_Verdef:
vd_version: W$ 0
vd_flags: W$ 0
vd_ndx: W$ 0
vd_cnt: W$ 0
vd_hash: D$ 0
vd_aux: D$ 0
vd_next: D$ 0]

[Elf32_Verdaux:
vda_name: D$ 0
vda_next: D$ 0]

[Elf64_Verdaux:
vda_name: D$ 0
vda_next: D$ 0]

[Elf32_Verneed:
vn_version: W$ 0
vn_cnt: W$ 0
vn_file: D$ 0
vn_aux: D$ 0
vn_next: D$ 0]

[Elf64_Verneed:
vn_version: W$ 0
vn_cnt: W$ 0
vn_file: D$ 0
vn_aux: D$ 0
vn_next: D$ 0]

[Elf32_Vernaux:
vna_hash: D$ 0
vna_flags: W$ 0
vna_other: W$ 0
vna_name: D$ 0
vna_next: D$ 0]

[Elf64_Vernaux:
vna_hash: D$ 0
vna_flags: W$ 0
vna_other: W$ 0
vna_name: D$ 0
vna_next: D$ 0]

[Elf32_auxv_t:
a_type: D$ 0
a_val: a_ptr: a_fcn: D$ 0]

[Elf64_auxv_t:
a_type: D$ 0
a_val: a_ptr: a_fcn: D$ 0]

[Elf32_Nhdr:
n_namesz: D$ 0
n_descsz: D$ 0
n_type: D$ 0]

[Elf64_Nhdr:
n_namesz: D$ 0
n_descsz: D$ 0
n_type: D$ 0]

[Elf32_Move:
m_value: Q$ 0
m_info: D$ 0
m_poffset: D$ 0
m_repeat: W$ 0
m_stride: W$ 0]

[Elf64_Move:
m_value: Q$ 0
m_info: Q$ 0
m_poffset: Q$ 0
m_repeat: W$ 0
m_stride: W$ 0]

[Elf32_gptab_gt_header:
gt_current_g_value: D$ 0
gt_unused: D$ 0]

[Elf32_gptab_gt_entry:
gt_g_value: D$ 0
gt_bytes: D$ 0]

[Elf32_RegInfo:
ri_gprmask: D$ 0
ri_cprmask   D$ 0 #4
ri_gp_value: D$ 0]

[Elf_Options:
kind: B$ 0
size_: B$ 0
section: W$ 0
info: D$ 0]

[Elf_Options_Hw:
hwp_flags1: D$ 0
hwp_flags2: D$ 0]

[Elf32_Lib:
l_name: D$ 0
l_time_stamp: D$ 0
l_checksum: D$ 0
l_version: D$ 0
l_flags: D$ 0]

[Elf64_Lib:
l_name: D$ 0
l_time_stamp: D$ 0
l_checksum: D$ 0
l_version: D$ 0
l_flags: D$ 0]


I hope it helps someone.

Best Regards,
guga
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

anta40

So, does it mean that Rosasm is able to generate Linux executables?

guga

No...not so soon. I just made that way due to some changes i´m making for the debugger.

Exporting to linux (under wine) files shouldn´t be hard at all, but i didn´t have time to build it, neither have linux (and wine) here on my PC to test
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com