<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJy1VkuP2zYQ_jXyZWDBlh9rHXTYbGAkQNscEqBHgxLHFmuKVElqHf_7zlDyys46LoqggkDTfMzjm29mVFp5Lr7VygO9AgyeYI8idA7B4d8d-gB2D7-Lqp5-Aa1lkr2AMBICX7mclBY9GBsAvyu6oAxouV6m8DnAyXZaQolQo273nYZgoRavSELAtkFZwytVLcwBSSjSZR-E1mBEg6xagMQWjUQTQKvSCXcGqRxWQZ-Bb9MdrcwRHZt2UqG2XSA_UCpzYNmuMySktT5M-Rwk69mgY8c6dsFaTWspfCNJnUeoBA0MyB7OtiNrJd0vOyM1gg-uq6LPWh0xopAsnpPZx2R2Gdez4Y1_t9amom2TbPtiTSAnPE37LaCHgP3y9WaFH7o0LmwdWXmy7ujfnSM8KuswlWeajVufCGp074_364M5t1v83DXw-rlv7PXTa7gLRD9-sKGOIUuyZ3qH83EeadVP2f9-Db9j1QVRaiYYxZQDGqNIv_2RWwziEhOhJBKQnjMIipUIRJn9Hh2TyKEWQREDW0G2ELlC7R-KIx73TJA2kvwkSApd8LVqmRnKMCdDTVqIPp4JlixnjsXTdFoSnSRoK5iQbJo17P7GOigJjSTLmeaMybWzJ8U5MHg8podyZD8ZKGnjOlM805c4W4voS8k5SWrEPqCLgA26MT2kjwn7LjdgOqi_gQbIxdHeXXQ226YpDTeEvb10NxsutHpj_V3mPBv5a1br8yOj7w3_1ZEx724y7Y6r_5on15Wz6aoaGtINlTWvaBT2_KMtdoOnAYkHYyXsyXivmvLaWE97X3x90fRGLcG9YEyZV6E7hFON5sKlFL7aBqn8UY3lSviYU5WmUMDUMmww1YwjTH8b4A92RBemf2qi6RC73XVUafmH3Hz5XygYD1QPQvOHDXgBuG-bXBQYWM8gcwIyyLbqGpKOkmtAVL3bK430763vsYzYMf2lZcYaSBKrzjHw1OE6o5pWYy8qHtOyb1U_lduD5zleDq9Zoa09UtO27gcaDG31UjZVGBv6zxpztP2AZPlVOYrHqPu2LKQRB0yvcZvIYiHzRS4moqMm7QpHxRKPk87pog6hjY2Umku2PVAT78q0sg1HT79efqats39R46e_ynv6NqHJarFa5pO6WGXz9V4u12VW5pu5nK-rvMpWuXjCKs83-WyiRYnaF8nqQ5Jl_JkTRdA8WX2c_LoFqshmGb08zGerpzTL5llePW32y4XczNcbJmsjlE5ZTmrdYeKKKLLsDp42NfNg3BTeqwPV_2gwWRhU0FjED7BtIyoQUr7_frrpCNz1-lapGpxEc4to6z83PzRX>53549</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lld/mac add option to change install names at link time
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rsesek
</td>
</tr>
</table>
<pre>
This is a new feature request of Mach-O lld, and this feature does not exist in ld64. It would be helpful to have an option to change the install name of a dependent library directly on the linker, without needing to run a post-link `install_name_tool`. The use case is if you had a bundle structure like this:
```
Foo.app/Contents/
MacOS/
Foo
Frameworks/
libcore.dylib
Helpers/
Helper.app/
Contents/
MacOS/
Helper
```
Both the **Helper** and **Foo** executables need to link to **libcore.dylib**, but they are at different relative path depths to **libcore.dylib**. If you do not want to ship a binary that uses `@rpath`-based loading, one (or both) of the executables will need to change their recorded install names. This has to be done after linking, e.g.:
```
install_name_tool -change libcore.dylib @executable_path/../Frameworks/libcore.dylib Foo.app/Contents/MacOS/Foo
```
And
```
install_name_tool -change libcore.dlyb @executable_path/../../../../../Frameworks/libcore.dylib Foo.app/Contents/Helpers/Helper.app/Contents/MacOS/Helper
```
It would be much more convenient to be able to tell the linker that the install name of the dependent dylib should be recorded as a different value when linking. Something like:
```
clang -o Foo -lcore -Lpath/to/libcore -Wl,-change_install_name,libcore.dylib,@executable_path/../Frameworks/libcore.dylib Foo.app/Contents/MacOS/Foo Foo.c
```
Note that this is not the same as the documented`-dylib_file` option that exists in ld64 and is currently unimplemented in lld. The `-dylib_file` option changes where the linker looks for the dependent library, but it does not change the install name that gets recorded in the output image.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VkuP2kgQ_jXmUsJizMDAwYfJRCiRdjeHRNojarvLuJd2t7cfQ_j3W9WGMWQI0Wq1lmWaftTjq6-qurLyWH5rlQd6BRg8QIMiRIfg8O-IPoBt4HdRt9MvoLXMihcQRkLgI-ed0qIHYwPgd0UHlAEtl485fA5wsFFLqBBa1H0TNQQLrXhFEgK2D8oanqlbYXZIQpEO-yC0BiM6ZNUCJPZoJJoAWlVOuCNI5bAO-gh8ms5oZfbo2LSDCq2NgfxAqcyOZbtoSEhvfZjyPsiWs5OOLevYBms1zeXwjSRFj1AL-jAgDRxtJGslna-ikRrBBxfr5LNWe0woZPPnbPYxm52_y9npTX831uai77Ni82JNICc8DYcloIeA_fL1aoYfOjRObBxZebBu79_tIzxq6zCXRxqNS58IanTvtw_zJ3Oul_i5aeDlc9vYy2fQcBOI4fvBhjaFLCue6T3tT-NEq2HI_g9z-B3rGESlmWAUUw5oiiL9DluuMUhTTISKSEB6jiAoViIQZZoGHZPIoRZBEQN7QbYQuULr74ojHg9MkDaR_CBICh3wreqZGcowJ0NLWog-ngmWPc4ci6fhtCI6SdBWMCHZNGvY_ZV1UBEaWbFmmjMml84eFOfAyeMxPZQj-8lASQuXmeKZvsTZViRfKs5JUiOagC4BdtKN-S6_T9h3uQHTk_oraIBcHO3dJmeLTZ7T54qw14duZsOZVm-sv8mcZyP_m9X6eM_oW59_68iYd1eZdsPVX-bJZeXsYt1CR7qhtuYVjcKBf7TEbvAwIPFgrIQDGW9VU54b6-ngi2_Pmt6oJbgXjCnzKnREOLRozlzK4avtkMof1ViuhPc5VWsKBUwtwwZTzTjC9LcT_MGO6ML0T000PcVuexlVmv4hN1_-FwqmDfWd0PxhA54BHtomFwUG1jPInIAMsq1jR9JRcg1IqreN0kj_3voey0gd059bZqqBJLGOjoGnDheN6nqNg6i0TcuhVf1U7gCe53g5vGSFtnZPTdu6H2hwaqvnsqnC2NB_1piT7Tskyy_KUdpG3bdnIZ3YYX6J20SWc7mer8UkqKCxTJeJTSdqEFK-vwtcVTeu4EPZVx1OotNlG0KfWi-1o2Kzo7Yfq7y2Hcdbv55_pr2zf9FVgf4q7-k2Q4PFfPG4nrTlrFnPllWzXNarel7MF-v109O8qupisWgqWploUaH2Zbb4kBUFX4ySCBpni48TVRazgl7-PMwWT3lRPBTr-mnVPM7l6mG5YnJ2Qumc7cit201cmUyq4s7Toua4j4vCe7Wjep_UkXwR6SLjSkcNBfeTpLlMlv8DvSYfAQ">