Merge changes from topic "crt_cflags"
am: 5c9cf6eb84
Change-Id: I1369c0df3bf10cfe1681bffbab8f2003f1a53505
This commit is contained in:
9
cc/cc.go
9
cc/cc.go
@@ -159,10 +159,6 @@ type BaseProperties struct {
|
|||||||
// Minimum sdk version supported when compiling against the ndk
|
// Minimum sdk version supported when compiling against the ndk
|
||||||
Sdk_version string
|
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"`
|
AndroidMkSharedLibs []string `blueprint:"mutated"`
|
||||||
HideFromMake bool `blueprint:"mutated"`
|
HideFromMake bool `blueprint:"mutated"`
|
||||||
PreventInstall bool `blueprint:"mutated"`
|
PreventInstall bool `blueprint:"mutated"`
|
||||||
@@ -199,7 +195,6 @@ type ModuleContextIntf interface {
|
|||||||
staticBinary() bool
|
staticBinary() bool
|
||||||
clang() bool
|
clang() bool
|
||||||
toolchain() config.Toolchain
|
toolchain() config.Toolchain
|
||||||
noDefaultCompilerFlags() bool
|
|
||||||
useSdk() bool
|
useSdk() bool
|
||||||
sdkVersion() string
|
sdkVersion() string
|
||||||
useVndk() bool
|
useVndk() bool
|
||||||
@@ -452,10 +447,6 @@ func (ctx *moduleContextImpl) staticBinary() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) noDefaultCompilerFlags() bool {
|
|
||||||
return Bool(ctx.mod.Properties.No_default_compiler_flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) useSdk() bool {
|
func (ctx *moduleContextImpl) useSdk() bool {
|
||||||
if ctx.ctx.Device() && !ctx.useVndk() {
|
if ctx.ctx.Device() && !ctx.useVndk() {
|
||||||
return ctx.mod.Properties.Sdk_version != ""
|
return ctx.mod.Properties.Sdk_version != ""
|
||||||
|
@@ -232,7 +232,6 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
|||||||
flags.YasmFlags = append(flags.YasmFlags, f)
|
flags.YasmFlags = append(flags.YasmFlags, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.noDefaultCompilerFlags() {
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String())
|
flags.GlobalFlags = append(flags.GlobalFlags, "-I"+android.PathForModuleSrc(ctx).String())
|
||||||
flags.YasmFlags = append(flags.YasmFlags, "-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(),
|
tc.IncludeFlags(),
|
||||||
"${config.CommonNativehelperInclude}")
|
"${config.CommonNativehelperInclude}")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ctx.useSdk() {
|
if ctx.useSdk() {
|
||||||
// The NDK headers are installed to a common sysroot. While a more
|
// 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"
|
hod = "Device"
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.noDefaultCompilerFlags() {
|
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
|
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
|
||||||
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
|
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())
|
flags.YasmFlags = append(flags.YasmFlags, tc.YasmFlags())
|
||||||
}
|
|
||||||
|
|
||||||
if flags.Clang {
|
if flags.Clang {
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
flags.GlobalFlags = append(flags.GlobalFlags, tc.ToolchainClangCflags())
|
||||||
|
@@ -23,49 +23,26 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
arm64Cflags = []string{
|
arm64Cflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-ffunction-sections",
|
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
"-funwind-tables",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-fno-short-enums",
|
"-fno-short-enums",
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
// Help catch common 32/64-bit errors.
|
// Help catch common 32/64-bit errors.
|
||||||
"-Werror=pointer-to-int-cast",
|
|
||||||
"-Werror=int-to-pointer-cast",
|
|
||||||
"-Werror=implicit-function-declaration",
|
"-Werror=implicit-function-declaration",
|
||||||
|
|
||||||
"-fno-strict-volatile-bitfields",
|
"-fno-strict-volatile-bitfields",
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS
|
// TARGET_RELEASE_CFLAGS
|
||||||
"-DNDEBUG",
|
|
||||||
"-O2 -g",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-fgcse-after-reload",
|
"-fgcse-after-reload",
|
||||||
"-frerun-cse-after-loop",
|
"-frerun-cse-after-loop",
|
||||||
"-frename-registers",
|
"-frename-registers",
|
||||||
}
|
}
|
||||||
|
|
||||||
arm64Ldflags = []string{
|
arm64Ldflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,-m,aarch64_elf64_le_vec",
|
"-Wl,-m,aarch64_elf64_le_vec",
|
||||||
"-Wl,--hash-style=gnu",
|
"-Wl,--hash-style=gnu",
|
||||||
"-Wl,--fix-cortex-a53-843419",
|
"-Wl,--fix-cortex-a53-843419",
|
||||||
"-fuse-ld=gold",
|
"-fuse-ld=gold",
|
||||||
"-Wl,--icf=safe",
|
"-Wl,--icf=safe",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
arm64Cppflags = []string{
|
arm64Cppflags = []string{
|
||||||
|
@@ -28,29 +28,18 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
armCflags = []string{
|
armCflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-ffunction-sections",
|
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
"-funwind-tables",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-fno-short-enums",
|
"-fno-short-enums",
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
"-fno-builtin-sin",
|
"-fno-builtin-sin",
|
||||||
"-fno-strict-volatile-bitfields",
|
"-fno-strict-volatile-bitfields",
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS
|
// TARGET_RELEASE_CFLAGS
|
||||||
"-DNDEBUG",
|
|
||||||
"-g",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-fgcse-after-reload",
|
"-fgcse-after-reload",
|
||||||
"-frerun-cse-after-loop",
|
"-frerun-cse-after-loop",
|
||||||
"-frename-registers",
|
"-frename-registers",
|
||||||
|
|
||||||
|
"-fomit-frame-pointer",
|
||||||
}
|
}
|
||||||
|
|
||||||
armCppflags = []string{
|
armCppflags = []string{
|
||||||
@@ -58,21 +47,12 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
armLdflags = []string{
|
armLdflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,--icf=safe",
|
"-Wl,--icf=safe",
|
||||||
"-Wl,--hash-style=gnu",
|
"-Wl,--hash-style=gnu",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
"-Wl,-m,armelf",
|
"-Wl,-m,armelf",
|
||||||
}
|
}
|
||||||
|
|
||||||
armArmCflags = []string{
|
armArmCflags = []string{
|
||||||
"-O2",
|
|
||||||
"-fomit-frame-pointer",
|
|
||||||
"-fstrict-aliasing",
|
"-fstrict-aliasing",
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
}
|
}
|
||||||
@@ -80,8 +60,6 @@ var (
|
|||||||
armThumbCflags = []string{
|
armThumbCflags = []string{
|
||||||
"-mthumb",
|
"-mthumb",
|
||||||
"-Os",
|
"-Os",
|
||||||
"-fomit-frame-pointer",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
armArchVariantCflags = map[string][]string{
|
armArchVariantCflags = map[string][]string{
|
||||||
|
@@ -34,9 +34,19 @@ var (
|
|||||||
"-Winit-self",
|
"-Winit-self",
|
||||||
"-Wpointer-arith",
|
"-Wpointer-arith",
|
||||||
|
|
||||||
// COMMON_RELEASE_CFLAGS
|
// Make paths in deps files relative
|
||||||
|
"-no-canonical-prefixes",
|
||||||
|
|
||||||
"-DNDEBUG",
|
"-DNDEBUG",
|
||||||
"-UDEBUG",
|
"-UDEBUG",
|
||||||
|
|
||||||
|
"-fno-exceptions",
|
||||||
|
"-Wno-multichar",
|
||||||
|
|
||||||
|
"-O2",
|
||||||
|
"-g",
|
||||||
|
|
||||||
|
"-fno-strict-aliasing",
|
||||||
}
|
}
|
||||||
|
|
||||||
commonGlobalConlyflags = []string{}
|
commonGlobalConlyflags = []string{}
|
||||||
@@ -44,16 +54,37 @@ var (
|
|||||||
deviceGlobalCflags = []string{
|
deviceGlobalCflags = []string{
|
||||||
"-fdiagnostics-color",
|
"-fdiagnostics-color",
|
||||||
|
|
||||||
// TARGET_ERROR_FLAGS
|
"-fno-canonical-system-headers",
|
||||||
|
"-ffunction-sections",
|
||||||
|
"-funwind-tables",
|
||||||
|
"-fstack-protector-strong",
|
||||||
|
"-Wa,--noexecstack",
|
||||||
|
"-D_FORTIFY_SOURCE=2",
|
||||||
|
|
||||||
|
"-Wstrict-aliasing=2",
|
||||||
|
|
||||||
"-Werror=return-type",
|
"-Werror=return-type",
|
||||||
"-Werror=non-virtual-dtor",
|
"-Werror=non-virtual-dtor",
|
||||||
"-Werror=address",
|
"-Werror=address",
|
||||||
"-Werror=sequence-point",
|
"-Werror=sequence-point",
|
||||||
"-Werror=date-time",
|
"-Werror=date-time",
|
||||||
|
"-Werror=format-security",
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceGlobalLdflags = []string{
|
||||||
|
"-Wl,-z,noexecstack",
|
||||||
|
"-Wl,-z,relro",
|
||||||
|
"-Wl,-z,now",
|
||||||
|
"-Wl,--build-id=md5",
|
||||||
|
"-Wl,--warn-shared-textrel",
|
||||||
|
"-Wl,--fatal-warnings",
|
||||||
|
"-Wl,--no-undefined-version",
|
||||||
}
|
}
|
||||||
|
|
||||||
hostGlobalCflags = []string{}
|
hostGlobalCflags = []string{}
|
||||||
|
|
||||||
|
hostGlobalLdflags = []string{}
|
||||||
|
|
||||||
commonGlobalCppflags = []string{
|
commonGlobalCppflags = []string{
|
||||||
"-Wsign-promo",
|
"-Wsign-promo",
|
||||||
}
|
}
|
||||||
@@ -91,7 +122,9 @@ func init() {
|
|||||||
pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
|
pctx.StaticVariable("CommonGlobalCflags", strings.Join(commonGlobalCflags, " "))
|
||||||
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
|
pctx.StaticVariable("CommonGlobalConlyflags", strings.Join(commonGlobalConlyflags, " "))
|
||||||
pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
|
pctx.StaticVariable("DeviceGlobalCflags", strings.Join(deviceGlobalCflags, " "))
|
||||||
|
pctx.StaticVariable("DeviceGlobalLdflags", strings.Join(deviceGlobalLdflags, " "))
|
||||||
pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
|
pctx.StaticVariable("HostGlobalCflags", strings.Join(hostGlobalCflags, " "))
|
||||||
|
pctx.StaticVariable("HostGlobalLdflags", strings.Join(hostGlobalLdflags, " "))
|
||||||
pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
|
pctx.StaticVariable("NoOverrideGlobalCflags", strings.Join(noOverrideGlobalCflags, " "))
|
||||||
|
|
||||||
pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
|
pctx.StaticVariable("CommonGlobalCppflags", strings.Join(commonGlobalCppflags, " "))
|
||||||
|
@@ -22,32 +22,15 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
mips64Cflags = []string{
|
mips64Cflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-fomit-frame-pointer",
|
"-fomit-frame-pointer",
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
"-Umips",
|
"-Umips",
|
||||||
"-ffunction-sections",
|
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
"-funwind-tables",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
// Help catch common 32/64-bit errors.
|
// Help catch common 32/64-bit errors.
|
||||||
"-Werror=pointer-to-int-cast",
|
|
||||||
"-Werror=int-to-pointer-cast",
|
|
||||||
"-Werror=implicit-function-declaration",
|
"-Werror=implicit-function-declaration",
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS
|
// TARGET_RELEASE_CFLAGS
|
||||||
"-DNDEBUG",
|
|
||||||
"-g",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-fgcse-after-reload",
|
"-fgcse-after-reload",
|
||||||
"-frerun-cse-after-loop",
|
"-frerun-cse-after-loop",
|
||||||
"-frename-registers",
|
"-frename-registers",
|
||||||
@@ -62,14 +45,7 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
mips64Ldflags = []string{
|
mips64Ldflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,--allow-shlib-undefined",
|
"-Wl,--allow-shlib-undefined",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mips64ArchVariantCflags = map[string][]string{
|
mips64ArchVariantCflags = map[string][]string{
|
||||||
|
@@ -22,27 +22,12 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
mipsCflags = []string{
|
mipsCflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-fomit-frame-pointer",
|
"-fomit-frame-pointer",
|
||||||
"-fno-strict-aliasing",
|
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
"-Umips",
|
"-Umips",
|
||||||
"-ffunction-sections",
|
|
||||||
"-fdata-sections",
|
"-fdata-sections",
|
||||||
"-funwind-tables",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS
|
// TARGET_RELEASE_CFLAGS
|
||||||
"-DNDEBUG",
|
|
||||||
"-g",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-fgcse-after-reload",
|
"-fgcse-after-reload",
|
||||||
"-frerun-cse-after-loop",
|
"-frerun-cse-after-loop",
|
||||||
"-frename-registers",
|
"-frename-registers",
|
||||||
@@ -58,14 +43,7 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
mipsLdflags = []string{
|
mipsLdflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,--allow-shlib-undefined",
|
"-Wl,--allow-shlib-undefined",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mipsToolchainLdflags = []string{
|
mipsToolchainLdflags = []string{
|
||||||
|
@@ -22,47 +22,19 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
x86_64Cflags = []string{
|
x86_64Cflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-ffunction-sections",
|
|
||||||
"-finline-functions",
|
"-finline-functions",
|
||||||
"-finline-limit=300",
|
"-finline-limit=300",
|
||||||
"-fno-short-enums",
|
"-fno-short-enums",
|
||||||
"-fstrict-aliasing",
|
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
"-funwind-tables",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
// Help catch common 32/64-bit errors.
|
// Help catch common 32/64-bit errors.
|
||||||
"-Werror=pointer-to-int-cast",
|
|
||||||
"-Werror=int-to-pointer-cast",
|
|
||||||
"-Werror=implicit-function-declaration",
|
"-Werror=implicit-function-declaration",
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-g",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x86_64Cppflags = []string{}
|
x86_64Cppflags = []string{}
|
||||||
|
|
||||||
x86_64Ldflags = []string{
|
x86_64Ldflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,--gc-sections",
|
|
||||||
"-Wl,--hash-style=gnu",
|
"-Wl,--hash-style=gnu",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x86_64ArchVariantCflags = map[string][]string{
|
x86_64ArchVariantCflags = map[string][]string{
|
||||||
|
@@ -25,9 +25,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
darwinCflags = []string{
|
darwinCflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
|
|
||||||
"-fdiagnostics-color",
|
"-fdiagnostics-color",
|
||||||
|
|
||||||
"-fPIC",
|
"-fPIC",
|
||||||
@@ -38,10 +35,6 @@ var (
|
|||||||
"-D__STDC_FORMAT_MACROS",
|
"-D__STDC_FORMAT_MACROS",
|
||||||
"-D__STDC_CONSTANT_MACROS",
|
"-D__STDC_CONSTANT_MACROS",
|
||||||
|
|
||||||
// HOST_RELEASE_CFLAGS
|
|
||||||
"-O2", // from build/core/combo/select.mk
|
|
||||||
"-g", // from build/core/combo/select.mk
|
|
||||||
"-fno-strict-aliasing", // from build/core/combo/select.mk
|
|
||||||
"-isysroot ${macSdkRoot}",
|
"-isysroot ${macSdkRoot}",
|
||||||
"-mmacosx-version-min=${macMinVersion}",
|
"-mmacosx-version-min=${macMinVersion}",
|
||||||
"-DMACOSX_DEPLOYMENT_TARGET=${macMinVersion}",
|
"-DMACOSX_DEPLOYMENT_TARGET=${macMinVersion}",
|
||||||
|
@@ -22,28 +22,10 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
x86Cflags = []string{
|
x86Cflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-Wa,--noexecstack",
|
|
||||||
"-Werror=format-security",
|
|
||||||
"-D_FORTIFY_SOURCE=2",
|
|
||||||
"-Wstrict-aliasing=2",
|
|
||||||
"-ffunction-sections",
|
|
||||||
"-finline-functions",
|
"-finline-functions",
|
||||||
"-finline-limit=300",
|
"-finline-limit=300",
|
||||||
"-fno-short-enums",
|
"-fno-short-enums",
|
||||||
"-fstrict-aliasing",
|
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
"-funwind-tables",
|
|
||||||
"-fstack-protector-strong",
|
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
|
||||||
|
|
||||||
// TARGET_RELEASE_CFLAGS from build/core/combo/select.mk
|
|
||||||
"-O2",
|
|
||||||
"-g",
|
|
||||||
"-fno-strict-aliasing",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x86ClangCflags = append(x86Cflags, []string{
|
x86ClangCflags = append(x86Cflags, []string{
|
||||||
@@ -58,15 +40,7 @@ var (
|
|||||||
x86Cppflags = []string{}
|
x86Cppflags = []string{}
|
||||||
|
|
||||||
x86Ldflags = []string{
|
x86Ldflags = []string{
|
||||||
"-Wl,-z,noexecstack",
|
|
||||||
"-Wl,-z,relro",
|
|
||||||
"-Wl,-z,now",
|
|
||||||
"-Wl,--build-id=md5",
|
|
||||||
"-Wl,--warn-shared-textrel",
|
|
||||||
"-Wl,--fatal-warnings",
|
|
||||||
"-Wl,--gc-sections",
|
|
||||||
"-Wl,--hash-style=gnu",
|
"-Wl,--hash-style=gnu",
|
||||||
"-Wl,--no-undefined-version",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
x86ArchVariantCflags = map[string][]string{
|
x86ArchVariantCflags = map[string][]string{
|
||||||
|
@@ -22,15 +22,11 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
linuxBionicCflags = ClangFilterUnknownCflags([]string{
|
linuxBionicCflags = ClangFilterUnknownCflags([]string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
|
|
||||||
"-fdiagnostics-color",
|
"-fdiagnostics-color",
|
||||||
|
|
||||||
"-Wa,--noexecstack",
|
"-Wa,--noexecstack",
|
||||||
|
|
||||||
"-fPIC",
|
"-fPIC",
|
||||||
"-no-canonical-prefixes",
|
|
||||||
|
|
||||||
"-U_FORTIFY_SOURCE",
|
"-U_FORTIFY_SOURCE",
|
||||||
"-D_FORTIFY_SOURCE=2",
|
"-D_FORTIFY_SOURCE=2",
|
||||||
@@ -43,14 +39,8 @@ var (
|
|||||||
"-fno-short-enums",
|
"-fno-short-enums",
|
||||||
"-funswitch-loops",
|
"-funswitch-loops",
|
||||||
"-funwind-tables",
|
"-funwind-tables",
|
||||||
"-no-canonical-prefixes",
|
|
||||||
"-fno-canonical-system-headers",
|
"-fno-canonical-system-headers",
|
||||||
|
|
||||||
// HOST_RELEASE_CFLAGS
|
|
||||||
"-O2", // from build/core/combo/select.mk
|
|
||||||
"-g", // from build/core/combo/select.mk
|
|
||||||
"-fno-strict-aliasing", // from build/core/combo/select.mk
|
|
||||||
|
|
||||||
// Tell clang where the gcc toolchain is
|
// Tell clang where the gcc toolchain is
|
||||||
"--gcc-toolchain=${LinuxBionicGccRoot}",
|
"--gcc-toolchain=${LinuxBionicGccRoot}",
|
||||||
|
|
||||||
@@ -65,7 +55,6 @@ var (
|
|||||||
"-Wl,--build-id=md5",
|
"-Wl,--build-id=md5",
|
||||||
"-Wl,--warn-shared-textrel",
|
"-Wl,--warn-shared-textrel",
|
||||||
"-Wl,--fatal-warnings",
|
"-Wl,--fatal-warnings",
|
||||||
"-Wl,--gc-sections",
|
|
||||||
"-Wl,--hash-style=gnu",
|
"-Wl,--hash-style=gnu",
|
||||||
"-Wl,--no-undefined-version",
|
"-Wl,--no-undefined-version",
|
||||||
|
|
||||||
|
@@ -22,15 +22,11 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
linuxCflags = []string{
|
linuxCflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
|
|
||||||
"-fdiagnostics-color",
|
"-fdiagnostics-color",
|
||||||
|
|
||||||
"-Wa,--noexecstack",
|
"-Wa,--noexecstack",
|
||||||
|
|
||||||
"-fPIC",
|
"-fPIC",
|
||||||
"-no-canonical-prefixes",
|
|
||||||
|
|
||||||
"-U_FORTIFY_SOURCE",
|
"-U_FORTIFY_SOURCE",
|
||||||
"-D_FORTIFY_SOURCE=2",
|
"-D_FORTIFY_SOURCE=2",
|
||||||
@@ -40,11 +36,6 @@ var (
|
|||||||
//See bug 12708004.
|
//See bug 12708004.
|
||||||
"-D__STDC_FORMAT_MACROS",
|
"-D__STDC_FORMAT_MACROS",
|
||||||
"-D__STDC_CONSTANT_MACROS",
|
"-D__STDC_CONSTANT_MACROS",
|
||||||
|
|
||||||
// HOST_RELEASE_CFLAGS
|
|
||||||
"-O2", // from build/core/combo/select.mk
|
|
||||||
"-g", // from build/core/combo/select.mk
|
|
||||||
"-fno-strict-aliasing", // from build/core/combo/select.mk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
linuxLdflags = []string{
|
linuxLdflags = []string{
|
||||||
|
@@ -22,9 +22,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
windowsCflags = []string{
|
windowsCflags = []string{
|
||||||
"-fno-exceptions", // from build/core/combo/select.mk
|
|
||||||
"-Wno-multichar", // from build/core/combo/select.mk
|
|
||||||
|
|
||||||
"-DUSE_MINGW",
|
"-DUSE_MINGW",
|
||||||
"-DWIN32_LEAN_AND_MEAN",
|
"-DWIN32_LEAN_AND_MEAN",
|
||||||
"-Wno-unused-parameter",
|
"-Wno-unused-parameter",
|
||||||
@@ -43,11 +40,6 @@ var (
|
|||||||
"-D_FILE_OFFSET_BITS=64",
|
"-D_FILE_OFFSET_BITS=64",
|
||||||
|
|
||||||
"--sysroot ${WindowsGccRoot}/${WindowsGccTriple}",
|
"--sysroot ${WindowsGccRoot}/${WindowsGccTriple}",
|
||||||
|
|
||||||
// HOST_RELEASE_CFLAGS
|
|
||||||
"-O2", // from build/core/combo/select.mk
|
|
||||||
"-g", // from build/core/combo/select.mk
|
|
||||||
"-fno-strict-aliasing", // from build/core/combo/select.mk
|
|
||||||
}
|
}
|
||||||
|
|
||||||
windowsIncludeFlags = []string{
|
windowsIncludeFlags = []string{
|
||||||
|
@@ -196,7 +196,12 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||||||
func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
||||||
toolchain := ctx.toolchain()
|
toolchain := ctx.toolchain()
|
||||||
|
|
||||||
if !ctx.noDefaultCompilerFlags() {
|
hod := "Host"
|
||||||
|
if ctx.Os().Class == android.Device {
|
||||||
|
hod = "Device"
|
||||||
|
}
|
||||||
|
|
||||||
|
flags.LdFlags = append(flags.LdFlags, fmt.Sprintf("${config.%sGlobalLdflags}", hod))
|
||||||
if Bool(linker.Properties.Allow_undefined_symbols) {
|
if Bool(linker.Properties.Allow_undefined_symbols) {
|
||||||
if ctx.Darwin() {
|
if ctx.Darwin() {
|
||||||
// darwin defaults to treating undefined symbols as errors
|
// darwin defaults to treating undefined symbols as errors
|
||||||
@@ -230,7 +235,6 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)
|
CheckBadLinkerFlags(ctx, "ldflags", linker.Properties.Ldflags)
|
||||||
|
|
||||||
|
@@ -174,6 +174,7 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
|||||||
toolchain.Cppflags(),
|
toolchain.Cppflags(),
|
||||||
}, " "))
|
}, " "))
|
||||||
ctx.Strict(makePrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
|
ctx.Strict(makePrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
|
||||||
|
fmt.Sprintf("${config.%sGlobalLdflags}", hod),
|
||||||
toolchain.Ldflags(),
|
toolchain.Ldflags(),
|
||||||
toolchain.ToolchainLdflags(),
|
toolchain.ToolchainLdflags(),
|
||||||
productExtraLdflags,
|
productExtraLdflags,
|
||||||
@@ -219,6 +220,7 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
|
|||||||
toolchain.ClangCppflags(),
|
toolchain.ClangCppflags(),
|
||||||
}, " "))
|
}, " "))
|
||||||
ctx.Strict(clangPrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
|
ctx.Strict(clangPrefix+"GLOBAL_LDFLAGS", strings.Join([]string{
|
||||||
|
fmt.Sprintf("${config.%sGlobalLdflags}", hod),
|
||||||
toolchain.ClangLdflags(),
|
toolchain.ClangLdflags(),
|
||||||
toolchain.ToolchainClangLdflags(),
|
toolchain.ToolchainClangLdflags(),
|
||||||
productExtraLdflags,
|
productExtraLdflags,
|
||||||
|
@@ -53,7 +53,7 @@ func (object *objectLinker) linkerProps() []interface{} {
|
|||||||
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
|
func (*objectLinker) linkerInit(ctx BaseModuleContext) {}
|
||||||
|
|
||||||
func (object *objectLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
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.
|
// Needed for VNDK builds where bionic headers aren't automatically added.
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc")
|
deps.LateSharedLibs = append(deps.LateSharedLibs, "libc")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user