From 93ba371b6648aff9aecded5b8e40ee26e3b2974d Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 21 Aug 2018 11:00:34 -0400 Subject: [PATCH] Bug 1480558 - part 4 - add icudata support for aarch64 windows; r=mshal yasm doesn't support aarch64, and trying to use GNU as with an MSVC build seems like sadness waiting to happen. Instead, we'll generate our own assembly file that armasm64 will accept. --- build/autoconf/icu.m4 | 13 ++++++++++--- config/external/icu/data/genicudata.py | 14 ++++++++++++++ config/external/icu/data/moz.build | 17 ++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 config/external/icu/data/genicudata.py diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4 index 5c606127211c..32fc84f30dd9 100644 --- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -91,9 +91,16 @@ if test -n "$USE_ICU"; then AC_DEFINE(U_USING_ICU_NAMESPACE,0) if test -z "$MOZ_SYSTEM_ICU"; then - if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then - AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api]) - fi + case "$OS_TARGET:$CPU_ARCH" in + WINNT:aarch64) + dnl we use non-yasm, non-GNU as solutions here. + ;; + *) + if test -z "$YASM" -a -z "$GNU_AS" -a "$COMPILE_ENVIRONMENT"; then + AC_MSG_ERROR([Building ICU requires either yasm or a GNU assembler. If you do not have either of those available for this platform you must use --without-intl-api]) + fi + ;; + esac dnl We build ICU as a static library. AC_DEFINE(U_STATIC_IMPLEMENTATION) fi diff --git a/config/external/icu/data/genicudata.py b/config/external/icu/data/genicudata.py new file mode 100644 index 000000000000..043dc8cd42d5 --- /dev/null +++ b/config/external/icu/data/genicudata.py @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +def main(output, data_file, data_symbol): + output.write(''' AREA .rdata,ALIGN=4,DATA,READONLY + EXPORT _{data_symbol}[DATA] +_{data_symbol} + INCBIN {data_file} + END +'''.format(data_file=data_file, data_symbol=data_symbol)) diff --git a/config/external/icu/data/moz.build b/config/external/icu/data/moz.build index 8eeb8741c814..bb7922c9fe8e 100644 --- a/config/external/icu/data/moz.build +++ b/config/external/icu/data/moz.build @@ -14,14 +14,25 @@ if CONFIG['OS_ARCH'] == 'WINNT': elif CONFIG['OS_ARCH'] == 'Darwin': ASFLAGS += ['-DPREFIX'] -ASFLAGS += [ +data_symbol = 'icudt%s_dat' % CONFIG['MOZ_ICU_VERSION'] +asflags = [ '-DICU_DATA_FILE="%s"' % CONFIG['ICU_DATA_FILE'], - '-DICU_DATA_SYMBOL=icudt%s_dat' % CONFIG['MOZ_ICU_VERSION'], + '-DICU_DATA_SYMBOL=%s' % data_symbol, ] LOCAL_INCLUDES += ['.'] -if CONFIG['HAVE_YASM']: +if CONFIG['OS_TARGET'] == 'WINNT' and CONFIG['CPU_ARCH'] == 'aarch64': + icudata = 'icudata.asm' + GENERATED_FILES += [icudata] + SOURCES += ['!%s' % icudata] + icudata = GENERATED_FILES[icudata] + icudata.script = 'genicudata.py' + icudata.inputs = [CONFIG['ICU_DATA_FILE']] + icudata.flags = [data_symbol] +elif CONFIG['HAVE_YASM']: USE_YASM = True SOURCES += ['icudata.s'] + ASFLAGS += asflags elif CONFIG['GNU_AS']: SOURCES += ['icudata_gas.S'] + ASFLAGS += asflags