[PATCH] D26671: Export llvm::APFloatBase static fltSemantics data members in extract_symbols.py

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 10:21:10 PST 2016


john.brawn added a comment.

Doing this may allow the plugin to link against clang, but it may or may not behave correctly at runtime. MSVC unfortunately handles exported/imported data symbols differently to function symbols, and to get everything working properly the variable needs to be exported as a data symbol and annotated with __declspec(dllimport) in the source code. Using the value of the variable definitely doesn't work, but just taking the address of the variable (as is done with the fltSemantics) _may_ work though I can't remember exactly - I seem to remember that in some situations you get a different addresses for the same variable in exe and in the dll. The ideal solution is to refactor everything that declares class static data members in header files so that it doesn't, which has other benefits (it would make LLVM_LINK_LLVM_DYLIB work when building using MSVC, and would be the first step towards getting BUILD_SHARED_LIBS working), but that's also a huge amount of work.

One way to sidestep this problem would be to refactor the plugin to use the TargetInfo::getXXFormat() functions to get the fltSemantics, instead of accessing them directly, but I don't know if that's appropriate for whatever it is that the plugin is doing.


https://reviews.llvm.org/D26671





More information about the llvm-commits mailing list