GCC: Choose my own linker

Hi,

I do not use the default linker, and instead us another one and pass this argument -Wl,--dynamic-linker=<path to linker> to gcc when compiling. However, what happens if the linker is not under /lib and /lib64 and I am not able to create a symlink to the linker in /lib or /lib64 due to no access to sudo rights. So instead I pass this -Wl,--dynamic-linker=/home/myhome/ld-custom.so

Will the linker be properly found when running the program on say some other computer where the linker is not located where it was in link-time? It will be located under /lib64 on target.

I don't see any reason why the linker should not be found.

Ok. I was just thinking that the path will be hardcoded in the executable binary because of I do not understand how the executable binary will figure out which linker to use in runtime otherwise. Maybe just the name and not the path will be hardcoded? But I have not tested. So I am speculating.

---------- Post updated 10-29-09 at 03:20 AM ---------- Previous update was 10-28-09 at 09:42 PM ----------

You are right. Didn't think about that the linker does not really need to be available during compilation.