From 133dbe7bb0879a01af45895fb42e8bf58cf8e0f8 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 2 Nov 2017 22:55:19 -0700 Subject: Consolidate cflags that are set on all devices Move cflags that are set on all devices to deviceGlobalCflags: -fno-canonical-system-headers -ffunction-sections -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=format-security Bug: 68855788 Test: m checkbuild Change-Id: Iefec689fdd2749013d0cc003b3abec674a85fb74 --- cc/config/arm64_device.go | 8 -------- cc/config/arm_device.go | 8 -------- cc/config/global.go | 11 ++++++++++- cc/config/mips64_device.go | 8 -------- cc/config/mips_device.go | 8 -------- cc/config/x86_64_device.go | 8 -------- cc/config/x86_device.go | 8 -------- 7 files changed, 10 insertions(+), 49 deletions(-) (limited to 'cc/config') diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index e8b47975..bdcbd05e 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -23,15 +23,8 @@ import ( var ( arm64Cflags = []string{ - "-fstack-protector-strong", - "-ffunction-sections", "-fdata-sections", - "-funwind-tables", - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", "-fno-short-enums", - "-fno-canonical-system-headers", // Help catch common 32/64-bit errors. "-Werror=implicit-function-declaration", @@ -39,7 +32,6 @@ var ( "-fno-strict-volatile-bitfields", // TARGET_RELEASE_CFLAGS - "-Wstrict-aliasing=2", "-fgcse-after-reload", "-frerun-cse-after-loop", "-frename-registers", diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go index 8e890ff4..3411e074 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -28,21 +28,13 @@ var ( } armCflags = []string{ - "-ffunction-sections", "-fdata-sections", - "-funwind-tables", - "-fstack-protector-strong", - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", "-fno-short-enums", - "-fno-canonical-system-headers", "-fno-builtin-sin", "-fno-strict-volatile-bitfields", // TARGET_RELEASE_CFLAGS - "-Wstrict-aliasing=2", "-fgcse-after-reload", "-frerun-cse-after-loop", "-frename-registers", diff --git a/cc/config/global.go b/cc/config/global.go index 5587eae8..4a2f6065 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -54,12 +54,21 @@ var ( deviceGlobalCflags = []string{ "-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=non-virtual-dtor", "-Werror=address", "-Werror=sequence-point", "-Werror=date-time", + "-Werror=format-security", } hostGlobalCflags = []string{} diff --git a/cc/config/mips64_device.go b/cc/config/mips64_device.go index 7da693f3..9dd11652 100644 --- a/cc/config/mips64_device.go +++ b/cc/config/mips64_device.go @@ -25,20 +25,12 @@ var ( "-fomit-frame-pointer", "-funswitch-loops", "-Umips", - "-ffunction-sections", "-fdata-sections", - "-funwind-tables", - "-fstack-protector-strong", - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", - "-fno-canonical-system-headers", // Help catch common 32/64-bit errors. "-Werror=implicit-function-declaration", // TARGET_RELEASE_CFLAGS - "-Wstrict-aliasing=2", "-fgcse-after-reload", "-frerun-cse-after-loop", "-frename-registers", diff --git a/cc/config/mips_device.go b/cc/config/mips_device.go index f8470bf6..840702ac 100644 --- a/cc/config/mips_device.go +++ b/cc/config/mips_device.go @@ -25,17 +25,9 @@ var ( "-fomit-frame-pointer", "-funswitch-loops", "-Umips", - "-ffunction-sections", "-fdata-sections", - "-funwind-tables", - "-fstack-protector-strong", - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", - "-fno-canonical-system-headers", // TARGET_RELEASE_CFLAGS - "-Wstrict-aliasing=2", "-fgcse-after-reload", "-frerun-cse-after-loop", "-frename-registers", diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go index 8d7a404f..eeb4d2f0 100644 --- a/cc/config/x86_64_device.go +++ b/cc/config/x86_64_device.go @@ -22,18 +22,10 @@ import ( var ( x86_64Cflags = []string{ - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", - "-Wstrict-aliasing=2", - "-ffunction-sections", "-finline-functions", "-finline-limit=300", "-fno-short-enums", "-funswitch-loops", - "-funwind-tables", - "-fstack-protector-strong", - "-fno-canonical-system-headers", // Help catch common 32/64-bit errors. "-Werror=implicit-function-declaration", diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go index 59f8de73..be36de97 100644 --- a/cc/config/x86_device.go +++ b/cc/config/x86_device.go @@ -22,18 +22,10 @@ import ( var ( x86Cflags = []string{ - "-Wa,--noexecstack", - "-Werror=format-security", - "-D_FORTIFY_SOURCE=2", - "-Wstrict-aliasing=2", - "-ffunction-sections", "-finline-functions", "-finline-limit=300", "-fno-short-enums", "-funswitch-loops", - "-funwind-tables", - "-fstack-protector-strong", - "-fno-canonical-system-headers", } x86ClangCflags = append(x86Cflags, []string{ -- cgit v1.2.3