compnerd wrote:

> One thing I don't understand about this PR is why we need Compiler.h in Clang 
> -- wouldn't the LLVM definitions in their Compiler.h work for Clang as well? 
> (This would probably be worth explaining in the patch summary.)

The symbol lookup in PE/COFF is two level and symmetric, bound to the module. 
As a result, each module needs to explicitly specify the ABI interface 
(contract). However, given that the interface is annotated differently 
(`__declspec(dllexport)` for the producer, `__declspec(dllimport)` for the 
consumer), we need to flip the definition. When doing so, we need to know which 
module is being built. We cannot just use the conjunction of the module 
identifier to select between the two variants as there may be interdependencies 
with dynamic linking (e.g. `#if defined(A_ABI) || defined(B_ABI)` doesn't work 
if B depends on A and dynamically links to A).

I do agree that we could put this in the commit message, though, this is likely 
something that deserves a note in the developer documentation because I fear 
that other developers are going to have this question repeatedly once this work 
is completed. The biggest point of contention with this work was the fact that 
it involves an ongoing maintenance cost as the ABI boundary is now being more 
rigidly defined which is/was not needed to support it on Unix due to the 
(global) single level binding.

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

Reply via email to