You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After removing a DT_NEEDED with --remove-needed, the removed string still appears in STRTAB, only the reference is removed in the dynamic section.
It would be nice to add an option --clean-strtab that can be used to remove all unreferenced (orphan) strings from STRTAB. I know this is not trivial, because all references to STRTAB have to be rewritten...
Maybe print the removed strings from STRTAB when using --verbose too.
The text was updated successfully, but these errors were encountered:
Yes, it seems the issue #453 is the same root cause: only the .dynamic is changed to remove the reference to the string, but it still leaves the orphaned string in .dynstr. My suggested cleanup of .dynstr will also solve that.
I have been looking into how to clean up the .dynstr, removing all unreferenced strings, but my C++ skills are not so great. There are quite a few sections that can refer strings in .dynstr. After removing the unreferenced string(s), all offsets that refer to strings after the removed one(s) have to be updated and then the .dynstr can be shrunk. I wonder if after shrinking .dynstr, I probably need to call 'rewrite_sections', right?
Once I have it working, I can make a pull request and you can convert some C code into more C++, agree @amjoseph-nixpkgs ?
I was thinking that .dynstr could also be 'optimized' by sharing strings like 'vsprintf' with 'sprintf' and 'printf', but apparently the GNU linker already does that! This also means that for refcounting, not only the beginning of a string in .strtab should be considered, but the whole range of the string.
After removing a DT_NEEDED with --remove-needed, the removed string still appears in STRTAB, only the reference is removed in the dynamic section.
It would be nice to add an option --clean-strtab that can be used to remove all unreferenced (orphan) strings from STRTAB. I know this is not trivial, because all references to STRTAB have to be rewritten...
Maybe print the removed strings from STRTAB when using --verbose too.
The text was updated successfully, but these errors were encountered: