blob: 3d463bdbc8c0f0eefc246150d08d95de1f366df6 [file] [log] [blame]
Colin Cross4d9c2d12016-07-29 12:48:20 -07001// Copyright 2016 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package cc
16
17import (
18 "strings"
19
20 "github.com/google/blueprint"
Colin Cross26c34ed2016-09-30 17:10:16 -070021 "github.com/google/blueprint/pathtools"
Colin Cross4d9c2d12016-07-29 12:48:20 -070022
Colin Cross4d9c2d12016-07-29 12:48:20 -070023 "android/soong/android"
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -080024 "android/soong/cc/config"
Colin Cross4d9c2d12016-07-29 12:48:20 -070025)
26
Colin Crossb916a382016-07-29 17:28:03 -070027type LibraryProperties struct {
Colin Cross4d9c2d12016-07-29 12:48:20 -070028 Static struct {
Colin Cross2f336352016-10-26 10:03:47 -070029 Srcs []string `android:"arch_variant"`
30 Cflags []string `android:"arch_variant"`
Colin Cross4d9c2d12016-07-29 12:48:20 -070031
Colin Cross4d9c2d12016-07-29 12:48:20 -070032 Enabled *bool `android:"arch_variant"`
33 Whole_static_libs []string `android:"arch_variant"`
34 Static_libs []string `android:"arch_variant"`
35 Shared_libs []string `android:"arch_variant"`
36 } `android:"arch_variant"`
37 Shared struct {
Colin Cross2f336352016-10-26 10:03:47 -070038 Srcs []string `android:"arch_variant"`
39 Cflags []string `android:"arch_variant"`
Colin Crossb916a382016-07-29 17:28:03 -070040
Colin Cross4d9c2d12016-07-29 12:48:20 -070041 Enabled *bool `android:"arch_variant"`
42 Whole_static_libs []string `android:"arch_variant"`
43 Static_libs []string `android:"arch_variant"`
44 Shared_libs []string `android:"arch_variant"`
45 } `android:"arch_variant"`
46
47 // local file name to pass to the linker as --version_script
48 Version_script *string `android:"arch_variant"`
49 // local file name to pass to the linker as -unexported_symbols_list
50 Unexported_symbols_list *string `android:"arch_variant"`
51 // local file name to pass to the linker as -force_symbols_not_weak_list
52 Force_symbols_not_weak_list *string `android:"arch_variant"`
53 // local file name to pass to the linker as -force_symbols_weak_list
54 Force_symbols_weak_list *string `android:"arch_variant"`
55
56 // rename host libraries to prevent overlap with system installed libraries
57 Unique_host_soname *bool
58
Dan Willemsene1240db2016-11-03 14:28:51 -070059 Aidl struct {
60 // export headers generated from .aidl sources
61 Export_aidl_headers bool
62 }
63
Colin Cross0c461f12016-10-20 16:11:43 -070064 Proto struct {
65 // export headers generated from .proto sources
66 Export_proto_headers bool
67 }
Colin Crossa48ab5b2017-02-14 15:28:44 -080068}
Colin Cross0c461f12016-10-20 16:11:43 -070069
Colin Crossa48ab5b2017-02-14 15:28:44 -080070type LibraryMutatedProperties struct {
Colin Cross4d9c2d12016-07-29 12:48:20 -070071 VariantName string `blueprint:"mutated"`
Colin Crossb916a382016-07-29 17:28:03 -070072
73 // Build a static variant
74 BuildStatic bool `blueprint:"mutated"`
75 // Build a shared variant
76 BuildShared bool `blueprint:"mutated"`
77 // This variant is shared
78 VariantIsShared bool `blueprint:"mutated"`
79 // This variant is static
80 VariantIsStatic bool `blueprint:"mutated"`
81}
82
83type FlagExporterProperties struct {
84 // list of directories relative to the Blueprints file that will
Dan Willemsen273af7f2016-11-03 15:53:42 -070085 // be added to the include path (using -I) for this module and any module that links
86 // against this module
Colin Crossb916a382016-07-29 17:28:03 -070087 Export_include_dirs []string `android:"arch_variant"`
Dan Willemsen4416e5d2017-04-06 12:43:22 -070088
89 Target struct {
90 Vendor struct {
91 // list of exported include directories, like
92 // export_include_dirs, that will be applied to the
93 // vendor variant of this library. This will overwrite
94 // any other declarations.
95 Export_include_dirs []string
96 }
97 }
Colin Cross4d9c2d12016-07-29 12:48:20 -070098}
99
100func init() {
Colin Cross798bfce2016-10-12 14:28:16 -0700101 android.RegisterModuleType("cc_library_static", libraryStaticFactory)
102 android.RegisterModuleType("cc_library_shared", librarySharedFactory)
103 android.RegisterModuleType("cc_library", libraryFactory)
104 android.RegisterModuleType("cc_library_host_static", libraryHostStaticFactory)
105 android.RegisterModuleType("cc_library_host_shared", libraryHostSharedFactory)
Colin Cross5950f382016-12-13 12:50:57 -0800106 android.RegisterModuleType("cc_library_headers", libraryHeaderFactory)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700107}
108
109// Module factory for combined static + shared libraries, device by default but with possible host
110// support
Colin Cross36242852017-06-23 15:06:31 -0700111func libraryFactory() android.Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800112 module, _ := NewLibrary(android.HostAndDeviceSupported)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700113 return module.Init()
114}
115
116// Module factory for static libraries
Colin Cross36242852017-06-23 15:06:31 -0700117func libraryStaticFactory() android.Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800118 module, library := NewLibrary(android.HostAndDeviceSupported)
119 library.BuildOnlyStatic()
Colin Cross4d9c2d12016-07-29 12:48:20 -0700120 return module.Init()
121}
122
123// Module factory for shared libraries
Colin Cross36242852017-06-23 15:06:31 -0700124func librarySharedFactory() android.Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800125 module, library := NewLibrary(android.HostAndDeviceSupported)
126 library.BuildOnlyShared()
Colin Cross4d9c2d12016-07-29 12:48:20 -0700127 return module.Init()
128}
129
130// Module factory for host static libraries
Colin Cross36242852017-06-23 15:06:31 -0700131func libraryHostStaticFactory() android.Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800132 module, library := NewLibrary(android.HostSupported)
133 library.BuildOnlyStatic()
Colin Cross4d9c2d12016-07-29 12:48:20 -0700134 return module.Init()
135}
136
137// Module factory for host shared libraries
Colin Cross36242852017-06-23 15:06:31 -0700138func libraryHostSharedFactory() android.Module {
Colin Crossab3b7322016-12-09 14:46:15 -0800139 module, library := NewLibrary(android.HostSupported)
140 library.BuildOnlyShared()
Colin Cross4d9c2d12016-07-29 12:48:20 -0700141 return module.Init()
142}
143
Colin Cross5950f382016-12-13 12:50:57 -0800144// Module factory for header-only libraries
Colin Cross36242852017-06-23 15:06:31 -0700145func libraryHeaderFactory() android.Module {
Colin Cross5950f382016-12-13 12:50:57 -0800146 module, library := NewLibrary(android.HostAndDeviceSupported)
147 library.HeaderOnly()
148 return module.Init()
149}
150
Colin Cross4d9c2d12016-07-29 12:48:20 -0700151type flagExporter struct {
152 Properties FlagExporterProperties
153
Dan Willemsen847dcc72016-09-29 12:13:36 -0700154 flags []string
155 flagsDeps android.Paths
Colin Cross4d9c2d12016-07-29 12:48:20 -0700156}
157
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700158func (f *flagExporter) exportedIncludes(ctx ModuleContext) android.Paths {
Justin Yun8effde42017-06-23 19:24:43 +0900159 if ctx.vndk() && f.Properties.Target.Vendor.Export_include_dirs != nil {
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700160 return android.PathsForModuleSrc(ctx, f.Properties.Target.Vendor.Export_include_dirs)
161 } else {
162 return android.PathsForModuleSrc(ctx, f.Properties.Export_include_dirs)
163 }
164}
165
Colin Cross4d9c2d12016-07-29 12:48:20 -0700166func (f *flagExporter) exportIncludes(ctx ModuleContext, inc string) {
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700167 includeDirs := f.exportedIncludes(ctx)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700168 for _, dir := range includeDirs.Strings() {
169 f.flags = append(f.flags, inc+dir)
170 }
171}
172
173func (f *flagExporter) reexportFlags(flags []string) {
174 f.flags = append(f.flags, flags...)
175}
176
Dan Willemsen847dcc72016-09-29 12:13:36 -0700177func (f *flagExporter) reexportDeps(deps android.Paths) {
178 f.flagsDeps = append(f.flagsDeps, deps...)
179}
180
Colin Cross4d9c2d12016-07-29 12:48:20 -0700181func (f *flagExporter) exportedFlags() []string {
182 return f.flags
183}
184
Dan Willemsen847dcc72016-09-29 12:13:36 -0700185func (f *flagExporter) exportedFlagsDeps() android.Paths {
186 return f.flagsDeps
187}
188
Colin Cross4d9c2d12016-07-29 12:48:20 -0700189type exportedFlagsProducer interface {
190 exportedFlags() []string
Dan Willemsen847dcc72016-09-29 12:13:36 -0700191 exportedFlagsDeps() android.Paths
Colin Cross4d9c2d12016-07-29 12:48:20 -0700192}
193
194var _ exportedFlagsProducer = (*flagExporter)(nil)
195
Colin Crossb916a382016-07-29 17:28:03 -0700196// libraryDecorator wraps baseCompiler, baseLinker and baseInstaller to provide library-specific
197// functionality: static vs. shared linkage, reusing object files for shared libraries
198type libraryDecorator struct {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800199 Properties LibraryProperties
200 MutatedProperties LibraryMutatedProperties
Colin Cross4d9c2d12016-07-29 12:48:20 -0700201
202 // For reusing static library objects for shared library
Colin Cross10d22312017-05-03 11:01:58 -0700203 reuseObjects Objects
204 reuseExportedFlags []string
Colin Crossbbc9f4d2017-05-03 16:24:55 -0700205 reuseExportedDeps android.Paths
Colin Cross10d22312017-05-03 11:01:58 -0700206
Colin Cross26c34ed2016-09-30 17:10:16 -0700207 // table-of-contents file to optimize out relinking when possible
208 tocFile android.OptionalPath
Colin Cross4d9c2d12016-07-29 12:48:20 -0700209
Colin Cross4d9c2d12016-07-29 12:48:20 -0700210 flagExporter
211 stripper
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700212 relocationPacker
Colin Cross4d9c2d12016-07-29 12:48:20 -0700213
Colin Cross4d9c2d12016-07-29 12:48:20 -0700214 // If we're used as a whole_static_lib, our missing dependencies need
215 // to be given
216 wholeStaticMissingDeps []string
217
218 // For whole_static_libs
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700219 objects Objects
Colin Cross4d9c2d12016-07-29 12:48:20 -0700220
221 // Uses the module's name if empty, but can be overridden. Does not include
222 // shlib suffix.
223 libName string
Colin Crossb916a382016-07-29 17:28:03 -0700224
225 sanitize *sanitize
226
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800227 sabi *sabi
228
Dan Willemsen581341d2017-02-09 16:16:31 -0800229 // Output archive of gcno coverage information files
230 coverageOutputFile android.OptionalPath
231
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800232 // linked Source Abi Dump
233 sAbiOutputFile android.OptionalPath
234
235 // Source Abi Diff
236 sAbiDiff android.OptionalPath
237
Colin Crossb916a382016-07-29 17:28:03 -0700238 // Decorated interafaces
239 *baseCompiler
240 *baseLinker
241 *baseInstaller
Colin Cross4d9c2d12016-07-29 12:48:20 -0700242}
243
Colin Crossb916a382016-07-29 17:28:03 -0700244func (library *libraryDecorator) linkerProps() []interface{} {
245 var props []interface{}
246 props = append(props, library.baseLinker.linkerProps()...)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700247 return append(props,
248 &library.Properties,
Colin Crossa48ab5b2017-02-14 15:28:44 -0800249 &library.MutatedProperties,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700250 &library.flagExporter.Properties,
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700251 &library.stripper.StripProperties,
252 &library.relocationPacker.Properties)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700253}
254
Colin Crossb916a382016-07-29 17:28:03 -0700255func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {
Colin Cross42742b82016-08-01 13:20:05 -0700256 flags = library.baseLinker.linkerFlags(ctx, flags)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700257
Colin Crossb916a382016-07-29 17:28:03 -0700258 // MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
259 // all code is position independent, and then those warnings get promoted to
260 // errors.
Colin Cross3edeee12017-04-04 12:59:48 -0700261 if !ctx.Windows() {
Colin Crossb916a382016-07-29 17:28:03 -0700262 flags.CFlags = append(flags.CFlags, "-fPIC")
263 }
264
265 if library.static() {
266 flags.CFlags = append(flags.CFlags, library.Properties.Static.Cflags...)
Colin Crossa48ab5b2017-02-14 15:28:44 -0800267 } else if library.shared() {
Colin Crossb916a382016-07-29 17:28:03 -0700268 flags.CFlags = append(flags.CFlags, library.Properties.Shared.Cflags...)
269 }
270
Colin Crossa48ab5b2017-02-14 15:28:44 -0800271 if library.shared() {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700272 libName := library.getLibName(ctx)
273 // GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
274 sharedFlag := "-Wl,-shared"
275 if flags.Clang || ctx.Host() {
276 sharedFlag = "-shared"
277 }
278 var f []string
Dan Willemsen01a405a2016-06-13 17:19:03 -0700279 if ctx.toolchain().Bionic() {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700280 f = append(f,
281 "-nostdlib",
282 "-Wl,--gc-sections",
283 )
284 }
285
286 if ctx.Darwin() {
287 f = append(f,
288 "-dynamiclib",
289 "-single_module",
Colin Cross4d9c2d12016-07-29 12:48:20 -0700290 "-install_name @rpath/"+libName+flags.Toolchain.ShlibSuffix(),
291 )
Colin Cross7863cf52016-10-20 10:47:21 -0700292 if ctx.Arch().ArchType == android.X86 {
293 f = append(f,
294 "-read_only_relocs suppress",
295 )
296 }
Colin Cross4d9c2d12016-07-29 12:48:20 -0700297 } else {
298 f = append(f,
299 sharedFlag,
300 "-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
301 }
302
303 flags.LdFlags = append(f, flags.LdFlags...)
304 }
305
306 return flags
307}
308
Dan Willemsen273af7f2016-11-03 15:53:42 -0700309func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700310 exportIncludeDirs := library.flagExporter.exportedIncludes(ctx)
Dan Willemsen273af7f2016-11-03 15:53:42 -0700311 if len(exportIncludeDirs) > 0 {
Colin Crossdad8c952017-04-26 14:55:27 -0700312 f := includeDirsToFlags(exportIncludeDirs)
313 flags.GlobalFlags = append(flags.GlobalFlags, f)
314 flags.YasmFlags = append(flags.YasmFlags, f)
Dan Willemsen273af7f2016-11-03 15:53:42 -0700315 }
316
317 return library.baseCompiler.compilerFlags(ctx, flags)
318}
319
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700320func extractExportIncludesFromFlags(flags []string) []string {
321 // This method is used in the generation of rules which produce
322 // abi-dumps for source files. Exported headers are needed to infer the
323 // abi exported by a library and filter out the rest of the abi dumped
324 // from a source. We extract the include flags exported by a library.
325 // This includes the flags exported which are re-exported from static
326 // library dependencies, exported header library dependencies and
327 // generated header dependencies. Re-exported shared library include
328 // flags are not in this set since shared library dependencies will
329 // themselves be included in the vndk. -isystem headers are not included
330 // since for bionic libraries, abi-filtering is taken care of by version
331 // scripts.
332 var exportedIncludes []string
333 for _, flag := range flags {
334 if strings.HasPrefix(flag, "-I") {
335 exportedIncludes = append(exportedIncludes, flag)
336 }
337 }
338 return exportedIncludes
339}
340
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700341func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
Colin Cross5950f382016-12-13 12:50:57 -0800342 if !library.buildShared() && !library.buildStatic() {
343 if len(library.baseCompiler.Properties.Srcs) > 0 {
344 ctx.PropertyErrorf("srcs", "cc_library_headers must not have any srcs")
345 }
346 if len(library.Properties.Static.Srcs) > 0 {
347 ctx.PropertyErrorf("static.srcs", "cc_library_headers must not have any srcs")
348 }
349 if len(library.Properties.Shared.Srcs) > 0 {
350 ctx.PropertyErrorf("shared.srcs", "cc_library_headers must not have any srcs")
351 }
352 return Objects{}
353 }
Justin Yun8effde42017-06-23 19:24:43 +0900354 if ctx.createVndkSourceAbiDump() {
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800355 exportIncludeDirs := android.PathsForModuleSrc(ctx, library.flagExporter.Properties.Export_include_dirs)
356 var SourceAbiFlags []string
357 for _, dir := range exportIncludeDirs.Strings() {
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700358 SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800359 }
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700360 for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
361 SourceAbiFlags = append(SourceAbiFlags, reexportedInclude)
362 }
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800363 flags.SAbiFlags = SourceAbiFlags
364 total_length := len(library.baseCompiler.Properties.Srcs) + len(deps.GeneratedSources) + len(library.Properties.Shared.Srcs) +
365 len(library.Properties.Static.Srcs)
366 if total_length > 0 {
367 flags.SAbiDump = true
368 }
369 }
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700370 objs := library.baseCompiler.compile(ctx, flags, deps)
371 library.reuseObjects = objs
Colin Cross2f336352016-10-26 10:03:47 -0700372 buildFlags := flagsToBuilderFlags(flags)
Colin Crossb916a382016-07-29 17:28:03 -0700373
Colin Cross4d9c2d12016-07-29 12:48:20 -0700374 if library.static() {
Colin Cross2f336352016-10-26 10:03:47 -0700375 srcs := android.PathsForModuleSrc(ctx, library.Properties.Static.Srcs)
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700376 objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceStaticLibrary,
377 srcs, library.baseCompiler.deps))
Colin Crossa48ab5b2017-02-14 15:28:44 -0800378 } else if library.shared() {
Colin Cross2f336352016-10-26 10:03:47 -0700379 srcs := android.PathsForModuleSrc(ctx, library.Properties.Shared.Srcs)
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700380 objs = objs.Append(compileObjs(ctx, buildFlags, android.DeviceSharedLibrary,
381 srcs, library.baseCompiler.deps))
Colin Crossb916a382016-07-29 17:28:03 -0700382 }
383
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700384 return objs
Colin Crossb916a382016-07-29 17:28:03 -0700385}
386
387type libraryInterface interface {
388 getWholeStaticMissingDeps() []string
389 static() bool
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700390 objs() Objects
Colin Crossbbc9f4d2017-05-03 16:24:55 -0700391 reuseObjs() (Objects, []string, android.Paths)
Colin Cross26c34ed2016-09-30 17:10:16 -0700392 toc() android.OptionalPath
Colin Crossb916a382016-07-29 17:28:03 -0700393
394 // Returns true if the build options for the module have selected a static or shared build
395 buildStatic() bool
396 buildShared() bool
397
398 // Sets whether a specific variant is static or shared
Colin Crossa48ab5b2017-02-14 15:28:44 -0800399 setStatic()
400 setShared()
Colin Crossb916a382016-07-29 17:28:03 -0700401}
402
403func (library *libraryDecorator) getLibName(ctx ModuleContext) string {
404 name := library.libName
405 if name == "" {
Colin Crossce75d2c2016-10-06 16:12:58 -0700406 name = ctx.baseModuleName()
Colin Crossb916a382016-07-29 17:28:03 -0700407 }
408
409 if ctx.Host() && Bool(library.Properties.Unique_host_soname) {
410 if !strings.HasSuffix(name, "-host") {
411 name = name + "-host"
412 }
413 }
414
Colin Crossa48ab5b2017-02-14 15:28:44 -0800415 return name + library.MutatedProperties.VariantName
Colin Crossb916a382016-07-29 17:28:03 -0700416}
417
418func (library *libraryDecorator) linkerInit(ctx BaseModuleContext) {
419 location := InstallInSystem
Vishwath Mohan1dd88392017-03-29 22:00:18 -0700420 if library.sanitize.inSanitizerDir() {
421 location = InstallInSanitizerDir
Colin Crossb916a382016-07-29 17:28:03 -0700422 }
423 library.baseInstaller.location = location
424
425 library.baseLinker.linkerInit(ctx)
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700426
427 library.relocationPacker.packingInit(ctx)
Colin Crossb916a382016-07-29 17:28:03 -0700428}
429
Colin Cross37047f12016-12-13 17:06:13 -0800430func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
Colin Crossb916a382016-07-29 17:28:03 -0700431 deps = library.baseLinker.linkerDeps(ctx, deps)
432
433 if library.static() {
434 deps.WholeStaticLibs = append(deps.WholeStaticLibs,
435 library.Properties.Static.Whole_static_libs...)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700436 deps.StaticLibs = append(deps.StaticLibs, library.Properties.Static.Static_libs...)
437 deps.SharedLibs = append(deps.SharedLibs, library.Properties.Static.Shared_libs...)
Colin Crossa48ab5b2017-02-14 15:28:44 -0800438 } else if library.shared() {
Dan Willemsen2e47b342016-11-17 01:02:25 -0800439 if ctx.toolchain().Bionic() && !Bool(library.baseLinker.Properties.Nocrt) {
Dan Willemsen4416e5d2017-04-06 12:43:22 -0700440 if !ctx.sdk() {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700441 deps.CrtBegin = "crtbegin_so"
442 deps.CrtEnd = "crtend_so"
443 } else {
Dan Albertebedf672016-11-08 15:06:22 -0800444 // TODO(danalbert): Add generation of crt objects.
445 // For `sdk_version: "current"`, we don't actually have a
446 // freshly generated set of CRT objects. Use the last stable
447 // version.
448 version := ctx.sdkVersion()
449 if version == "current" {
Jayant Chowdhary6e8115a2017-05-09 10:21:52 -0700450 version = getCurrentNdkPrebuiltVersion(ctx)
Dan Albertebedf672016-11-08 15:06:22 -0800451 }
452 deps.CrtBegin = "ndk_crtbegin_so." + version
453 deps.CrtEnd = "ndk_crtend_so." + version
Colin Cross4d9c2d12016-07-29 12:48:20 -0700454 }
455 }
456 deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.Properties.Shared.Whole_static_libs...)
457 deps.StaticLibs = append(deps.StaticLibs, library.Properties.Shared.Static_libs...)
458 deps.SharedLibs = append(deps.SharedLibs, library.Properties.Shared.Shared_libs...)
459 }
460
461 return deps
462}
463
Colin Crossb916a382016-07-29 17:28:03 -0700464func (library *libraryDecorator) linkStatic(ctx ModuleContext,
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700465 flags Flags, deps PathDeps, objs Objects) android.Path {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700466
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700467 library.objects = deps.WholeStaticLibObjs.Copy()
468 library.objects = library.objects.Append(objs)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700469
470 outputFile := android.PathForModuleOut(ctx,
Colin Crossa48ab5b2017-02-14 15:28:44 -0800471 ctx.ModuleName()+library.MutatedProperties.VariantName+staticLibraryExtension)
Dan Willemsen581341d2017-02-09 16:16:31 -0800472 builderFlags := flagsToBuilderFlags(flags)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700473
Dan Willemsen581341d2017-02-09 16:16:31 -0800474 TransformObjToStaticLib(ctx, library.objects.objFiles, builderFlags, outputFile, objs.tidyFiles)
475
476 library.coverageOutputFile = TransformCoverageFilesToLib(ctx, library.objects, builderFlags,
Colin Crossa48ab5b2017-02-14 15:28:44 -0800477 ctx.ModuleName()+library.MutatedProperties.VariantName)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700478
479 library.wholeStaticMissingDeps = ctx.GetMissingDependencies()
480
481 ctx.CheckbuildFile(outputFile)
482
483 return outputFile
484}
485
Colin Crossb916a382016-07-29 17:28:03 -0700486func (library *libraryDecorator) linkShared(ctx ModuleContext,
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700487 flags Flags, deps PathDeps, objs Objects) android.Path {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700488
489 var linkerDeps android.Paths
490
491 versionScript := android.OptionalPathForModuleSrc(ctx, library.Properties.Version_script)
492 unexportedSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Unexported_symbols_list)
493 forceNotWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_not_weak_list)
494 forceWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_weak_list)
495 if !ctx.Darwin() {
496 if versionScript.Valid() {
497 flags.LdFlags = append(flags.LdFlags, "-Wl,--version-script,"+versionScript.String())
498 linkerDeps = append(linkerDeps, versionScript.Path())
499 }
500 if unexportedSymbols.Valid() {
501 ctx.PropertyErrorf("unexported_symbols_list", "Only supported on Darwin")
502 }
503 if forceNotWeakSymbols.Valid() {
504 ctx.PropertyErrorf("force_symbols_not_weak_list", "Only supported on Darwin")
505 }
506 if forceWeakSymbols.Valid() {
507 ctx.PropertyErrorf("force_symbols_weak_list", "Only supported on Darwin")
508 }
509 } else {
510 if versionScript.Valid() {
511 ctx.PropertyErrorf("version_script", "Not supported on Darwin")
512 }
513 if unexportedSymbols.Valid() {
514 flags.LdFlags = append(flags.LdFlags, "-Wl,-unexported_symbols_list,"+unexportedSymbols.String())
515 linkerDeps = append(linkerDeps, unexportedSymbols.Path())
516 }
517 if forceNotWeakSymbols.Valid() {
518 flags.LdFlags = append(flags.LdFlags, "-Wl,-force_symbols_not_weak_list,"+forceNotWeakSymbols.String())
519 linkerDeps = append(linkerDeps, forceNotWeakSymbols.Path())
520 }
521 if forceWeakSymbols.Valid() {
522 flags.LdFlags = append(flags.LdFlags, "-Wl,-force_symbols_weak_list,"+forceWeakSymbols.String())
523 linkerDeps = append(linkerDeps, forceWeakSymbols.Path())
524 }
525 }
526
527 fileName := library.getLibName(ctx) + flags.Toolchain.ShlibSuffix()
528 outputFile := android.PathForModuleOut(ctx, fileName)
529 ret := outputFile
530
531 builderFlags := flagsToBuilderFlags(flags)
532
Colin Crossd8f8d072017-04-04 13:00:15 -0700533 if !ctx.Darwin() && !ctx.Windows() {
Colin Cross89562dc2016-10-03 17:47:19 -0700534 // Optimize out relinking against shared libraries whose interface hasn't changed by
535 // depending on a table of contents file instead of the library itself.
536 tocPath := outputFile.RelPathString()
537 tocPath = pathtools.ReplaceExtension(tocPath, flags.Toolchain.ShlibSuffix()[1:]+".toc")
538 tocFile := android.PathForOutput(ctx, tocPath)
539 library.tocFile = android.OptionalPathForPath(tocFile)
540 TransformSharedObjectToToc(ctx, outputFile, tocFile, builderFlags)
541 }
542
Dan Willemsen394e9dc2016-09-14 15:04:48 -0700543 if library.relocationPacker.needsPacking(ctx) {
544 packedOutputFile := outputFile
545 outputFile = android.PathForModuleOut(ctx, "unpacked", fileName)
546 library.relocationPacker.pack(ctx, outputFile, packedOutputFile, builderFlags)
547 }
548
Colin Cross4d9c2d12016-07-29 12:48:20 -0700549 if library.stripper.needsStrip(ctx) {
550 strippedOutputFile := outputFile
551 outputFile = android.PathForModuleOut(ctx, "unstripped", fileName)
552 library.stripper.strip(ctx, outputFile, strippedOutputFile, builderFlags)
553 }
554
555 sharedLibs := deps.SharedLibs
556 sharedLibs = append(sharedLibs, deps.LateSharedLibs...)
557
Dan Albertd015c4a2016-08-10 14:34:08 -0700558 // TODO(danalbert): Clean this up when soong supports prebuilts.
559 if strings.HasPrefix(ctx.selectedStl(), "ndk_libc++") {
560 libDir := getNdkStlLibDir(ctx, flags.Toolchain, "libc++")
561
562 if strings.HasSuffix(ctx.selectedStl(), "_shared") {
563 deps.StaticLibs = append(deps.StaticLibs,
564 libDir.Join(ctx, "libandroid_support.a"))
565 } else {
566 deps.StaticLibs = append(deps.StaticLibs,
567 libDir.Join(ctx, "libc++abi.a"),
568 libDir.Join(ctx, "libandroid_support.a"))
569 }
570
571 if ctx.Arch().ArchType == android.Arm {
572 deps.StaticLibs = append(deps.StaticLibs,
573 libDir.Join(ctx, "libunwind.a"))
574 }
575 }
576
Colin Cross26c34ed2016-09-30 17:10:16 -0700577 linkerDeps = append(linkerDeps, deps.SharedLibsDeps...)
578 linkerDeps = append(linkerDeps, deps.LateSharedLibsDeps...)
Dan Willemsena03cf6d2016-09-26 15:45:04 -0700579 linkerDeps = append(linkerDeps, objs.tidyFiles...)
Colin Cross26c34ed2016-09-30 17:10:16 -0700580
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700581 TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700582 deps.StaticLibs, deps.LateStaticLibs, deps.WholeStaticLibs,
583 linkerDeps, deps.CrtBegin, deps.CrtEnd, false, builderFlags, outputFile)
584
Dan Willemsen581341d2017-02-09 16:16:31 -0800585 objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
586 objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800587
588 objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.StaticLibObjs.sAbiDumpFiles...)
589 objs.sAbiDumpFiles = append(objs.sAbiDumpFiles, deps.WholeStaticLibObjs.sAbiDumpFiles...)
590
Dan Willemsen581341d2017-02-09 16:16:31 -0800591 library.coverageOutputFile = TransformCoverageFilesToLib(ctx, objs, builderFlags, library.getLibName(ctx))
Jayant Chowdhary6ab3d842017-06-26 12:52:58 -0700592 library.linkSAbiDumpFiles(ctx, objs, fileName, ret)
Dan Willemsen581341d2017-02-09 16:16:31 -0800593
Colin Cross4d9c2d12016-07-29 12:48:20 -0700594 return ret
595}
596
Jayant Chowdhary6ab3d842017-06-26 12:52:58 -0700597func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objects, fileName string, soFile android.Path) {
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800598 //Also take into account object re-use.
Justin Yun8effde42017-06-23 19:24:43 +0900599 if len(objs.sAbiDumpFiles) > 0 && ctx.createVndkSourceAbiDump() {
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800600 refSourceDumpFile := android.PathForVndkRefAbiDump(ctx, "current", fileName, vndkVsNdk(ctx), true)
601 versionScript := android.OptionalPathForModuleSrc(ctx, library.Properties.Version_script)
602 var symbolFile android.OptionalPath
603 if versionScript.Valid() {
604 symbolFile = versionScript
605 }
606 exportIncludeDirs := android.PathsForModuleSrc(ctx, library.flagExporter.Properties.Export_include_dirs)
607 var SourceAbiFlags []string
608 for _, dir := range exportIncludeDirs.Strings() {
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700609 SourceAbiFlags = append(SourceAbiFlags, "-I"+dir)
610 }
611 for _, reexportedInclude := range extractExportIncludesFromFlags(library.sabi.Properties.ReexportedIncludeFlags) {
612 SourceAbiFlags = append(SourceAbiFlags, reexportedInclude)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800613 }
614 exportedHeaderFlags := strings.Join(SourceAbiFlags, " ")
Jayant Chowdhary6ab3d842017-06-26 12:52:58 -0700615 library.sAbiOutputFile = TransformDumpToLinkedDump(ctx, objs.sAbiDumpFiles, soFile, symbolFile, "current", fileName, exportedHeaderFlags)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800616 if refSourceDumpFile.Valid() {
Jayant Chowdhary715cac32017-04-20 06:53:59 -0700617 unzippedRefDump := UnzipRefDump(ctx, refSourceDumpFile.Path(), fileName)
618 library.sAbiDiff = SourceAbiDiff(ctx, library.sAbiOutputFile.Path(), unzippedRefDump, fileName)
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800619 }
620 }
621}
622
623func vndkVsNdk(ctx ModuleContext) bool {
624 if inList(ctx.baseModuleName(), config.LLndkLibraries()) {
625 return false
626 }
627 return true
628}
629
Colin Crossb916a382016-07-29 17:28:03 -0700630func (library *libraryDecorator) link(ctx ModuleContext,
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700631 flags Flags, deps PathDeps, objs Objects) android.Path {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700632
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700633 objs = objs.Append(deps.Objs)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700634
635 var out android.Path
Colin Crossa48ab5b2017-02-14 15:28:44 -0800636 if library.static() || library.header() {
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700637 out = library.linkStatic(ctx, flags, deps, objs)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700638 } else {
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700639 out = library.linkShared(ctx, flags, deps, objs)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700640 }
641
642 library.exportIncludes(ctx, "-I")
643 library.reexportFlags(deps.ReexportedFlags)
Dan Willemsen847dcc72016-09-29 12:13:36 -0700644 library.reexportDeps(deps.ReexportedFlagsDeps)
Colin Cross4d9c2d12016-07-29 12:48:20 -0700645
Dan Willemsene1240db2016-11-03 14:28:51 -0700646 if library.Properties.Aidl.Export_aidl_headers {
647 if library.baseCompiler.hasSrcExt(".aidl") {
Colin Cross10d22312017-05-03 11:01:58 -0700648 flags := []string{
Dan Willemsene1240db2016-11-03 14:28:51 -0700649 "-I" + android.PathForModuleGen(ctx, "aidl").String(),
Colin Cross10d22312017-05-03 11:01:58 -0700650 }
651 library.reexportFlags(flags)
652 library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
Dan Willemsene1240db2016-11-03 14:28:51 -0700653 library.reexportDeps(library.baseCompiler.deps) // TODO: restrict to aidl deps
Colin Crossbbc9f4d2017-05-03 16:24:55 -0700654 library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.deps...)
Dan Willemsene1240db2016-11-03 14:28:51 -0700655 }
656 }
657
658 if library.Properties.Proto.Export_proto_headers {
659 if library.baseCompiler.hasSrcExt(".proto") {
Colin Cross10d22312017-05-03 11:01:58 -0700660 flags := []string{
Colin Cross0c461f12016-10-20 16:11:43 -0700661 "-I" + protoSubDir(ctx).String(),
662 "-I" + protoDir(ctx).String(),
Colin Cross10d22312017-05-03 11:01:58 -0700663 }
664 library.reexportFlags(flags)
665 library.reuseExportedFlags = append(library.reuseExportedFlags, flags...)
Colin Cross0c461f12016-10-20 16:11:43 -0700666 library.reexportDeps(library.baseCompiler.deps) // TODO: restrict to proto deps
Colin Crossbbc9f4d2017-05-03 16:24:55 -0700667 library.reuseExportedDeps = append(library.reuseExportedDeps, library.baseCompiler.deps...)
Colin Cross0c461f12016-10-20 16:11:43 -0700668 }
669 }
670
Colin Cross4d9c2d12016-07-29 12:48:20 -0700671 return out
672}
673
Colin Crossb916a382016-07-29 17:28:03 -0700674func (library *libraryDecorator) buildStatic() bool {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800675 return library.MutatedProperties.BuildStatic &&
Colin Cross4d9c2d12016-07-29 12:48:20 -0700676 (library.Properties.Static.Enabled == nil || *library.Properties.Static.Enabled)
677}
678
Colin Crossb916a382016-07-29 17:28:03 -0700679func (library *libraryDecorator) buildShared() bool {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800680 return library.MutatedProperties.BuildShared &&
Colin Cross4d9c2d12016-07-29 12:48:20 -0700681 (library.Properties.Shared.Enabled == nil || *library.Properties.Shared.Enabled)
682}
683
Colin Crossb916a382016-07-29 17:28:03 -0700684func (library *libraryDecorator) getWholeStaticMissingDeps() []string {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700685 return library.wholeStaticMissingDeps
686}
687
Dan Willemsen5cb580f2016-09-26 17:33:01 -0700688func (library *libraryDecorator) objs() Objects {
689 return library.objects
Colin Cross4d9c2d12016-07-29 12:48:20 -0700690}
691
Colin Crossbbc9f4d2017-05-03 16:24:55 -0700692func (library *libraryDecorator) reuseObjs() (Objects, []string, android.Paths) {
693 return library.reuseObjects, library.reuseExportedFlags, library.reuseExportedDeps
Colin Cross4d9c2d12016-07-29 12:48:20 -0700694}
695
Colin Cross26c34ed2016-09-30 17:10:16 -0700696func (library *libraryDecorator) toc() android.OptionalPath {
697 return library.tocFile
698}
699
Colin Crossb916a382016-07-29 17:28:03 -0700700func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
Colin Crossc43ae772017-04-14 15:42:53 -0700701 if library.shared() {
Justin Yun8effde42017-06-23 19:24:43 +0900702 if ctx.Device() {
703 if ctx.vndk() {
704 if ctx.isVndkSp() {
705 library.baseInstaller.subDir = "vndk-sp"
706 } else if ctx.isVndk() {
707 library.baseInstaller.subDir = "vndk"
708 }
709 }
710 }
Colin Cross4d9c2d12016-07-29 12:48:20 -0700711 library.baseInstaller.install(ctx, file)
712 }
713}
714
Colin Crossb916a382016-07-29 17:28:03 -0700715func (library *libraryDecorator) static() bool {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800716 return library.MutatedProperties.VariantIsStatic
Colin Cross4d9c2d12016-07-29 12:48:20 -0700717}
718
Colin Crossa48ab5b2017-02-14 15:28:44 -0800719func (library *libraryDecorator) shared() bool {
720 return library.MutatedProperties.VariantIsShared
721}
722
723func (library *libraryDecorator) header() bool {
724 return !library.static() && !library.shared()
725}
726
727func (library *libraryDecorator) setStatic() {
728 library.MutatedProperties.VariantIsStatic = true
729 library.MutatedProperties.VariantIsShared = false
730}
731
732func (library *libraryDecorator) setShared() {
733 library.MutatedProperties.VariantIsStatic = false
734 library.MutatedProperties.VariantIsShared = true
Colin Crossb916a382016-07-29 17:28:03 -0700735}
736
Colin Crossab3b7322016-12-09 14:46:15 -0800737func (library *libraryDecorator) BuildOnlyStatic() {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800738 library.MutatedProperties.BuildShared = false
Colin Crossab3b7322016-12-09 14:46:15 -0800739}
740
741func (library *libraryDecorator) BuildOnlyShared() {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800742 library.MutatedProperties.BuildStatic = false
Colin Crossab3b7322016-12-09 14:46:15 -0800743}
744
Colin Cross5950f382016-12-13 12:50:57 -0800745func (library *libraryDecorator) HeaderOnly() {
Colin Crossa48ab5b2017-02-14 15:28:44 -0800746 library.MutatedProperties.BuildShared = false
747 library.MutatedProperties.BuildStatic = false
Colin Cross5950f382016-12-13 12:50:57 -0800748}
749
Colin Crossab3b7322016-12-09 14:46:15 -0800750func NewLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
Colin Cross4d9c2d12016-07-29 12:48:20 -0700751 module := newModule(hod, android.MultilibBoth)
752
Colin Crossb916a382016-07-29 17:28:03 -0700753 library := &libraryDecorator{
Colin Crossa48ab5b2017-02-14 15:28:44 -0800754 MutatedProperties: LibraryMutatedProperties{
Colin Crossab3b7322016-12-09 14:46:15 -0800755 BuildShared: true,
756 BuildStatic: true,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700757 },
Colin Crossb916a382016-07-29 17:28:03 -0700758 baseCompiler: NewBaseCompiler(),
759 baseLinker: NewBaseLinker(),
760 baseInstaller: NewBaseInstaller("lib", "lib64", InstallInSystem),
761 sanitize: module.sanitize,
Jayant Chowdhary3e231fd2017-02-08 13:45:53 -0800762 sabi: module.sabi,
Colin Cross4d9c2d12016-07-29 12:48:20 -0700763 }
764
Colin Crossb916a382016-07-29 17:28:03 -0700765 module.compiler = library
766 module.linker = library
767 module.installer = library
768
769 return module, library
770}
771
Colin Cross10d22312017-05-03 11:01:58 -0700772// connects a shared library to a static library in order to reuse its .o files to avoid
773// compiling source files twice.
774func reuseStaticLibrary(mctx android.BottomUpMutatorContext, static, shared *Module) {
775 if staticCompiler, ok := static.compiler.(*libraryDecorator); ok {
776 sharedCompiler := shared.compiler.(*libraryDecorator)
777 if len(staticCompiler.Properties.Static.Cflags) == 0 &&
778 len(sharedCompiler.Properties.Shared.Cflags) == 0 {
779
780 mctx.AddInterVariantDependency(reuseObjTag, shared, static)
781 sharedCompiler.baseCompiler.Properties.OriginalSrcs =
782 sharedCompiler.baseCompiler.Properties.Srcs
783 sharedCompiler.baseCompiler.Properties.Srcs = nil
784 sharedCompiler.baseCompiler.Properties.Generated_sources = nil
785 }
786 }
787}
788
Colin Crossb916a382016-07-29 17:28:03 -0700789func linkageMutator(mctx android.BottomUpMutatorContext) {
790 if m, ok := mctx.Module().(*Module); ok && m.linker != nil {
791 if library, ok := m.linker.(libraryInterface); ok {
792 var modules []blueprint.Module
793 if library.buildStatic() && library.buildShared() {
794 modules = mctx.CreateLocalVariations("static", "shared")
795 static := modules[0].(*Module)
796 shared := modules[1].(*Module)
797
Colin Crossa48ab5b2017-02-14 15:28:44 -0800798 static.linker.(libraryInterface).setStatic()
799 shared.linker.(libraryInterface).setShared()
Colin Crossb916a382016-07-29 17:28:03 -0700800
Colin Cross10d22312017-05-03 11:01:58 -0700801 reuseStaticLibrary(mctx, static, shared)
802
Colin Crossb916a382016-07-29 17:28:03 -0700803 } else if library.buildStatic() {
804 modules = mctx.CreateLocalVariations("static")
Colin Crossa48ab5b2017-02-14 15:28:44 -0800805 modules[0].(*Module).linker.(libraryInterface).setStatic()
Colin Crossb916a382016-07-29 17:28:03 -0700806 } else if library.buildShared() {
807 modules = mctx.CreateLocalVariations("shared")
Colin Crossa48ab5b2017-02-14 15:28:44 -0800808 modules[0].(*Module).linker.(libraryInterface).setShared()
Colin Crossb916a382016-07-29 17:28:03 -0700809 }
810 }
811 }
Colin Cross4d9c2d12016-07-29 12:48:20 -0700812}