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

Add --remove-needed-version #564

Open chitao1234 opened 3 months ago

chitao1234 commented 3 months ago

This pr adds a new switch --remove-needed-version, to removing symbol versioning used by libraries like glibc. This switch should fix the use case of issue #284, #252.

I have included a regression test and updated the man page.

jfmherokiller commented 3 months ago

i hope this gets added because i regularly run into this use case when dealing with either legacy software or when copying software to unsusual platforms like the steamdeck.

my current issue is trying to copy waypipe to steamdeck

maxirmx commented 2 months ago

Thank you for the great tool

It works fine with gnu toolchain, but when I compile with clang I get

 patchelf: /home/maxirmx/Projects/tebako/deps/src/_patchelf/src/patchelf.cc:946: void ElfFile<Elf64_Ehdr, Elf64_Phdr, Elf64_Shdr, unsigned long, unsigned long, Elf64_Dyn, Elf64_Sym, unsigned short, Elf64_Verdef, Elf64_Verdaux, Elf64_Verneed, Elf64_Vernaux, Elf64_Rel, Elf64_Rela, 64>::rewriteSectionsExecutable() [Elf_Ehdr = Elf64_Ehdr, Elf_Phdr = Elf64_Phdr, Elf_Shdr = Elf64_Shdr, Elf_Addr = unsigned long, Elf_Off = unsigned long, Elf_Dyn = Elf64_Dyn, Elf_Sym = Elf64_Sym, Elf_Versym = unsigned short, Elf_Verdef = Elf64_Verdef, Elf_Verdaux = Elf64_Verdaux, Elf_Verneed = Elf64_Verneed, Elf_Vernaux = Elf64_Vernaux, Elf_Rel = Elf64_Rel, Elf_Rela = Elf64_Rela, ElfClass = 64]: Assertion `lastReplaced != 0' failed.

Do you think it can be fixed ?

chitao1234 commented 2 months ago

@maxirmx Thanks for your error report.

Could you check the new commit for whether the problem persists?

maxirmx commented 2 months ago

@maxirmx Thanks for your error report.

Could you check the new commit for whether the problem persists?

Thank you, @chitao1234. You have fixed it.

maxirmx commented 2 months ago

@chitao1234 Do you consider releasing this version on your own ?

kcgthb commented 2 days ago

Would love to this new feature merged!