[PATCH] D51288: [MinGW] [X86] Add stubs for references to data variables that might end up imported from a dll
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 28 05:16:12 PDT 2018
mstorsjo added a comment.
In https://reviews.llvm.org/D51288#1215140, @rnk wrote:
> I think you need to change clang lib/CodeGen/CodeGenModule.cpp `shouldAssumeDSOLocal` to stop marking these things as dso_local, and then `shouldAssumeDSOLocal` will return false, and you can apply your MO_COFFSTUB flag in `classifyGlobalReference`. Hopefully then everything will make a little more sense.
Right, I'll give that a try. That sounds like it would make a little more sense.
================
Comment at: test/CodeGen/X86/win32-ssp.ll:12
; MINGW-LABEL: func:
-; MINGW: mov{{l|q}} __stack_chk_guard
+; MINGW: mov{{l|q}} .refptr.__stack_chk_guard(%rip), [[REG:%[a-z]+]]
+; MINGW: mov{{l|q}} ([[REG]])
----------------
rnk wrote:
> Does mingw provide `__stack_chk_guard`? Should we use .refptr to access it? I think we should change `TargetLoweringBase::insertSSPDeclarations` to mark this global dso_local first, so that we don't introduce these extra stubs, if they are not needed.
Yes, mingw has got `__stack_chk_guard` (as part of `libssp.a` or `libssp.dll.a`), and it can be linked either statically or dynamically (which we don't know until we see which kind of library the linker finds). So yes, it's intentional that we're using .refptr here.
Repository:
rL LLVM
https://reviews.llvm.org/D51288
More information about the llvm-commits
mailing list