Skip to content

Commit

Permalink
Merge pull request #42 from staticfloat/sf/platform_extraction
Browse files Browse the repository at this point in the history
Add FreeBSD ELF detection
  • Loading branch information
staticfloat authored Aug 25, 2023
2 parents 68cb7f5 + 4e37745 commit 2dce787
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ELF/ELFHandle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ end

## Format-specific properties:
header(oh::ELFHandle) = oh.header
Platform(oh::ELFHandle) = strip_libc_tag(Platform(elf_machine_to_arch(oh.header.e_machine), "linux"))
function Platform(oh::ELFHandle)
arch = elf_machine_to_arch(oh.header.e_machine)
if oh.ei.osabi == ELFOSABI_LINUX || oh.ei.osabi == ELFOSABI_NONE
return strip_libc_tag(Platform(arch, "linux"))
elseif oh.ei.osabi == ELFOSABI_FREEBSD
return Platform(arch, "freebsd")
else
throw(ArgumentError("Unknown ELF OSABI $(oh.ei.osabi)"))
end
end
endianness(oh::ELFHandle) = elf_internal_endianness(oh.ei)
is64bit(oh::ELFHandle) = elf_internal_is64bit(oh.ei)
isrelocatable(oh::ELFHandle) = header(oh).e_type == ET_REL
Expand Down

0 comments on commit 2dce787

Please sign in to comment.