diff --git a/bfg9000/tools/cc/linker.py b/bfg9000/tools/cc/linker.py
index <HASH>..<HASH> 100644
--- a/bfg9000/tools/cc/linker.py
+++ b/bfg9000/tools/cc/linker.py
@@ -156,10 +156,10 @@ class CcLinker(BuildCommand):
         changed = False
         for i in options:
             if isinstance(i, opts.lib):
-                lib = i.library
-                if isinstance(lib, Library) and lib.runtime_file:
-                    local = self._local_rpath(lib, output)[0][0]
-                    installed = file_install_path(lib, cross=self.env).parent()
+                if isinstance(i.library, Library) and i.library.runtime_file:
+                    runtime = i.library.runtime_file
+                    local = self._local_rpath(runtime, output)[0][0]
+                    installed = file_install_path(runtime, self.env).parent()
                     result.append(installed)
                     if not isinstance(local, BasePath) or local != installed:
                         changed = True
Be more precise about the installed rpaths

Technically speaking, the rpath is based on the location of the *runtime* file
associated with the library, not the library passed in as an argument. For
example, with a versioned shared lib, the input file is libfoo.so, but the
runtime file is libfoo.so<I>. We want the latter.