Commit 8e8785dd authored by thakis's avatar thakis Committed by Commit bot

gn: Don't build sse3 code in skia with -msse4.1.

Else the compiler can create SSE4.1 instructions for the SSE3 files, but we
only check for SSE3 when running that code.  So the code might crash with
"unknown instruction" when running on a processor that has SSE3 but not SSE4.

This matches what the gyp build does.

Depends on https://codereview.chromium.org/1161853008/

BUG=496512

Review URL: https://codereview.chromium.org/1160253011

Cr-Commit-Position: refs/heads/master@{#333171}
parent f20ff3d3
...@@ -557,21 +557,54 @@ component("skia") { ...@@ -557,21 +557,54 @@ component("skia") {
} }
# Separated out so it can be compiled with different flags for SSE. # Separated out so it can be compiled with different flags for SSE.
# TODO(GYP): This is wrong, it needs one target per arch http://crbug.com/496512 if (current_cpu == "x86" || current_cpu == "x64") {
source_set("skia_opts_sse3") {
sources = gypi_skia_opts.ssse3_sources
if (!is_win || is_clang) {
cflags = [ "-mssse3" ]
}
if (is_win) {
defines = [ "SK_CPU_SSE_LEVEL=31" ]
}
visibility = [ ":skia_opts" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":skia_config",
":skia_library_config",
"//build/config/compiler:no_chromium_code",
]
}
source_set("skia_opts_sse4") {
sources = gypi_skia_opts.sse41_sources
if (!is_win || is_clang) {
cflags = [ "-msse4.1" ]
}
if (is_win) {
defines = [ "SK_CPU_SSE_LEVEL=41" ]
}
visibility = [ ":skia_opts" ]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":skia_config",
":skia_library_config",
"//build/config/compiler:no_chromium_code",
]
}
}
source_set("skia_opts") { source_set("skia_opts") {
cflags = [] cflags = []
defines = [] defines = []
if (current_cpu == "x86" || current_cpu == "x64") { deps = [
sources = gypi_skia_opts.sse2_sources + gypi_skia_opts.ssse3_sources + "//base",
gypi_skia_opts.sse41_sources ]
if (!is_win || is_clang) { if (current_cpu == "x86" || current_cpu == "x64") {
cflags += [ "-msse4.1" ] sources = gypi_skia_opts.sse2_sources
} deps += [
if (is_win) { ":skia_opts_sse3",
defines += [ "SK_CPU_SSE_LEVEL=41" ] ":skia_opts_sse4",
} ]
} else if (current_cpu == "arm") { } else if (current_cpu == "arm") {
# The assembly uses the frame pointer register (r7 in Thumb/r11 in # The assembly uses the frame pointer register (r7 in Thumb/r11 in
# ARM), the compiler doesn't like that. # ARM), the compiler doesn't like that.
...@@ -616,10 +649,6 @@ source_set("skia_opts") { ...@@ -616,10 +649,6 @@ source_set("skia_opts") {
"//build/config/compiler:no_chromium_code", "//build/config/compiler:no_chromium_code",
] ]
deps = [
"//base",
]
visibility = [ ":skia" ] visibility = [ ":skia" ]
} }
......
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