diff options
| author | 2016-09-21 22:55:25 +0000 | |
|---|---|---|
| committer | 2016-09-21 22:55:25 +0000 | |
| commit | 16cb669007859ebc986c5459fc302f62b0aa89db (patch) | |
| tree | 5b776eca045863310639055ce151f76f95b261f2 | |
| parent | a51a135f114f6f0dbf7c4afd336f68b4a0d1bb7d (diff) | |
| parent | be332edb022cc32c7c34d22f2c8f96611401c529 (diff) | |
Merge "Reimplement ART_NDEBUG_OPT_FLAG"
| -rw-r--r-- | build/Android.bp | 5 | ||||
| -rw-r--r-- | build/art.go | 30 |
2 files changed, 31 insertions, 4 deletions
diff --git a/build/Android.bp b/build/Android.bp index 4be43ec439..9156027dee 100644 --- a/build/Android.bp +++ b/build/Android.bp @@ -22,8 +22,6 @@ art_global_defaults { name: "art_defaults", clang: true, cflags: [ - "-O3", - // Base set of cflags used by all things ART. "-fno-rtti", "-ggdb3", @@ -149,10 +147,9 @@ art_global_defaults { ], } -cc_defaults { +art_debug_defaults { name: "art_debug_defaults", cflags: [ - "-O2", "-DDYNAMIC_ANNOTATIONS_ENABLED=1", "-DVIXL_DEBUG", "-UNDEBUG", diff --git a/build/art.go b/build/art.go index ba5521a9ae..0ae6c8fa58 100644 --- a/build/art.go +++ b/build/art.go @@ -30,6 +30,9 @@ func globalFlags(ctx android.BaseContext) ([]string, []string) { var cflags []string var asflags []string + opt := envDefault(ctx, "ART_NDEBUG_OPT_FLAG", "-O3") + cflags = append(cflags, opt) + tlab := false gcType := envDefault(ctx, "ART_DEFAULT_GC_TYPE", "CMS") @@ -75,6 +78,15 @@ func globalFlags(ctx android.BaseContext) ([]string, []string) { return cflags, asflags } +func debugFlags(ctx android.BaseContext) []string { + var cflags []string + + opt := envDefault(ctx, "ART_DEBUG_OPT_FLAG", "-O2") + cflags = append(cflags, opt) + + return cflags +} + func deviceFlags(ctx android.BaseContext) []string { var cflags []string deviceFrameSizeLimit := 1736 @@ -143,6 +155,16 @@ func globalDefaults(ctx android.LoadHookContext) { ctx.AppendProperties(p) } +func debugDefaults(ctx android.LoadHookContext) { + type props struct { + Cflags []string + } + + p := &props{} + p.Cflags = debugFlags(ctx) + ctx.AppendProperties(p) +} + func customLinker(ctx android.LoadHookContext) { linker := envDefault(ctx, "CUSTOM_TARGET_LINKER", "") if linker != "" { @@ -206,6 +228,7 @@ func init() { soong.RegisterModuleType("art_cc_test_library", artTestLibrary) soong.RegisterModuleType("art_cc_defaults", artDefaultsFactory) soong.RegisterModuleType("art_global_defaults", artGlobalDefaultsFactory) + soong.RegisterModuleType("art_debug_defaults", artDebugDefaultsFactory) } func artGlobalDefaultsFactory() (blueprint.Module, []interface{}) { @@ -215,6 +238,13 @@ func artGlobalDefaultsFactory() (blueprint.Module, []interface{}) { return module, props } +func artDebugDefaultsFactory() (blueprint.Module, []interface{}) { + module, props := artDefaultsFactory() + android.AddLoadHook(module, debugDefaults) + + return module, props +} + func artDefaultsFactory() (blueprint.Module, []interface{}) { c := &codegenProperties{} module, props := cc.DefaultsFactory(c) |