[PATCH] D51288: [MinGW] [X86] Add stubs for references to data variables that might end up imported from a dll

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 27 16:33:53 PDT 2018


rnk added a comment.

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.



================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1388-1389
 
   if (TM.getTargetTriple().isOSBinFormatELF()) {
     MachineModuleInfoELF &MMIELF = MMI->getObjFileInfo<MachineModuleInfoELF>();
 
----------------
I was looking for some way to unify this across architectures, but I don't see one. It looks like the MachO assembler implicitly creates stubs for you, similar to how you can use `foo at GOT(%rip)` and that will make a GOT stub for you on ELF.


================
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]])
----------------
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.


Repository:
  rL LLVM

https://reviews.llvm.org/D51288





More information about the llvm-commits mailing list