Add basic NDK STL link type check.
Test: make native Bug: None Change-Id: If883fade38c837839857d82f294c459b0dae1ce0
This commit is contained in:
21
cc/cc.go
21
cc/cc.go
@@ -1036,6 +1036,27 @@ func checkLinkType(ctx android.ModuleContext, from *Module, to *Module) {
|
||||
ctx.ModuleErrorf("links %q built against newer API version %q",
|
||||
ctx.OtherModuleName(to), String(to.Properties.Sdk_version))
|
||||
}
|
||||
|
||||
// Also check that the two STL choices are compatible.
|
||||
fromStl := from.stl.Properties.SelectedStl
|
||||
toStl := to.stl.Properties.SelectedStl
|
||||
if fromStl == "" || toStl == "" {
|
||||
// Libraries that don't use the STL are unrestricted.
|
||||
return
|
||||
}
|
||||
|
||||
if fromStl == "ndk_system" || toStl == "ndk_system" {
|
||||
// We can be permissive with the system "STL" since it is only the C++
|
||||
// ABI layer, but in the future we should make sure that everyone is
|
||||
// using either libc++ or nothing.
|
||||
return
|
||||
}
|
||||
|
||||
if getNdkStlFamily(ctx, from) != getNdkStlFamily(ctx, to) {
|
||||
ctx.ModuleErrorf("uses %q and depends on %q which uses incompatible %q",
|
||||
from.stl.Properties.SelectedStl, ctx.OtherModuleName(to),
|
||||
to.stl.Properties.SelectedStl)
|
||||
}
|
||||
}
|
||||
|
||||
// Convert dependencies to paths. Returns a PathDeps containing paths
|
||||
|
Reference in New Issue
Block a user