-dynamic-too runs the compilation starting from Core-to-STG twice. So that's two Core-to-STG, STG-to-Cmm, Cmm-to-native-code for one module. As far as I can see the code generator does not care about -dynamic-too at all -- so in these two compilation we generate identical code. I think the only difference is in linking, so unless I'm missing something implementation of -dynamic-too could be made much more efficient by only linking twice.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
However I still think the Cmms we generate are identical. If that's really the case then the implementation can still be improved by only running X86 generation and linking twice.
Looking at native code generator (compiler/nativeGen) I don't see any code that checks WayDyn. I wonder where we check this and generate different code based on that?
cmmMakeDynamicReferencedflagsreferenceKindlbl|Just_<-dynamicLinkerLabelInfolbl=return$CmmLit$CmmLabellbl-- already processed it, pass through|otherwise=dothis_mod<-getThisModulecasehowToAccessLabeldflags(platformArch$targetPlatformdflags)(platformOS$targetPlatformdflags)this_modreferenceKindlblofAccessViaStub->doletstub=mkDynamicLinkerLabelCodeStublbladdImportstubreturn$CmmLit$CmmLabelstubAccessViaSymbolPtr->doletsymbolPtr=mkDynamicLinkerLabelSymbolPtrlbladdImportsymbolPtrreturn$CmmLoad(cmmMakePicReferencedflagssymbolPtr)(bWorddflags)AccessDirectly->casereferenceKindof-- for data, we might have to make some calculations:DataReference->return$cmmMakePicReferencedflagslbl-- all currently supported processors support-- PC-relative branch and call instructions,-- so just jump there if it's a call or a jump_->return$CmmLit$CmmLabellbl
Yes, seems so. With dynamic linking we need an indirection against GOT to access symbols, thus mov instead of lea and indirect jumps instead of direct ones in the generated code.