Merge "Add dependency to version script when linking stub libraries"
diff --git a/cc/binary.go b/cc/binary.go
index 9bb0b16..941f131 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -384,7 +384,7 @@
TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs, deps.StaticLibs,
deps.LateStaticLibs, deps.WholeStaticLibs, linkerDeps, deps.CrtBegin, deps.CrtEnd, true,
- builderFlags, outputFile)
+ builderFlags, outputFile, nil)
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
diff --git a/cc/builder.go b/cc/builder.go
index d2727b3..7cf5c29 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -26,6 +26,7 @@
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/pathtools"
"android/soong/android"
"android/soong/cc/config"
@@ -611,7 +612,7 @@
// and shared libraries, to a shared library (.so) or dynamic executable
func TransformObjToDynamicBinary(ctx android.ModuleContext,
objFiles, sharedLibs, staticLibs, lateStaticLibs, wholeStaticLibs, deps android.Paths,
- crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
+ crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath, implicitOutputs android.WritablePaths) {
ldCmd := "${config.ClangBin}/clang++"
@@ -648,7 +649,11 @@
}
for _, lib := range sharedLibs {
- libFlagsList = append(libFlagsList, lib.String())
+ libFile := lib.String()
+ if ctx.Windows() {
+ libFile = pathtools.ReplaceExtension(libFile, "lib")
+ }
+ libFlagsList = append(libFlagsList, libFile)
}
deps = append(deps, staticLibs...)
@@ -659,11 +664,12 @@
}
ctx.Build(pctx, android.BuildParams{
- Rule: ld,
- Description: "link " + outputFile.Base(),
- Output: outputFile,
- Inputs: objFiles,
- Implicits: deps,
+ Rule: ld,
+ Description: "link " + outputFile.Base(),
+ Output: outputFile,
+ ImplicitOutputs: implicitOutputs,
+ Inputs: objFiles,
+ Implicits: deps,
Args: map[string]string{
"ldCmd": ldCmd,
"crtBegin": crtBegin.String(),
diff --git a/cc/compiler.go b/cc/compiler.go
index 7667ae7..fd6184b 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -225,11 +225,6 @@
deps = protoDeps(ctx, deps, &compiler.Proto, Bool(compiler.Properties.Proto.Static))
}
- if compiler.hasSrcExt(".sysprop") {
- deps.HeaderLibs = append(deps.HeaderLibs, "libbase_headers")
- deps.SharedLibs = append(deps.SharedLibs, "liblog")
- }
-
if Bool(compiler.Properties.Openmp) {
deps.StaticLibs = append(deps.StaticLibs, "libomp")
}
diff --git a/cc/library.go b/cc/library.go
index d9c00dc..0bc5b5b 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -360,9 +360,10 @@
)
}
} else {
- f = append(f,
- "-shared",
- "-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
+ f = append(f, "-shared")
+ if !ctx.Windows() {
+ f = append(f, "-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
+ }
}
flags.LdFlags = append(f, flags.LdFlags...)
@@ -696,6 +697,14 @@
outputFile := android.PathForModuleOut(ctx, fileName)
ret := outputFile
+ var implicitOutputs android.WritablePaths
+ if ctx.Windows() {
+ importLibraryPath := android.PathForModuleOut(ctx, pathtools.ReplaceExtension(fileName, "lib"))
+
+ flags.LdFlags = append(flags.LdFlags, "-Wl,--out-implib="+importLibraryPath.String())
+ implicitOutputs = append(implicitOutputs, importLibraryPath)
+ }
+
builderFlags := flagsToBuilderFlags(flags)
// Optimize out relinking against shared libraries whose interface hasn't changed by
@@ -747,7 +756,7 @@
TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs,
deps.StaticLibs, deps.LateStaticLibs, deps.WholeStaticLibs,
- linkerDeps, deps.CrtBegin, deps.CrtEnd, false, builderFlags, outputFile)
+ linkerDeps, deps.CrtBegin, deps.CrtEnd, false, builderFlags, outputFile, implicitOutputs)
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)
diff --git a/cc/linker.go b/cc/linker.go
index fafefdc..dda2fcb 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -295,10 +295,6 @@
if ctx.Darwin() {
return false
}
- // http://b/110800681 - lld cannot link Android's Windows modules yet.
- if ctx.Windows() {
- return false
- }
if linker.Properties.Use_clang_lld != nil {
return Bool(linker.Properties.Use_clang_lld)
}
@@ -352,7 +348,7 @@
// darwin defaults to treating undefined symbols as errors
flags.LdFlags = append(flags.LdFlags, "-Wl,-undefined,dynamic_lookup")
}
- } else if !ctx.Darwin() {
+ } else if !ctx.Darwin() && !ctx.Windows() {
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
}
@@ -389,7 +385,7 @@
flags.LdFlags = append(flags.LdFlags, proptools.NinjaAndShellEscapeList(linker.Properties.Ldflags)...)
- if ctx.Host() {
+ if ctx.Host() && !ctx.Windows() {
rpath_prefix := `\$$ORIGIN/`
if ctx.Darwin() {
rpath_prefix = "@loader_path/"
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 3f2709e..86061c6 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -123,6 +123,8 @@
Sysprop struct {
Platform *bool
}
+ Header_libs []string
+ Shared_libs []string
}{}
ccProps.Name = proptools.StringPtr(m.CcModuleName())
@@ -130,6 +132,8 @@
ccProps.Device_specific = proptools.BoolPtr(deviceSpecific)
ccProps.Product_specific = proptools.BoolPtr(productSpecific)
ccProps.Sysprop.Platform = proptools.BoolPtr(owner == "Platform")
+ ccProps.Header_libs = []string{"libbase_headers"}
+ ccProps.Shared_libs = []string{"liblog"}
ctx.CreateModule(android.ModuleFactoryAdaptor(cc.LibraryFactory), &m.commonProperties, &ccProps)
}