Refactor the generation of the metadata for linking
Please read the rustc-dev-guide chapter on Backend Agnostic Codegen.