<div><div dir="auto">Hey Michael,</div></div><div dir="auto"><br></div><div dir="auto">I completely agree that setting the rpath properly the first time around is much preferred. But, changes to the binary, particularly during development is much quicker.<br></div><div dir="auto"><br></div><div dir="auto">Prebuilt libraries which are being repackaged is one use case that is missed.<br></div><div dir="auto"><br></div><div dir="auto">In the past, I’ve even used it to repair am incorrectly built library which was missing the library name.</div><div dir="auto"><br></div><div dir="auto">There are a few different approaches to implementing this, and I am not particularly tied to one. I think that selecting the one that is in the best interest of the project and the most maintainable long term would be best.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 11, 2019 at 10:12 PM Michael Trent <<a href="mailto:mtrent@apple.com">mtrent@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hi there,<div><br></div><div>This tool has been around for a long time. Originally it gave people a way to move a dylib to a new location without rebuilding, and then as a way to make an existing dylib embeddable (@rpath). I wonder if this tool is really necessary. It’s always better to make the dylib with the correct install name at build time, including @rpath, etc.. Most dylibs we see any more are either installed in fixed file system locations by OS vendors (i.e., Apple) or are embedded @rpath dylibs installed by everyone else. </div><div><br></div><div>Is there a use-case for install_name_tool that I have overlooked?</div><div><br></div><div>Or Is that small set of dylibs meant to be installed in fixed file system locations large / complex enough that people really need to install them in many different locations without simply relinking the files? </div><div><br></div><div>Turning to practical matters, is your intent to have the load-command rewriting code live in the tool? Or are you proposing adding support for building/swapping/rewriting Object files to libObject?</div><div><br></div><div>MDT</div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><br><div><br><blockquote type="cite"><div>On Oct 11, 2019, at 10:31 AM, Alexander Shaposhnikov <<a href="mailto:alexander.v.shaposhnikov@gmail.com" target="_blank">alexander.v.shaposhnikov@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><span style="margin:0px;padding:0px;border:0px;font-size:13px;white-space:pre-wrap">Hey everyone!</span><span style="font-size:13px"> </span> <div>Recently there has been some progress on LLVM-based tools for manipulating MachO binaries: llvm-objcopy has been gaining a lot of important bits to support MachO (it's relatively close to the point where one can implement the strip-like functionality), llvm-lipo is functional and supports most of cctools' lipo options (<a href="https://llvm.org/docs/CommandGuide/llvm-lipo.html" target="_blank">https://llvm.org/docs/CommandGuide/llvm-lipo.html</a>). </div><div>There is another useful utility called install_name_tool (see e.g. <a href="https://www.unix.com/man-page/osx/1/install_name_tool/" target="_blank">https://www.unix.com/man-page/osx/1/install_name_tool/</a> ),</div><div>this tool is capable of changing the rpaths, the names of the dependent shared libraries, etc. The way it works - install-name-tool (from cctools) generates the new list of MachO load commands and the new MachO header, the other parts of the binary are copied over (in particular, if I'm not mistaken, it assumes that the new "prefix" (MachO header + load commands) fits into the binary so the offsets don't need to be recalculated, otherwise suggests to relink the binary with -headerpad / -headerpad_max_install_names / reports an error). One possible (and simple) approach is to implement llvm-install-name-tool in a similar fashion: use libObject to parse the input binary and rebuild the list of load commands (analogously to what cctools' install_name_tool does (and with the same limitations)). I'd like to ask for your general feedback / thoughts / suggestions on contributing llvm-install-name-tool to LLVM with the goal to be a drop-in replacement for cctools' install_name_tool. </div><div>Thanks,</div><div>Alex</div></div>
</div></blockquote></div><br></div></div></blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>