On Fri, 9 Sep 2022, Martin Storsjö wrote:

I don't have a good explanation yet for exactly why lld fails to resolve the symbol in this case. It does load the right object file though (by passing "-verbose -demangle:no" to the lld-link command, I can see that it outputs "Loaded msvcrt-os.lib(rand_s.obj) for __imp_rand_s"). But for some reason, it fails to connect the dots for these symbols...

So that concludes the hunt for the root cause - symbol resolution with all the various COFF quirks, with LTO involved, is a bit tricky at times, and this seems to be a bug there. (I can try to look into it later at some point maybe, but maybe with a bit lower priority.)

I narrowed down the testcase a bit, but I don't have a good clue about exactly why this is happening or how to fix it, but I filed https://github.com/llvm/llvm-project/issues/57982 with the minimal repro and to see if someone can figure it out.

With that in mind, I think it can make sense to include this symbol in the mingw-w64 crt source even if it shouldn't strictly be needed due to _SECIMP being dllimport - especially since the other similar symbols seems to be doing the same.

I finally pushed this patch now, with an updated commit message explaining the situation. Thanks for your patience!

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to