Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a unique name for
libwit_bindgen_cabi_realloc.a
per-crate-versi…
…on (#928) * Use a unique name for `libwit_bindgen_cabi_realloc.a` per-crate-version This commit updates how the weak `cabi_realloc` symbol is linked. Previously rustc was told to use `-lwit_bindgen_cabi_realloc` with a `-L` pointing to the source directory of the crate which has a precompiled copy. This caused issues, however, when two versions were present in a crate graph but only one was used. With two versions present in a crate graph rustc would use two `-L` flags with directories that both contain the same-named library. Which one was picked depended on the order that rustc passed flags. If only one crate was used, however, then rustc would not pass the rlib for the other crate. This could end up in a situation where with two wit-bindgen versions A and B: * During linking, A's `libwit_bindgen_cabi_realloc.a` file was used. * Rustc only passed B's rlib since A wasn't actually used anywhere. * The linker then tried to load A's version of the actual cabi_realloc symbol, but only B's was present. The fix in this commit is to uniquely name the library name based on the crate version. This matches how the symbol name is different per crate version, for example. * Remove copy/paste
- Loading branch information