Baffled by linker ld.lld which can not set RUNPATH and RPATH

blastwave

New Member


Messages: 9

This is a bit baffling in that the ELF linker from the LLVM project seems to ignore just about any env var that I set with LD_foo. In fact, near as I can tell, the linker seems to not have any mechanism to set both the RUNPATH and RPATH in the output elf file. I have tried variations on the command line with things like -Wl,-rpath=/some/path/to/my_libs,--enable-new-dtags and that does in deed result in a RUNPATH value but there seems to be no way to get RPATH. Furthermore there seems to be no env var that I can set which will result in the linker always assuring me that the resultant elf files have a RUNPATH value. This is quite annoying when trying to bootstrap gcc in that the stage1 firstpass xgcc binary clearly has "NEED" of various libs such as libisl.so.23 and libmpc.so.3 etc etc but there seems to be no way for these libs to be found. The use of LD_LIBRARY_PATH is strictly useless as that only solves the problem at runtime and only for a given user environment where all other binarys will be corrupted in the location of dynamic libs coming from the ( possibly ) wrong place. Sure, one can use that blunt force trauma tool in development but it is useless in a production environment and ultimately other binarys will resolve to libs in the wrong place and then things die in mysterious horrible ways. So forget about LD_LIBRARY_PATH. Forever. So then, is there a way to assure that ld.lld will ALWAYS set a value into RUNPATH ? As an added bonus the value of RPATH would be nice but I will take what I can get.
 
Top