barcharcraz wrote:

> Is it feasible to create a migration path from the static runtime to the 
> dynamic runtime? As written, this requires users to update their ASan builds 
> at the same time that they take this update. Is it possible to leave the 
> static runtime behind, create a migration path to the dynamic runtime (add 
> all the new weak symbol registration functionality), push that, and then 
> follow up by removing the static runtime 2-4 weeks later?

The new symbol registration mechanism depends on how the loader imports 
multiple DLLexports of the same symbol, maybe it could be adapted to work with 
the static runtime, but it's a bunch of work for something that will be 
immediately removed.

We could also just ship a copy of the dynamic runtime import library under the 
same name as the old static runtime, perhaps emitting a warning someplace to 
let people know what's going on. 

So, for context: MSVC's link.exe uses a special /INFERASANLIBS option that 
picks the correct asan library automatically, and this PR should (hopefully, I 
haven't tested it yet) make that flag work with clang's version of asan as 
well, at least for release builds (MSVC ships with debug builds of asan as 
well, they're still linked to the release-dll variant of the CRT, they just 
have optimization turned off). When you pass /fsanitize=address to cl.exe it 
adds the equivalent of `#pragma comment(linker, "/INFERASANLIBS")` to the 
object files. Link.exe sees this and picks the right libraries by seeing which 
crt it was going to link and inserting the asan libraries before the crt in the 
link order. 

I'm not quite sure I understand the problem scenario. Is the trouble that if 
you're building with mingw's gcc then you need to invoke the linker manually 
because gcc doesn't know how to deal with link.exe (and you want to use 
link.exe over ld.exe because ld is slow and presumably not that well maintained 
on windows?). I think clang can invoke link.exe for you, just like any other 
linker, or is that only lld-link? cl can also invoke link for you, although I 
understand going through the compiler like that is less common on windows that 
on other platforms.

https://github.com/llvm/llvm-project/pull/81677
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to