* lib/gdb.exp (gdb_compile): Specify rpath if the *target* is a remote machine, not the host. (gdb_compile_shlib): Set soname if target is remote.