On Thu, 7 Oct 2021, Jeremy Drake via Mingw-w64-public wrote:

I thought pseudo-relocs were only needed when auto-importing an offset
from an exported symbol (ie, a struct member or something like that), and
that otherwse something in the normal Windows loader was leveraged.

No, they're needed anywhere where you have code accessing a global variable (data symbol) from a different DLL, that wasn't marked dllimport when the compiler generated the access to it.

(See https://github.com/ziglang/zig/issues/9845#issuecomment-929025888 for a bit more detail/nuance about how it works.)

(Also, actually, lld has a trick that even allows avoiding the pseudo relocations altogether in many cases, for cases when the compiler generated suitable .refptr stubs.)

If this is indeed where the truncated 32-bit relative runtime relocations
happen, it sounds very nice to have an immediate error instead of waiting
until the function happens to be called.

Yup. I _think_ this implementation should be free of false positives, but we only know once you rebuild all of msys2 with it and try running those packages ;-)

Also, I have seen issues that look like this in GCC, not just Clang.  I
don't recall any manual overriding of the code model either.

Yes it's certainly possible that it happens elsewhere with GCC too (I don't know offhand how/where, so each of those instances would be cosnidered a bug in either GCC/Clang or mingw-w64-crt, I think), and this certainly helps diagnosing those situations.

// 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