Fix linking for symbols starting with ? on i686-pc-windows-msvc by checkraisefold · Pull Request #130808 · rust-lang/rust (original) (raw)
When using the export_name
attribute to specifically export a symbol beginning with a question mark on the i686-pc-windows-msvc
target, that symbol will fail to link and throw a linker error 100% of the time.
Issue writeup.
Closes #44282
I'm not sure if this is a proper solution, but LLVM does the same check which causes this issue, and is applied to all 32- and 64-bit Windows COFF objects (maybe the same patch should be applied for 64 bit windows as well then?). I am more unsure of whether this is the proper place for such a solution (and if the exact conditions of is_like_windows are proper for this usecase), or if the underscore should be stripped elsewhere, but it seems like the most correct place.
I'm also unsure if there are any backwards compatibility ramifications here. There shouldn't be, because binaries with exported symbols starting with ?
for this target failed to link because of this issue anyway, but still.