facebookarchive / BOLT

Binary Optimization and Layout Tool - A linux command-line utility used for optimizing performance of binaries
2.52k stars 178 forks source link

ELF64BE case support problem #158

Open deeeepblue opened 3 years ago

deeeepblue commented 3 years ago

Hello, I have been trying to use BOLT with a 64-bit BE ELF but got the error below: BOLT-ERROR: only 64-bit LE ELF binaries are supported

Here are some header info of my ELF: `ELF Header:

Class: ELF64 Data: 2's complement, big endian OS/ABI: UNIX - System V Type: REL (Relocatable file) Machine: AArch64`

As it is not possible to change my ELF into 64-bit LE, does it posible to make BOLT support ELF64BE by modifying the source code? And how can I modity it?

rafaelauler commented 3 years ago

That's an interesting question, I've never tested that. I think we will break badly in some places if we just accept big endian. If I'm not mistaken we have explicit little endian writing when we patch some places. But I might be wrong and it could be easier than I think.

I would pay extra attention to support::ulittle code in BOLT, and also some templates we specialize when reading ELF object files.

In theory, it is possible, yes.

deeeepblue commented 3 years ago

Thanks for your reply. By the way, do you and your team have any plans to support big endian?

rafaelauler commented 3 years ago

Not at the moment