Herschel icon indicating copy to clipboard operation
Herschel copied to clipboard

Elf: no symbol hash table

Open X547 opened this issue 4 years ago • 7 comments

This is https://github.com/adimetrius/Herschel/commit/cc4bead0534a6824bca446a8d906e7952b0d8ffd.

Symbol hash table is not present in Albert sample. It is required to know length of symbol table.

See my ElfDecoder report for details: https://github.com/adimetrius/Herschel/files/5621861/Albert.zip.

X547 avatar Dec 01 '20 10:12 X547

Haiku refuse to load ELF modules without symbol hash table: elf_load_image.cpp:387.

X547 avatar Dec 02 '20 08:12 X547

Correct, symbol hash table is not implemented yet. It will be.

Your ElfDecoder report is awesome! Is the decoder available? Woudl it work in regular BB? I wish I had known about it - otherwise I had to use obsolete command-line-style readelf.

adimetrius avatar Dec 02 '20 09:12 adimetrius

Your ElfDecoder report is awesome!

I ported 64 bit disassembler (HrDecoder) into my ElfDecoder today. New report: Albert.zip. I adjusted test program a bit and made quick and dirty fix for #3. I will publish ElfDecoder later.

X547 avatar Dec 02 '20 10:12 X547

ElfDecoder is published at https://github.com/X547/OberonUtils/tree/master/PE%20Decoder (module WorkElfDecoder, usage: WorkElfDecoder.Decode "<path>").

X547 avatar Dec 02 '20 10:12 X547

Mind you that HrDecoder is FAR FAR from being a complete 64-bit disassembler. It is based on the DevDecoder shipped with BB, which is 32-bit, and I've only changed (some of) the instructions that I generate in HrL. However, I introduced in it an attempt to detect procedure and variable references.

adimetrius avatar Dec 02 '20 12:12 adimetrius

Mind you that HrDecoder is FAR FAR from being a complete 64-bit disassembler.

It is still better than nothing. I got a lot of *** decode error *** when decoding C++ applications, errors are mostly SSE related. Also I added support for multi-byte NOP (0F 1F), that are often present in executables. I don't know any better x86_64 disassemblers that can be easily ported to Component Pascal.

I introduced in it an attempt to detect procedure and variable references.

I recommend to handle disassembly and address to symbol name lookup in separate modules. In my decoders there are multiple disassembly modules with common interface that are dynamically loaded by module decoder. Address resolution is handled by module decoder. Disassembler call WorkDecoders.Handler.PutAdr to display address. This approach is used in DevDecoder, but it can't resolve addresses.

X547 avatar Dec 02 '20 12:12 X547

Still present In HrBinder.

X547 avatar Jan 01 '21 02:01 X547