Remove no_default_compiler_flags property

no_default_compiler_flags is only used by the crt* modules,
is unnecessary, and causes problems when necessary flags like
-no-canonical-prefixes are not passed.  Remove the property.

Use useVndk() instead of noDefaultCompilerFlags() to determine
if adding libc as a dependency is necessary and won't cause a
circular dependency.

Bug: 68719465
Test: m checkbuild
Change-Id: Iea1a082dc701dfeab211049a22f7066257347b80
This commit is contained in:
Colin Cross
2017-11-03 13:31:05 -07:00
parent 0f1f679f5e
commit 87dd963ace
4 changed files with 71 additions and 86 deletions

View File

@@ -159,10 +159,6 @@ type BaseProperties struct {
// Minimum sdk version supported when compiling against the ndk
Sdk_version string
// don't insert default compiler flags into asflags, cflags,
// cppflags, conlyflags, ldflags, or include_dirs
No_default_compiler_flags *bool
AndroidMkSharedLibs []string `blueprint:"mutated"`
HideFromMake bool `blueprint:"mutated"`
PreventInstall bool `blueprint:"mutated"`
@@ -199,7 +195,6 @@ type ModuleContextIntf interface {
staticBinary() bool
clang() bool
toolchain() config.Toolchain
noDefaultCompilerFlags() bool
useSdk() bool
sdkVersion() string
useVndk() bool
@@ -452,10 +447,6 @@ func (ctx *moduleContextImpl) staticBinary() bool {
return false
}
func (ctx *moduleContextImpl) noDefaultCompilerFlags() bool {
return Bool(ctx.mod.Properties.No_default_compiler_flags)
}
func (ctx *moduleContextImpl) useSdk() bool {
if ctx.ctx.Device() && !ctx.useVndk() {
return ctx.mod.Properties.Sdk_version != ""

View File

@@ -232,7 +232,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.YasmFlags = append(flags.YasmFlags, f)
}
if !ctx.noDefaultCompilerFlags() {
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String())
flags.YasmFlags = append(flags.YasmFlags, "-I"+android.PathForModuleSrc(ctx).String())
@@ -242,7 +241,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
tc.IncludeFlags(),
"${config.CommonNativehelperInclude}")
}
}
if ctx.useSdk() {
// The NDK headers are installed to a common sysroot. While a more
@@ -318,7 +316,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
hod = "Device"
}
if !ctx.noDefaultCompilerFlags() {
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
@@ -358,7 +355,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
}
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
}
if flags.Clang {
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())

View File

@@ -201,7 +201,6 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
hod = "Device"
}
if !ctx.noDefaultCompilerFlags() {
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLdflags}", hod))
if Bool(linker.Properties.Allow_undefined_symbols) {
if ctx.Darwin() {
@@ -236,7 +235,6 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
}
}
}
}
CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)

View File

@@ -53,7 +53,7 @@ func (object *objectLinker) linkerProps() []interface{} {
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
if !ctx.noDefaultCompilerFlags() && ctx.toolchain().Bionic() {
if ctx.useVndk() && ctx.toolchain().Bionic() {
// Needed for VNDK builds where bionic headers aren't automatically added.
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc")
}