Bug 1791482 - Use ARM neon flags more consistently. r=firefox-build-system-reviewers,andi

In one place, we specifically check for softfp and do the right thing,
while in another we omit doing it, while at the same time we already
have a check in arm.configure that gives us (mostly) the flags we want.

Differential Revision: https://phabricator.services.mozilla.com/D157687
This commit is contained in:
Mike Hommey 2022-09-20 09:12:31 +00:00
Родитель 45afb05550
Коммит db68ae8577
2 изменённых файлов: 14 добавлений и 33 удалений

Просмотреть файл

@ -273,8 +273,8 @@ add_old_configure_assignment("ARM_ARCH", depends(arm_target.arm_arch)(lambda x:
set_config("MOZ_FPU", arm_target.fpu)
@depends(arm_target.float_abi)
def neon_flags(float_abi):
@depends(arm_target)
def neon_flags(arm_target):
# Building with -mfpu=neon requires either the "softfp" or the
# "hardfp" ABI. Depending on the compiler's default target, and the
# CFLAGS, the default ABI might be neither, in which case it is the
@ -284,8 +284,12 @@ def neon_flags(float_abi):
# that compiling uses the "softfloat" ABI, force the use of the
# "softfp" ABI instead.
flags = ["-mfpu=neon"]
if float_abi == "soft":
if arm_target.float_abi == "soft":
flags.append("-mfloat-abi=softfp")
if arm_target.arm_arch < 7:
# clang needs to be forced to at least armv7 for -mfpu=neon to do
# something.
flags.append("-march=armv7-a")
return tuple(flags)

Просмотреть файл

@ -1907,37 +1907,14 @@ with only_when(compile_environment):
return namespace(version="2.03", what="VPX")
return namespace(what="VPX")
# Building with -mfpu=neon requires either the "softfp" or the
# "hardfp" ABI. Depending on the compiler's default target, and the
# CFLAGS, the default ABI might be neither, in which case it is the
# "softfloat" ABI.
# The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
# we can safely mix code built with both ABIs. So, if we detect
# that compiling uses the "softfloat" ABI, force the use of the
# "softfp" ABI instead.
# Confusingly, the __SOFTFP__ preprocessor variable indicates the
# "softfloat" ABI, not the "softfp" ABI.
# Note: VPX_ASFLAGS is also used in CFLAGS.
softfp = cxx_compiler.try_compile(
body="""
#ifndef __SOFTFP__
#error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
#endif""",
when=in_tree_vpx.arm_asm,
)
@depends(in_tree_vpx, vpx_nasm, softfp, target)
def vpx_as_flags(vpx, vpx_nasm, softfp, target):
flags = []
@depends(in_tree_vpx, vpx_nasm, target, neon_flags)
def vpx_as_flags(vpx, vpx_nasm, target, neon_flags):
if vpx and vpx.arm_asm:
# These flags are a lie; they're just used to enable the requisite
# opcodes; actual arch detection is done at runtime.
flags = ["-march=armv7-a", "-mfpu=neon"]
if softfp:
flags.append("-mfloat-abi=softfp")
return neon_flags
elif vpx and vpx_nasm and target.os != "WINNT" and target.cpu != "x86_64":
flags = ["-DPIC"]
return flags
return ("-DPIC",)
set_config("VPX_USE_NASM", True, when=vpx_nasm)
set_config("VPX_ASFLAGS", vpx_as_flags)
@ -2014,13 +1991,13 @@ with only_when(compile_environment):
set_config("MOZ_JPEG_CFLAGS", jpeg_flags.cflags)
set_config("MOZ_JPEG_LIBS", jpeg_flags.ldflags)
@depends("--with-system-jpeg", target)
def in_tree_jpeg_arm(system_jpeg, target):
@depends("--with-system-jpeg", target, neon_flags)
def in_tree_jpeg_arm(system_jpeg, target, neon_flags):
if system_jpeg:
return
if target.cpu == "arm":
return ("-march=armv7-a", "-mfpu=neon")
return neon_flags
elif target.cpu == "aarch64":
return ("-march=armv8-a",)