Skip to content

Commit

Permalink
Initialize arm_float_abi and arm_fpu from sabi.json.
Browse files Browse the repository at this point in the history
- The build/config/arm.gni is trying to guess the
 correct arm floating point ABI and sometimes get is wrong.
 We already have that specified in the sabi.json and we
 should just initialize it directly.

- Abstract out the sabi_variables reading in separate
 sabi.gni file.

b/235111527

Change-Id: Ic67a781e5e80c05e7f2f792f763bb5ac1c677cfa
  • Loading branch information
y4vor committed Jun 14, 2022
1 parent c7053ee commit e82be01
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
32 changes: 23 additions & 9 deletions build/config/arm.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

import("//build/config/v8_target_cpu.gni")

if (is_starboard) {
import("//starboard/sabi/sabi.gni")
}

# These are primarily relevant in current_cpu == "arm" contexts, where
# ARM code is being compiled. But they can also be relevant in the
# other contexts when the code will change its behavior based on the
Expand Down Expand Up @@ -38,14 +42,19 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
arm_use_thumb = true
}

if (current_os == "android" || target_os == "android") {
arm_float_abi = "softfp"
if (is_starboard) {
arm_float_abi = sabi_variables.floating_point_abi
arm_fpu = sabi_variables.floating_point_fpu
} else {
declare_args() {
# The ARM floating point mode. This is either the string "hard", "soft",
# or "softfp". An empty string means to use the default one for the
# arm_version.
arm_float_abi = ""
if (current_os == "android" || target_os == "android") {
arm_float_abi = "softfp"
} else {
declare_args() {
# The ARM floating point mode. This is either the string "hard", "soft",
# or "softfp". An empty string means to use the default one for the
# arm_version.
arm_float_abi = ""
}
}
}
assert(arm_float_abi == "" || arm_float_abi == "hard" ||
Expand Down Expand Up @@ -120,7 +129,12 @@ if (current_cpu == "arm" || v8_current_cpu == "arm") {
}
}
} else if (current_cpu == "arm64" || v8_current_cpu == "arm64") {
# arm64 supports only "hard".
arm_float_abi = "hard"
if (is_starboard) {
arm_float_abi = sabi_variables.floating_point_abi
arm_fpu = sabi_variables.floating_point_fpu
} else {
# arm64 supports only "hard".
arm_float_abi = "hard"
}
arm_use_neon = true
}
4 changes: 2 additions & 2 deletions starboard/build/config/sabi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//starboard/sabi/sabi.gni")

config("sabi") {
sabi_json = read_file(sabi_path, "json")
sabi_variables = sabi_json.variables
forward_variables_from(sabi_variables, "*")

arch_uppercase =
Expand Down
19 changes: 19 additions & 0 deletions starboard/sabi/sabi.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Read the ABI configuration from the SABI json file and make it available
# through a global variable.

sabi_json = read_file(sabi_path, "json")
sabi_variables = sabi_json.variables
3 changes: 1 addition & 2 deletions third_party/boringssl/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import("//starboard/sabi/sabi.gni")
import("//third_party/boringssl/buildfiles.gni")

declare_args() {
Expand Down Expand Up @@ -98,8 +99,6 @@ static_library("crypto") {
configs += [ "//starboard/build/config:speed" ]

if (sb_is_evergreen) {
sabi_json = read_file(sabi_path, "json")
sabi_variables = sabi_json.variables
calling_convention = sabi_variables.calling_convention
if ((calling_convention != "aarch64" && calling_convention != "eabi" &&
calling_convention != "sysv" && calling_convention != "windows") ||
Expand Down

0 comments on commit e82be01

Please sign in to comment.