Merge "Ninja and shell escape command line flags"

This commit is contained in:
Treehugger Robot 2016-09-30 04:17:57 +00:00 committed by Gerrit Code Review
commit 12013c8fe6
2 changed files with 15 additions and 9 deletions

View File

@ -19,6 +19,8 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/google/blueprint/proptools"
"android/soong/android" "android/soong/android"
"android/soong/cc/config" "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, "conlyflags", compiler.Properties.Conlyflags)
CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags) CheckBadCompilerFlags(ctx, "asflags", compiler.Properties.Asflags)
flags.CFlags = append(flags.CFlags, compiler.Properties.Cflags...) esc := proptools.NinjaAndShellEscape
flags.CppFlags = append(flags.CppFlags, compiler.Properties.Cppflags...)
flags.ConlyFlags = append(flags.ConlyFlags, compiler.Properties.Conlyflags...) flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Cflags)...)
flags.AsFlags = append(flags.AsFlags, compiler.Properties.Asflags...) flags.CppFlags = append(flags.CppFlags, esc(compiler.Properties.Cppflags)...)
flags.YaccFlags = append(flags.YaccFlags, compiler.Properties.Yaccflags...) 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 // Include dir cflags
rootIncludeDirs := android.PathsForSource(ctx, compiler.Properties.Include_dirs) 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) CheckBadCompilerFlags(ctx, "release.cflags", compiler.Properties.Release.Cflags)
// TODO: debug // TODO: debug
flags.CFlags = append(flags.CFlags, compiler.Properties.Release.Cflags...) flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Release.Cflags)...)
if flags.Clang { if flags.Clang {
CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags) CheckBadCompilerFlags(ctx, "clang_cflags", compiler.Properties.Clang_cflags)
CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags) CheckBadCompilerFlags(ctx, "clang_asflags", compiler.Properties.Clang_asflags)
flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags) flags.CFlags = config.ClangFilterUnknownCflags(flags.CFlags)
flags.CFlags = append(flags.CFlags, compiler.Properties.Clang_cflags...) flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Clang_cflags)...)
flags.AsFlags = append(flags.AsFlags, compiler.Properties.Clang_asflags...) flags.AsFlags = append(flags.AsFlags, esc(compiler.Properties.Clang_asflags)...)
flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags) flags.CppFlags = config.ClangFilterUnknownCflags(flags.CppFlags)
flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags) flags.ConlyFlags = config.ClangFilterUnknownCflags(flags.ConlyFlags)
flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags) flags.LdFlags = config.ClangFilterUnknownCflags(flags.LdFlags)

View File

@ -17,6 +17,8 @@ package cc
import ( import (
"android/soong/android" "android/soong/android"
"fmt" "fmt"
"github.com/google/blueprint/proptools"
) )
// This file contains the basic functionality for linking against static libraries and shared // 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) 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() { if ctx.Host() {
rpath_prefix := `\$$ORIGIN/` rpath_prefix := `\$$ORIGIN/`