[PATCH] D61446: Generalize the pass registration mechanism used by Polly to any third-party tool

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 20:38:03 PDT 2019


Meinersbur added a comment.

Sorry for the break.
Unfortunately the patch does not apply cleanly anymore. Can you rebase to latest trunk?

I surprisingly did not know about `__declspec(selectany)`. I still think having the symbol only defined in that loadable module, but not in the statically linked library is the cleaner solution than relying on linker cleverness. If unused by design, there is no reason why the symbol should be even there. Can you convince me otherwise?



================
Comment at: llvm/include/llvm/Support/Compiler.h:162
 
 // FIXME: Provide this for PE/COFF targets.
 #if (__has_attribute(weak) || LLVM_GNUC_PREREQ(4, 0, 0)) &&                    \
----------------
With `__declspec(selectany)`, the FIXME should be removed.

However, I think this does not exactly match `__attribute__((__weak__))`: Weak symbols can still be undefined whereas `selectany`, if I understand MS's docs correctly, requires one valid symbol during the linking phase (Well, we currently don't support LLVM dlls anyway). This might be what you want for this patch, but classically I'd expect a weak symbol as a symbol that can resolve to NULL.

Also, I am not sure mingw/cygwin support it (I'd try out once I can apply the patch again).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61446/new/

https://reviews.llvm.org/D61446





More information about the cfe-commits mailing list