I want to confirm that I'm using @_implementationOnly correctly with static library in autolinking aspect.
Currently, Foundation imports CoreFoundation with @_implementationOnly attribute other than Linux and Darwin platforms.
Modules imported with @_implementationOnly are not added to swift1_autolink_entries to hide the dependencies, and they will be linked as private dependencies so that users don't need to link the private dependencies explicitly.
But the private linking only works on dynamic linking.
For example, Wasm toolchain uses static linking and CoreFoundation is imported with @_implementationOnly from Foundation. The produced
libFoundation.a doesn't have CoreFoundation contents, so the Foundation users need to link CoreFoundation and CoreFoundation's dependencies explicitly.
In this case, should we merge CoreFoundation and CoreFoundation's dependencies with libFoundation.a like below?
$ llvm-ar -M <<EOS create libFoundation.a addlib libFoundation.a addlib libCoreFoundation.a addlib libuuid.a addlib libicui18n.a save end EOS