Revert "Revert "Revert "Enable lld for windows"""

This reverts commit 6d8c0a50bc.

The switchover to lld appears to be making adb crash on exit for unclear
reasons. Revert it as a quick fix pending further investigation.

Bug: http://b/134613180
Test: adb.exe under windbg
Change-Id: Ibdf5981c3c6828b3684974b7c30a7c96449c64c5
This commit is contained in:
Josh Gao 2019-06-07 12:30:30 -07:00
parent 14bb14e0c3
commit b20200b3f5
4 changed files with 18 additions and 29 deletions

View File

@ -384,7 +384,7 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs, deps.StaticLibs,
deps.LateStaticLibs, deps.WholeStaticLibs, linkerDeps, deps.CrtBegin, deps.CrtEnd, true,
builderFlags, outputFile, nil)
builderFlags, outputFile)
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)

View File

@ -26,7 +26,6 @@ import (
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
"android/soong/android"
"android/soong/cc/config"
@ -612,7 +611,7 @@ func transformDarwinObjToStaticLib(ctx android.ModuleContext, objFiles android.P
// 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, implicitOutputs android.WritablePaths) {
crtBegin, crtEnd android.OptionalPath, groupLate bool, flags builderFlags, outputFile android.WritablePath) {
ldCmd := "${config.ClangBin}/clang++"
@ -649,11 +648,7 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext,
}
for _, lib := range sharedLibs {
libFile := lib.String()
if ctx.Windows() {
libFile = pathtools.ReplaceExtension(libFile, "lib")
}
libFlagsList = append(libFlagsList, libFile)
libFlagsList = append(libFlagsList, lib.String())
}
deps = append(deps, staticLibs...)
@ -664,12 +659,11 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext,
}
ctx.Build(pctx, android.BuildParams{
Rule: ld,
Description: "link " + outputFile.Base(),
Output: outputFile,
ImplicitOutputs: implicitOutputs,
Inputs: objFiles,
Implicits: deps,
Rule: ld,
Description: "link " + outputFile.Base(),
Output: outputFile,
Inputs: objFiles,
Implicits: deps,
Args: map[string]string{
"ldCmd": ldCmd,
"crtBegin": crtBegin.String(),

View File

@ -360,10 +360,9 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla
)
}
} else {
f = append(f, "-shared")
if !ctx.Windows() {
f = append(f, "-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
}
f = append(f,
"-shared",
"-Wl,-soname,"+libName+flags.Toolchain.ShlibSuffix())
}
flags.LdFlags = append(f, flags.LdFlags...)
@ -697,14 +696,6 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
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
@ -756,7 +747,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
TransformObjToDynamicBinary(ctx, objs.objFiles, sharedLibs,
deps.StaticLibs, deps.LateStaticLibs, deps.WholeStaticLibs,
linkerDeps, deps.CrtBegin, deps.CrtEnd, false, builderFlags, outputFile, implicitOutputs)
linkerDeps, deps.CrtBegin, deps.CrtEnd, false, builderFlags, outputFile)
objs.coverageFiles = append(objs.coverageFiles, deps.StaticLibObjs.coverageFiles...)
objs.coverageFiles = append(objs.coverageFiles, deps.WholeStaticLibObjs.coverageFiles...)

View File

@ -295,6 +295,10 @@ func (linker *baseLinker) useClangLld(ctx ModuleContext) bool {
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)
}
@ -348,7 +352,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
// darwin defaults to treating undefined symbols as errors
flags.LdFlags = append(flags.LdFlags, "-Wl,-undefined,dynamic_lookup")
}
} else if !ctx.Darwin() && !ctx.Windows() {
} else if !ctx.Darwin() {
flags.LdFlags = append(flags.LdFlags, "-Wl,--no-undefined")
}
@ -385,7 +389,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags.LdFlags = append(flags.LdFlags, proptools.NinjaAndShellEscapeList(linker.Properties.Ldflags)...)
if ctx.Host() && !ctx.Windows() {
if ctx.Host() {
rpath_prefix := `\$$ORIGIN/`
if ctx.Darwin() {
rpath_prefix = "@loader_path/"