gimli-rs / object

A unified interface for reading and writing object file formats
https://docs.rs/object/
Apache License 2.0
673 stars 156 forks source link

Elf: Error while processing .so file #704

Closed mcbegamerxx954 closed 4 months ago

mcbegamerxx954 commented 4 months ago

Hi, im using the object-rewrite crate in a tool that patches a needed library into aarch64 libminecraft.so the library of the minecraft app for android, but while processing the file it gets this error: Unaligned sh_offset value 0x228be4 for section '.gnu.version_r', expected 0x228be8 is there any fix?, the library loads fine on my device after testing, armv7a patching works fine for some reason

philipc commented 4 months ago

I need to be able to reproduce the problem to be able to fix it. Where can I download the .so?

mcbegamerxx954 commented 4 months ago

I need to be able to reproduce the problem to be able to fix it. Where can I download the .so?

I dont really know how i can go about this since its a paid android game, but im open for testing with my copy

philipc commented 4 months ago

I've previously seen a similar error on another .so: Unsupported sh_offset value 0xb878 for section '.gnu.version_r', expected at least 0xb880. I guess it's possible that it is the same cause, so I'll try fixing that and see if it helps.

philipc commented 4 months ago

Can you test if #705 fixes it for you?

philipc commented 4 months ago

In the likely event that doesn't help, can you give me the output of running: target/debug/readobj --file-header --segments --sections libminecraft.so

mcbegamerxx954 commented 4 months ago

That did not work, but here is the readobj output result.txt

philipc commented 4 months ago

I think #706 will fix this.

mcbegamerxx954 commented 4 months ago

That seems to fix it, thanks!

mcbegamerxx954 commented 4 months ago

Oops, forgot to wait for merge