Commit 8f9c9ce7 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Use generic implementation of libvpx in "catalyst" environment

The linker fails if any object file does not define LC_BUILD_VERSION
when linking a binary for "catalyst" environment. As nasm does not
create such a section, the build fail if using optimised version of
libvpx.

As a workaround, use generic implementation instead of the optimized
one in that configuration (since it is still experimental anyway).

Bug: 1145197, 1138425
Change-Id: I6bf02c499d8e35dcc0fe34f5bb53df230a8449cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517955
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarJames Zern <jzern@google.com>
Cr-Commit-Position: refs/heads/master@{#824389}
parent 01f3d7bb
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
declare_args() {
# Configure the environment for which to build. Could be either "device",
# "simulator" or "catalyst". If unspecified, then it will be assumed to be
# "simulator" if the target_cpu is "x68" or "x64", "device" otherwise. The
# default is only there for compatibility reasons and will be removed (see
# crbug.com/1138425 for more details).
target_environment = ""
}
if (target_environment == "") {
if (current_cpu == "x86" || current_cpu == "x64") {
target_environment = "simulator"
} else {
target_environment = "device"
}
}
assert(target_environment == "simulator" || target_environment == "device" ||
target_environment == "catalyst")
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/ios/config.gni")
import("//build/config/ios/ios_sdk_overrides.gni") import("//build/config/ios/ios_sdk_overrides.gni")
import("//build/toolchain/goma.gni") import("//build/toolchain/goma.gni")
import("//build/toolchain/toolchain.gni") import("//build/toolchain/toolchain.gni")
...@@ -60,13 +61,6 @@ declare_args() { ...@@ -60,13 +61,6 @@ declare_args() {
# TODO(crbug.com/1015730): remove this flag because ios_use_goma_rbe covers. # TODO(crbug.com/1015730): remove this flag because ios_use_goma_rbe covers.
ios_enable_relative_sdk_path = ios_use_goma_rbe ios_enable_relative_sdk_path = ios_use_goma_rbe
# Configure the environment for which to build. Could be either "device",
# "simulator" or "catalyst". If unspecified, then it will be assumed to be
# "simulator" if the target_cpu if "x68" or "x64", "device" otherwise. The
# default is only there for compatibility reason and will be removed (see
# crbug.com/1138425 for more details).
target_environment = ""
} }
declare_args() { declare_args() {
...@@ -79,17 +73,6 @@ declare_args() { ...@@ -79,17 +73,6 @@ declare_args() {
primary_fat_toolchain_name = "" primary_fat_toolchain_name = ""
} }
if (target_environment == "") {
if (current_cpu == "x86" || current_cpu == "x64") {
target_environment = "simulator"
} else {
target_environment = "device"
}
}
assert(target_environment == "simulator" || target_environment == "device" ||
target_environment == "catalyst")
# Official builds may not use goma. # Official builds may not use goma.
assert(!(use_goma && is_chrome_branded && is_official_build && assert(!(use_goma && is_chrome_branded && is_official_build &&
target_cpu == "arm64"), target_cpu == "arm64"),
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/arm.gni") import("//build/config/arm.gni")
import("//build/config/chromeos/ui_mode.gni") import("//build/config/chromeos/ui_mode.gni")
import("//build/config/ios/config.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//third_party/libvpx/libvpx_srcs.gni") import("//third_party/libvpx/libvpx_srcs.gni")
import("//third_party/nasm/nasm_assemble.gni") import("//third_party/nasm/nasm_assemble.gni")
...@@ -311,7 +312,15 @@ static_library("libvpx") { ...@@ -311,7 +312,15 @@ static_library("libvpx") {
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
if (is_nacl) { # As "nasm" does not embed the required LC_BUILD_VERSION section in object
# files, it is not possible to build optimised version of the code if the
# target is iOS under "catalyst" environment. This version is not shipped,
# so there is no concern about performance.
# TODO(crbug.com/1145197): Remove this exception once "nasm" has support
# for embedding the correct LD_BUILD_VERSION section.
_force_generic_srcs = is_ios && target_environment == "catalyst"
if (is_nacl || _force_generic_srcs) {
sources = libvpx_srcs_generic sources = libvpx_srcs_generic
} else if (current_cpu == "x86") { } else if (current_cpu == "x86") {
sources = libvpx_srcs_x86 sources = libvpx_srcs_x86
...@@ -345,6 +354,7 @@ static_library("libvpx") { ...@@ -345,6 +354,7 @@ static_library("libvpx") {
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":libvpx_config" ] configs += [ ":libvpx_config" ]
deps = [] deps = []
if (!_force_generic_srcs) {
if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) { if (current_cpu == "x86" || (current_cpu == "x64" && !is_msan)) {
deps += [ deps += [
":libvpx_asm", ":libvpx_asm",
...@@ -357,6 +367,7 @@ static_library("libvpx") { ...@@ -357,6 +367,7 @@ static_library("libvpx") {
":libvpx_intrinsics_ssse3", ":libvpx_intrinsics_ssse3",
] ]
} }
}
if (cpu_arch_full == "arm-neon-cpu-detect") { if (cpu_arch_full == "arm-neon-cpu-detect") {
deps += [ ":libvpx_intrinsics_neon" ] deps += [ ":libvpx_intrinsics_neon" ]
} }
......
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