mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: internalize symbols with -static
This pipes the `-static` flag when building a static library into IRGen. This should have no impact on non-Windows targets as the usage of the information simply removes the `dllexport` attribute on the generated interfaces. This ensures that a library built with `-static` will not re-export its interfaces from the consumer. This is important to ensure that the consumer does not vend the API surface when it statically links a library. In conjunction with the removal of the force load symbol, this allows the generation of static libraries which may be linked against on Windows. However, a subsequent change is needed to ensure that the consumer does not mark the symbol as being imported from a foreign module (i.e. `dllimport`).
This commit is contained in:
@@ -2190,6 +2190,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
Opts.InternalizeAtLink = true;
|
||||
}
|
||||
|
||||
Opts.InternalizeSymbols = FrontendOpts.Static;
|
||||
|
||||
if (Args.hasArg(OPT_disable_preallocated_instantiation_caches)) {
|
||||
Opts.NoPreallocatedInstantiationCaches = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user