glibc_version_header icon indicating copy to clipboard operation
glibc_version_header copied to clipboard

Proposal: Alternative glibc downgrade method using patchelf

Open mid-kid opened this issue 3 years ago • 3 comments

patchelf has recently added a new option, named --clear-symbol-version. This clears the symbol version of the specified symbol, making it load any available version (not sure if newest or oldest) instead.

This could be expanded to simply change the symbol version, to achieve the same effect as these headers do, but on already compiled binaries. That would avoid having to rebuild existing binaries, such as miscellaneous system libraries, and indirectly would solve the libgcc/libstdcxx issue, by linking them statically and fixing the symbol versions. This might be useful to create AppImages on systems with newer glibc versions, as linuxdeploy already uses patchelf to fix the RPATH.

Would this work? Am I missing anything, aside from occasional breakage between glibc versions due to glibc header/macro mismatches?

mid-kid avatar Dec 13 '20 20:12 mid-kid

I think a better alternative would be a program that can load the executable, patch it on the fly to use the system's older glibc version (for example by intercepting system calls). Aside from hurting performance, it would allow anyone to run any program on older systems.

matonga avatar Nov 05 '22 14:11 matonga

Would this work? Am I missing anything

You'd probably get missing symbols errors from the linker. You'd have to implement noops for those somehow. And that might break features...

probonopd avatar Nov 05 '22 14:11 probonopd

How would it give any linker errors that wouldn't happen with the headers in this repo already? From what I gather, these headers simply change symbol versions in the binary during the assembly stage, producing symbols with invalid versions if they don't exist in the target glibc version. How's this different from changing it in the compiled binary?

mid-kid avatar Nov 06 '22 23:11 mid-kid