Remove unnecessary flags from BUILD.gn

The GN build gets many default flags from //build/config. Remove flags that are redundant with the default flags. No intended behavior change (except for the hash style). Bug: chromium:1220175 Change-Id: Idcebc8f55165ae300632005f5cf527ec689a365f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55608Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNico Weber <thakis@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
parent 43d3e0cc
...@@ -22,32 +22,13 @@ config("swiftshader_config") { ...@@ -22,32 +22,13 @@ config("swiftshader_config") {
defines = [] defines = []
if (is_win) { if (is_win) {
cflags = [
"/GS", # Detects some buffer overruns
"/Zc:wchar_t",
"/EHs-c-", # Disable C++ exceptions
"/nologo",
"/Gd", # Default calling convention
# Disable MSVC warnings about std::aligned_storage being broken before VS 2017 15.8
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
]
if (!use_custom_libcxx) {
# Disable EH usage in STL headers.
# libc++ uses a predefined macro to control whether to use exceptions, so
# defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also
# breaks libc++ because it depends on MSVC headers that only provide
# certain declarations if _HAS_EXCEPTIONS is 1.
defines += [
"_HAS_EXCEPTIONS=0",
]
}
defines += [ defines += [
"_CRT_SECURE_NO_DEPRECATE",
"NOMINMAX",
"_WINDLL", "_WINDLL",
"NO_SANITIZE_FUNCTION=", "NO_SANITIZE_FUNCTION=",
# Disable MSVC warnings about std::aligned_storage being broken before
# VS 2017 15.8
"_ENABLE_EXTENDED_ALIGNED_STORAGE",
] ]
if (!is_debug) { if (!is_debug) {
...@@ -57,21 +38,20 @@ config("swiftshader_config") { ...@@ -57,21 +38,20 @@ config("swiftshader_config") {
# Diable some MSVC warnings. # Diable some MSVC warnings.
if (!is_clang) { if (!is_clang) {
cflags += [ cflags += [
"/wd4065", # switch statement contains 'default' but no 'case' labels "/wd4065", # switch statement contains 'default' but no 'case' labels
"/wd4309", # Truncation of constant value. See PixelRoutine.cpp casts of signed shorts. "/wd4309", # Truncation of constant value. See PixelRoutine.cpp casts
# of signed shorts.
] ]
} }
cflags_cc = [ "/std:c++17" ] cflags_cc = [ "/std:c++17" ]
} else { } else {
cflags = [ cflags = [ "-fno-operator-names" ]
"-fno-exceptions",
"-fno-operator-names",
]
cflags_cc = [ "-std=c++17" ] cflags_cc = [ "-std=c++17" ]
# On macOS for the ARM architecture, some C++17 features require version 10.14,
# while Chrome must support 10.11 (El Capitan). However, the first 'Apple Silicon' # On macOS for the ARM architecture, some C++17 features require version
# devices launched with macOS 11.0 (Big Sur). # 10.14, while Chrome must support 10.11 (El Capitan). However, the first
# 'Apple Silicon' devices launched with macOS 11.0 (Big Sur).
# TODO(b/174843857): Remove once Chrome demands macOS 10.14. # TODO(b/174843857): Remove once Chrome demands macOS 10.14.
if (is_mac && current_cpu == "arm64") { if (is_mac && current_cpu == "arm64") {
cflags += [ cflags += [
...@@ -81,30 +61,16 @@ config("swiftshader_config") { ...@@ -81,30 +61,16 @@ config("swiftshader_config") {
] ]
} }
defines += [ defines +=
"__STDC_CONSTANT_MACROS", [ "NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))" ]
"__STDC_LIMIT_MACROS",
"NO_SANITIZE_FUNCTION=__attribute__((no_sanitize(\"function\")))",
]
if (is_debug) { if (!is_debug) {
cflags += [
"-g",
"-g3",
]
} else { # Release
# All Release builds use function/data sections to make the shared libraries smaller
cflags += [ cflags += [
"-ffunction-sections",
"-fdata-sections",
"-fomit-frame-pointer", "-fomit-frame-pointer",
"-Os", "-Os",
] ]
defines += [ defines += [ "ANGLE_DISABLE_TRACE" ]
"ANGLE_DISABLE_TRACE",
"NDEBUG",
]
} }
if (current_cpu == "x64") { # 64 bit version if (current_cpu == "x64") { # 64 bit version
...@@ -131,13 +97,9 @@ config("swiftshader_config") { ...@@ -131,13 +97,9 @@ config("swiftshader_config") {
"-mxgot", "-mxgot",
] ]
if (mips_arch_variant == "r1") { if (mips_arch_variant == "r1") {
cflags += [ cflags += [ "-march=mips32" ]
"-march=mips32",
]
} else { } else {
cflags += [ cflags += [ "-march=mips32r2" ]
"-march=mips32r2",
]
} }
} else if (target_cpu == "mips64el" && current_cpu == target_cpu) { } else if (target_cpu == "mips64el" && current_cpu == target_cpu) {
cflags += [ cflags += [
...@@ -150,28 +112,14 @@ config("swiftshader_config") { ...@@ -150,28 +112,14 @@ config("swiftshader_config") {
} }
if (is_linux || is_chromeos) { if (is_linux || is_chromeos) {
ldflags = [ "-Wl,--gc-sections" ]
if (current_cpu == "mipsel") { if (current_cpu == "mipsel") {
ldflags += [
"-Wl,--hash-style=sysv",
]
if (mips_arch_variant == "r1") { if (mips_arch_variant == "r1") {
ldflags += [ ldflags += [ "-mips32" ]
"-mips32",
]
} else { } else {
ldflags += [ ldflags += [ "-mips32r2" ]
"-mips32r2",
]
} }
} else if (current_cpu == "mips64el") { } else if (current_cpu == "mips64el") {
ldflags += [ ldflags += [ "-mips64r2" ]
"-Wl,--hash-style=sysv",
"-mips64r2",
]
} else {
ldflags += [ "-Wl,--hash-style=both" ]
} }
# A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532) # A bug in the gold linker prevents using ICF on 32-bit (crbug.com/729532)
...@@ -183,9 +131,7 @@ config("swiftshader_config") { ...@@ -183,9 +131,7 @@ config("swiftshader_config") {
} }
source_set("vertex_routine_fuzzer") { source_set("vertex_routine_fuzzer") {
sources = [ sources = [ "tests/fuzzers/VertexRoutineFuzzer.cpp" ]
"tests/fuzzers/VertexRoutineFuzzer.cpp"
]
if (is_win) { if (is_win) {
cflags = [ cflags = [
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
...@@ -193,36 +139,34 @@ source_set("vertex_routine_fuzzer") { ...@@ -193,36 +139,34 @@ source_set("vertex_routine_fuzzer") {
"/wd5030", # attribute is not recognized "/wd5030", # attribute is not recognized
] ]
} }
include_dirs = [ include_dirs = [ "src/" ]
"src/", deps = [ "src/OpenGL/libGLESv2:swiftshader_libGLESv2_static" ]
]
deps = [
"src/OpenGL/libGLESv2:swiftshader_libGLESv2_static",
]
} }
group("swiftshader") { group("swiftshader") {
data_deps = [ data_deps = [
"src/OpenGL/libGLESv2:swiftshader_libGLESv2",
"src/OpenGL/libEGL:swiftshader_libEGL", "src/OpenGL/libEGL:swiftshader_libEGL",
"src/OpenGL/libGLESv2:swiftshader_libGLESv2",
] ]
} }
if (build_with_chromium) { if (build_with_chromium) {
group("swiftshader_tests") { group("swiftshader_tests") {
testonly = true testonly = true
data_deps = [ data_deps = [
"tests/GLESUnitTests:swiftshader_unittests", "tests/GLESUnitTests:swiftshader_unittests",
"tests/SystemUnitTests:swiftshader_system_unittests", "tests/SystemUnitTests:swiftshader_system_unittests",
] ]
if (supports_llvm) { if (supports_llvm) {
data_deps += [ "tests/ReactorUnitTests:swiftshader_reactor_llvm_unittests" ] data_deps +=
} [ "tests/ReactorUnitTests:swiftshader_reactor_llvm_unittests" ]
}
if (supports_subzero) { if (supports_subzero) {
data_deps += [ "tests/ReactorUnitTests:swiftshader_reactor_subzero_unittests" ] data_deps +=
} [ "tests/ReactorUnitTests:swiftshader_reactor_subzero_unittests" ]
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment