Skip to content
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

Allow forcing a write-out of the ELF binary #590

Open
rhaberkorn opened this issue Feb 25, 2025 · 0 comments
Open

Allow forcing a write-out of the ELF binary #590

rhaberkorn opened this issue Feb 25, 2025 · 0 comments

Comments

@rhaberkorn
Copy link

Is your feature request related to a problem? Please describe.

I stumbled across FreeBSD binaries - well rather Linux binaries run under Linuxulator - that cause the infamous "Program headers not in the first page" error. Turns out such ELF headers are still not supported as of FreeBSD 14.2. I found #153 where the issue was discussed. Indeed, recent patchelf versions write the ELF header at the beginning of the file, thus fixing the issue on FreeBSD.

Unfortunately, you might come across an existing ELF binary, that you would like to fix up without changing any of the settings that patchelf allows you to change.

Describe the solution you'd like

There should be an option to force the write out of a binary even when not changing any of the parameters. E.g. --force.

Describe alternatives you've considered

I found the following workaround:

patchelf --set-interpreter `patchelf --print-interpreter elf-binary` elf-binary

Additional context

I was testing with patchelf 0.14.3 on FreeBSD 14.2-RELEASE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant