Skip to content

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

Description

@rhaberkorn

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions