-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Set storage class of julia globals to dllimport on windows to avoid auto-import weirdness #54572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -493,9 +493,12 @@ struct JuliaVariable { | |
if (GlobalValue *V = m->getNamedValue(name)) | ||
return cast<GlobalVariable>(V); | ||
auto T_size = m->getDataLayout().getIntPtrType(m->getContext()); | ||
return new GlobalVariable(*m, _type(T_size), | ||
auto var = new GlobalVariable(*m, _type(T_size), | ||
isconst, GlobalVariable::ExternalLinkage, | ||
NULL, name); | ||
if (Triple(m->getTargetTriple()).isOSWindows()) | ||
var->setDLLStorageClass(GlobalValue::DLLStorageClassTypes::DLLImportStorageClass); // Cross-library imports must be explicit for COFF (Windows) | ||
return var; | ||
} | ||
GlobalVariable *realize(jl_codectx_t &ctx); | ||
}; | ||
|
@@ -1786,9 +1789,6 @@ static inline GlobalVariable *prepare_global_in(Module *M, GlobalVariable *G) | |
G->isConstant(), GlobalVariable::ExternalLinkage, | ||
nullptr, G->getName(), nullptr, G->getThreadLocalMode()); | ||
proto->copyAttributesFrom(G); | ||
// DLLImport only needs to be set for the shadow module | ||
// it just gets annoying in the JIT | ||
proto->setDLLStorageClass(GlobalValue::DefaultStorageClass); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vtjnash It'd be good to get a confirmation that this deletion is OK |
||
return proto; | ||
} | ||
return cast<GlobalVariable>(local); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ $(build_private_libdir)/%.$(SHLIB_EXT): $(build_private_libdir)/%-o.a | |
@$(call PRINT_LINK, $(CXX) $(LDFLAGS) -shared $(fPIC) -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ \ | ||
$(WHOLE_ARCHIVE) $< $(NO_WHOLE_ARCHIVE) \ | ||
$(if $(findstring -debug,$(notdir $@)),-ljulia-internal-debug -ljulia-debug,-ljulia-internal -ljulia) \ | ||
$$([ $(OS) = WINNT ] && echo '' -lssp)) | ||
$$([ $(OS) = WINNT ] && echo '' -lssp --disable-auto-import --disable-runtime-pseudo-reloc)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the backport, I think we should enable only For future releases, I definitely support including both flags though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is already set on the cli, so the executable doesn't have it anyway, this just prevents silent failure like before There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was mostly thinking about the case for pkgimages in case we still have a rare In that case, precompilation would fail due to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have a windows pkgeval :(. But i'd rather this error then potentially silently fail. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the Anyway, I'm OK with this change as-is |
||
@$(INSTALL_NAME_CMD)$(notdir $@) $@ | ||
@$(DSYMUTIL) $@ | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.