-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Add option to replace an imported symbol #416
Comments
Sorry for the late response. I just now catched up with the latest issues and PRs in the project again. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
This might be helpful: #459 |
I think this can be closed after #459 was merged |
#459 is failing for me in RyanGibb/nixos@62a7d09 with: |
Thanks for reporting this! I'll investigate. |
Thank you @brenoguim! You can build it (on |
Opened a PR with a fix: #473 |
It works! |
Oops, I force pushed. That might affect your patch (I don't know if the hash is still valid). |
Thanks for the heads up! I don't think github garbage collects repositories that often, but I'll update date it if it becomes an issue (and when it's merged anyway). |
I am getting the span access out of range with rename-dynamic-symbols.sh and I am building for s390x, Error below, [ 17s] renaming dynamic symbol f1450 to f1450_special_suffix Created #503 for the same. |
Is your feature request related to a problem? Please describe.
Using the rpath arguments (e.g.
--add-rpath
), patchelf can override the location of libraries. However, libraries have other ways of depending on file system paths. A common example is drivers containing a hard-coded path to firmware binaries, which the libraryfopen()
s.Example: Broadcom fingerprint driver, the .so contains a hardcoded path to
/var/lib/fprint/fw
.Currently it is difficult to replace such paths.
Describe the solution you'd like
Add a new argument to patchelf,
--replace-symbol NAME_ORIG NAME_NEW
. If specified, patchelf will iterate over the symbol table (.dynsym
section), and replace the symbol with the name NAME_ORIG with NAME_NEW, adding it to the.dynstr
section if neccessary.This allows one to replace the
fopen
call from the library with a wrapper function, which can inspect the path it receives and change it if neccessary.Example invocation:
Describe alternatives you've considered
buildFHSUserEnv
from nixpkgs to give the process the filesystem layout it needs.These methods have the disadvantage that they affect an entire process tree, not just the single library that needs patching.
Additional context
I have a prototype quality implementation of this feature. If this feature request is accepted, I'll clean it up and add tests/documentation for it.
Upstreaming of this feature has been requested by the iscan-snap project, which attempts to package scanner drivers using snap.
The text was updated successfully, but these errors were encountered: