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
Don't support elf file? #425
Comments
What is an |
Like .out/.o file: |
According to Wikipedia
There's sadly no issue template where I can see what info is needed for a new type to be added but I'll try my best: Magic numbers (hex): You can find some additional information on https://manpages.debian.org/buster/manpages/elf.5.en.html |
if (check([0x7F, 0x45, 0x4c, 0x46])) {
return ['', 'application/x-elf'];
} should work. not sure what to do about file extensions; generally when you're checking the filetype of a binary it probably won't have an extension |
Was this fixed with #514 ? |
Hi, folks: I had posted a comment to Sindre via Twitter, who suggested that I repeat it here. The ELF file format is the standard executable format for Linux/Unix, the same way that the Portable Executable format is for Windows. Typically in Unix land, one doesn't use file extensions for executables. Instead, you need to check headers and magic numbers as you have been doing. You managed to spot the magic number, but what you might not realize is that it spells out Unicode character 0x7f followed by 'ELF'. There's a C library called BFD (binary file descriptors), which is part of the binutils project (https://www.gnu.org/software/binutils/) that makes file checking quite a bit easier.Binutils is also the home for the GNU assembler (gas) and is considered a core part of all Linux distributions. It's also available for Windows via Cygwin and Mac, as well as other OS platforms. If you want more details on the ELF file format specifically, note that the specification doesn't exist on its own. It's part of the Unix ABI (Application Binary Interface) specification at http://www.sco.com/developers/devspecs/gabi41.pdf. Chapters 4 and 5 provide relevant details on the ELF format. I've been programming on Linux for...eeek, a couple of decades now, so if you need more information, please feel free to contact me at robygamboa@gmail.com. |
I try to parse an elf file but it return undefined and can't find elf file from "Supported file types".
The text was updated successfully, but these errors were encountered: