NixOS / patchelf

A small utility to modify the dynamic linker and RPATH of ELF executables
GNU General Public License v3.0
3.57k stars 486 forks source link

Version of gcc compiler effects correctness of patchelf 0.18 #557

Open dragon512 opened 5 months ago

dragon512 commented 5 months ago

Describe the bug

When moving from 0.15 to 0.18 all my builds broke on rhel7/8/9. The issue shows up as traffic_server: error while loading shared libraries: libhwloc.so.15: ELF load command address/offset not properly aligned

Steps To Reproduce

compile code with a compiler less than gcc 12 ( which is common on rhel system) and run patchelf to change the run path. running the program will result in the aligned error from above.

The workaround is to recompile the code gcc 12 ( available on rhel with devtool ) If using the older compile I found I had to move back to 0.15

Expected behavior

It should not break the binary based on the compiler

Additional context

This is more of a note as many issues here may have the same problem. just using a newer compiler fixed the problem with patchelf.

adam-azarchs commented 4 months ago

Seems like this is possibly a duplicate of https://github.com/NixOS/patchelf/issues/528? The thing about alignment issues is that there are a lot of things that can affect whether or not one hits the bug.