theraven added a comment. If we're going to change the default, please at least add a flag to allow callers to opt into dlimport. We can then make that dependent on `-static-objc` or similar.
================ Comment at: CodeGenObjC/gnu-init.m:103 +// Make sure we do not have dllimport on the load function +// CHECK-WIN: declare dso_local void @__objc_load ---------------- compnerd wrote: > rnk wrote: > > compnerd wrote: > > > rnk wrote: > > > > mgrang wrote: > > > > > I had to remove dllimport in this and the next unit test. I am not > > > > > sure of the wider implications of this change. Maybe controlling this > > > > > via a flag (like -flto-visibility-public-std) is a better/more > > > > > localized option? > > > > These are the ones that I think @compnerd really cares about since the > > > > objc runtime is typically dynamically linked and frequently called. We > > > > might want to arrange things such that we have a separate codepath for > > > > ObjC runtime helpers. I'm surprised we don't already have such a code > > > > path. > > > I think that @theraven would care more about this code path than I. I > > > think that this change may be wrong, because the load here is supposed to > > > be in the ObjC runtime, and this becoming local to the module would break > > > the global registration. > > We just set dso_local whenever something isn't dllimport, even if it's a > > lie sometimes. I think everything would work as intended with a linker > > thunk. It's "true" as far as LLVM is concerned for the purposes of emitting > > relocations. > Ah, okay, then, this might be okay. However, the use of `dllimport` here > would force that the runtime to be called. Then again it is possible to > statically link ... `__objc_load` is a function defined in objc.dll. It absolutely does want to be dlimport, or the linker won't be able to find it. ================ Comment at: CodeGenObjCXX/msabi-stret.mm:16 -// CHECK: declare dllimport void @objc_msgSend_stret(i8*, i8*, ...) +// CHECK: declare dso_local void @objc_msgSend_stret(i8*, i8*, ...) // CHECK-NOT: declare dllimport void @objc_msgSend(i8*, i8*, ...) ---------------- Similarly, the `objc_msgSend` family are defined in objc.dll and so need to be `dlimport`ed. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55229/new/ https://reviews.llvm.org/D55229 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits