If you are curious about the paths used by ld
ld --verbose | grep SEARCH
usually you don't want to use ld
explicitly for linking, it's probably better to perform every task with gcc
alone, and you should prefer the latter over the former.
If you want to know more about gcc
settings
gcc -dumpspecs
gives you a taste of what it's like to take a look at the internals of gcc
, you will probably end up taking a look at the gcc
manual if you are serious about this, but I don't think that is something worth doing just for the sake of it.
Settings defined at the time when gcc
was compiled can be important too, so you should also learn how to compile gcc
from source if you really want to grasp how the internals work.
tl;dr
Just use gcc
for both compiling and linking, other options are probably not worth the trouble.