Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(format/elf): parameterize endianness #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/examples/x86/include/format/elf32.inc
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ namespace ELF
ABI := ELFOSABI_NONE
end if

if defined Settings.Endianness
ENDIANNESS := Settings.Endianness
else
ENDIANNESS := ELFDATA2LSB
end if

if MACHINE = EM_386
R_32 = R_386_32
R_PC32 = R_386_PC32
Expand All @@ -221,7 +227,7 @@ namespace ELF

Header:

e_ident db 0x7F,'ELF',ELFCLASS32,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_ident db 0x7F,'ELF',ELFCLASS32,ENDIANNESS,EV_CURRENT,ABI,(16-$) dup 0
e_type dw ET_REL
e_machine dw MACHINE
e_version dd EV_CURRENT
Expand Down
8 changes: 7 additions & 1 deletion core/examples/x86/include/format/elf64.inc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ namespace ELF
ABI := ELFOSABI_NONE
end if

if defined Settings.Endianness
ENDIANNESS := Settings.Endianness
else
ENDIANNESS := ELFDATA2LSB
end if

if MACHINE = EM_X86_64
R_64 = R_X86_64_64
R_32 = R_X86_64_32S
Expand All @@ -199,7 +205,7 @@ namespace ELF

Header:

e_ident db 0x7F,'ELF',ELFCLASS64,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_ident db 0x7F,'ELF',ELFCLASS64,ENDIANNESS,EV_CURRENT,ABI,(16-$) dup 0
e_type dw ET_REL
e_machine dw MACHINE
e_version dd EV_CURRENT
Expand Down
8 changes: 7 additions & 1 deletion core/examples/x86/include/format/elfexe.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ namespace ELF
ABI := ELFOSABI_NONE
end if

if defined Settings.Endianness
ENDIANNESS := Settings.Endianness
else
ENDIANNESS := ELFDATA2LSB
end if

if TYPE = ET_DYN
element DYNAMIC
else
Expand All @@ -120,7 +126,7 @@ namespace ELF

Header:

e_ident db 0x7F,'ELF',CLASS,ELFDATA2LSB,EV_CURRENT,ABI,(16-$) dup 0
e_ident db 0x7F,'ELF',CLASS,ENDIANNESS,EV_CURRENT,ABI,(16-$) dup 0
e_type dw TYPE
e_machine dw MACHINE
e_version dd EV_CURRENT
Expand Down