aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2016-09-30 04:17:57 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-09-30 04:17:59 +0000
commit12013c8fe6d272c665b8b31672d49868a3cd41d3 (patch)
tree55f7574387e755b3e80720f9b824723a6ecaaf73
parent847dcc7d2a3dd3125f8c4bb9dcb4ea62125e43d8 (diff)
parent4b963f8d6a7bff85327b81aa0038190bd7dc630d (diff)
downloadbuild_soong-12013c8fe6d272c665b8b31672d49868a3cd41d3.tar.gz
build_soong-12013c8fe6d272c665b8b31672d49868a3cd41d3.tar.bz2
build_soong-12013c8fe6d272c665b8b31672d49868a3cd41d3.zip
Merge "Ninja and shell escape command line flags"
-rw-r--r--cc/compiler.go20
-rw-r--r--cc/linker.go4
2 files changed, 15 insertions, 9 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index 37dc7449..db4c076c 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -19,6 +19,8 @@ import (
"path/filepath"
"strings"
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/cc/config"
)
@@ -130,11 +132,13 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
CheckBadCompilerFlags(ctx, "conlyflags", compiler.Properties.Conlyflags)
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
- flags.CFlags = append(flags.CFlags, compiler.Properties.Cflags...)
- flags.CppFlags = append(flags.CppFlags, compiler.Properties.Cppflags...)
- flags.ConlyFlags = append(flags.ConlyFlags, compiler.Properties.Conlyflags...)
- flags.AsFlags = append(flags.AsFlags, compiler.Properties.Asflags...)
- flags.YaccFlags = append(flags.YaccFlags, compiler.Properties.Yaccflags...)
+ esc := proptools.NinjaAndShellEscape
+
+ flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Cflags)...)
+ flags.CppFlags = append(flags.CppFlags, esc(compiler.Properties.Cppflags)...)
+ flags.ConlyFlags = append(flags.ConlyFlags, esc(compiler.Properties.Conlyflags)...)
+ flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Asflags)...)
+ flags.YaccFlags = append(flags.YaccFlags, esc(compiler.Properties.Yaccflags)...)
// Include dir cflags
rootIncludeDirs := android.PathsForSource(ctx, compiler.Properties.Include_dirs)
@@ -198,15 +202,15 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
CheckBadCompilerFlags(ctx, "release.cflags", compiler.Properties.Release.Cflags)
// TODO: debug
- flags.CFlags = append(flags.CFlags, compiler.Properties.Release.Cflags...)
+ flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
if flags.Clang {
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
- flags.CFlags = append(flags.CFlags, compiler.Properties.Clang_cflags...)
- flags.AsFlags = append(flags.AsFlags, compiler.Properties.Clang_asflags...)
+ flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
+ flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)
diff --git a/cc/linker.go b/cc/linker.go
index 2c4c2505..399074d0 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -17,6 +17,8 @@ package cc
import (
"android/soong/android"
"fmt"
+
+ "github.com/google/blueprint/proptools"
)
// This file contains the basic functionality for linking against static libraries and shared
@@ -167,7 +169,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)
- flags.LdFlags = append(flags.LdFlags, linker.Properties.Ldflags...)
+ flags.LdFlags = append(flags.LdFlags, proptools.NinjaAndShellEscape(linker.Properties.Ldflags)...)
if ctx.Host() {
rpath_prefix := `\$$ORIGIN/`