diff --git a/config/config.mk b/config/config.mk index b3760d2f13e..832482fd0fc 100644 --- a/config/config.mk +++ b/config/config.mk @@ -186,7 +186,14 @@ ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS)) _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) endif +ifeq ($(YASM),$(AS)) +# yasm doesn't like the GNU as flags we may already have in ASFLAGS, so reset. +ASFLAGS := $(_DEBUG_ASFLAGS) +# yasm doesn't like -c +AS_DASH_C_FLAG= +else ASFLAGS += $(_DEBUG_ASFLAGS) +endif OS_CFLAGS += $(_DEBUG_CFLAGS) OS_CXXFLAGS += $(_DEBUG_CFLAGS) OS_LDFLAGS += $(_DEBUG_LDFLAGS) @@ -428,7 +435,7 @@ COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO COMPILE_CXXFLAGS = $(if $(DISABLE_STL_WRAPPING),,$(STL_FLAGS)) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(OS_INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(RTL_FLAGS) $(OS_CPPFLAGS) $(OS_COMPILE_CXXFLAGS) $(CXXFLAGS) $(MOZBUILD_CXXFLAGS) $(EXTRA_COMPILE_FLAGS) COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS) $(EXTRA_COMPILE_FLAGS) COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS) $(EXTRA_COMPILE_FLAGS) -ASFLAGS += $(EXTRA_ASSEMBLER_FLAGS) +ASFLAGS += $(MOZBUILD_ASFLAGS) $(EXTRA_ASSEMBLER_FLAGS) ifndef CROSS_COMPILE HOST_CFLAGS += $(RTL_FLAGS) diff --git a/configure.in b/configure.in index b07055da6b5..aa2ed6bf86f 100644 --- a/configure.in +++ b/configure.in @@ -3866,7 +3866,6 @@ MOZ_VPX_ERROR_CONCEALMENT= MOZ_WEBSPEECH=1 VPX_AS= VPX_ASFLAGS= -VPX_AS_DASH_C_FLAG= VPX_AS_CONVERSION= VPX_ASM_SUFFIX= VPX_X86_ASM= @@ -5484,7 +5483,6 @@ if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then dnl These flags are a lie; they're just used to enable the requisite dnl opcodes; actual arch detection is done at runtime. VPX_ASFLAGS="-march=armv7-a -mfpu=neon" - VPX_DASH_C_FLAG="-c" VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl' VPX_ASM_SUFFIX="$ASM_SUFFIX" VPX_ARM_ASM=1 @@ -8864,8 +8862,7 @@ AC_SUBST(MOZ_OMX_PLUGIN) AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT) AC_SUBST(MOZ_VPX) AC_SUBST(VPX_AS) -AC_SUBST(VPX_ASFLAGS) -AC_SUBST(VPX_DASH_C_FLAG) +AC_SUBST_LIST(VPX_ASFLAGS) AC_SUBST(VPX_AS_CONVERSION) AC_SUBST(VPX_ASM_SUFFIX) AC_SUBST(VPX_X86_ASM) @@ -8874,7 +8871,7 @@ AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT) AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP) AC_SUBST(MOZ_CODE_COVERAGE) AC_SUBST(LIBJPEG_TURBO_AS) -AC_SUBST(LIBJPEG_TURBO_ASFLAGS) +AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS) AC_SUBST(LIBJPEG_TURBO_X86_ASM) AC_SUBST(LIBJPEG_TURBO_X64_ASM) AC_SUBST(LIBJPEG_TURBO_ARM_ASM) diff --git a/media/libjpeg/Makefile.in b/media/libjpeg/Makefile.in index f746487512a..fb8451efc41 100644 --- a/media/libjpeg/Makefile.in +++ b/media/libjpeg/Makefile.in @@ -5,12 +5,6 @@ AS=$(LIBJPEG_TURBO_AS) ASM_SUFFIX=asm -ASFLAGS=$(LIBJPEG_TURBO_ASFLAGS) -I$(topsrcdir)/media/libjpeg/simd/ - -ifeq ($(AS),yasm) - # yasm doesn't like -c - AS_DASH_C_FLAG= -endif include $(topsrcdir)/config/rules.mk diff --git a/media/libjpeg/moz.build b/media/libjpeg/moz.build index d787297af18..96d27c66ba2 100644 --- a/media/libjpeg/moz.build +++ b/media/libjpeg/moz.build @@ -150,6 +150,9 @@ else: # No SIMD support? 'jsimd_none.c', ] +ASFLAGS += CONFIG['LIBJPEG_TURBO_ASFLAGS'] +ASFLAGS += ['-I%s/media/libjpeg/simd/' % TOPSRCDIR] + if CONFIG['GKMEDIAS_SHARED_LIBRARY']: NO_VISIBILITY_FLAGS = True diff --git a/media/libopus/Makefile.in b/media/libopus/Makefile.in index 8f3be966d08..f3b86990f54 100644 --- a/media/libopus/Makefile.in +++ b/media/libopus/Makefile.in @@ -7,10 +7,6 @@ include $(topsrcdir)/config/rules.mk ifdef GNU_AS ifeq ($(CPU_ARCH),arm) -# These flags are a lie; they're just used to enable the requisite -# opcodes; actual arch detection is done at runtime. -ASFLAGS = -march=armv7-a -mfpu=neon - celt_pitch_xcorr_arm-gnu.$(ASM_SUFFIX): celt/arm/armopts-gnu.S # armopts needs a specific rule, because arm2gnu.pl will always add the .S diff --git a/media/libopus/moz.build b/media/libopus/moz.build index 90cfed53394..c5036463d7f 100644 --- a/media/libopus/moz.build +++ b/media/libopus/moz.build @@ -94,12 +94,18 @@ if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']: ]] # -Os is significantly slower, enable -O3 unless optimization is disabled if CONFIG['MOZ_OPTIMIZE']: - CFLAGS += [ - '-O3', - ] - CXXFLAGS += [ - '-O3', - ] + CFLAGS += [ + '-O3', + ] + CXXFLAGS += [ + '-O3', + ] + # These flags are a lie; they're just used to enable the requisite + # opcodes; actual arch detection is done at runtime. + ASFLAGS += [ + '-march=armv7-a', + '-mfpu=neon', + ] # Suppress warnings in third-party code. if CONFIG['GNU_CC']: diff --git a/media/libtheora/Makefile.in b/media/libtheora/Makefile.in index a41846f7367..623f85f297c 100644 --- a/media/libtheora/Makefile.in +++ b/media/libtheora/Makefile.in @@ -6,10 +6,6 @@ ifdef GNU_AS ifeq ($(CPU_ARCH),arm) -# These flags are a lie; they're just used to enable the requisite -# opcodes; actual arch detection is done at runtime. -ASFLAGS = -march=armv7-a -mfpu=neon - armfrag-gnu.$(ASM_SUFFIX): armopts-gnu.S armidct-gnu.$(ASM_SUFFIX): armopts-gnu.S armloop-gnu.$(ASM_SUFFIX): armopts-gnu.S diff --git a/media/libtheora/moz.build b/media/libtheora/moz.build index 30ac65f1756..cd018cadbc9 100644 --- a/media/libtheora/moz.build +++ b/media/libtheora/moz.build @@ -45,14 +45,6 @@ UNIFIED_SOURCES += [ LOCAL_INCLUDES += ['include'] -if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']: - GENERATED_SOURCES += [ '%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [ - 'armbits-gnu', - 'armfrag-gnu', - 'armidct-gnu', - 'armloop-gnu', - ]] - if '86' in CONFIG['OS_TEST']: if CONFIG['OS_ARCH'] != 'SunOS': if CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['OS_TEST'] != 'x86_64': @@ -94,3 +86,16 @@ if CONFIG['GNU_AS']: if CONFIG['OS_TARGET'] == 'Android': DEFINES['__linux__'] = True + GENERATED_SOURCES += [ '%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [ + 'armbits-gnu', + 'armfrag-gnu', + 'armidct-gnu', + 'armloop-gnu', + ]] + + # These flags are a lie; they're just used to enable the requisite + # opcodes; actual arch detection is done at runtime. + ASFLAGS += [ + '-march=armv7-a', + '-mfpu=neon', + ] diff --git a/media/libvpx/Makefile.in b/media/libvpx/Makefile.in index 1c477ab15c0..7dbece05119 100644 --- a/media/libvpx/Makefile.in +++ b/media/libvpx/Makefile.in @@ -5,15 +5,8 @@ # Set up the libvpx assembler config. AS=$(VPX_AS) -ASFLAGS=$(VPX_ASFLAGS) -I. -I$(topsrcdir)/media/libvpx/ -I$(topsrcdir)/media/libvpx/vpx_ports/ -AS_DASH_C_FLAG=$(VPX_DASH_C_FLAG) ASM_SUFFIX=$(VPX_ASM_SUFFIX) -ifeq ($(OS_TARGET),Android) - # For LIBVPX_RAND - ASFLAGS += -D__ANDROID__ -endif - ifdef VPX_ARM_ASM # Building on an ARM platform with a supported assembler, include # the optimized assembly in the build. diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build index a2f3aaed42d..18d5a4675ff 100644 --- a/media/libvpx/moz.build +++ b/media/libvpx/moz.build @@ -105,3 +105,16 @@ if CONFIG['CLANG_CL'] or not CONFIG['_MSC_VER']: # Suppress warnings in third-party code. if CONFIG['GNU_CC']: CFLAGS += ['-Wno-sign-compare'] + +ASFLAGS += CONFIG['VPX_ASFLAGS'] +ASFLAGS += [ + '-I.', + '-I%s/media/libvpx/' % TOPSRCDIR, + '-I%s/media/libvpx/vpx_ports/' % TOPSRCDIR, +] + +if CONFIG['OS_TARGET'] == 'Android': + # For LIBVPX_RAND + ASFLAGS += [ + '-D__ANDROID__' + ] diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index a4f5fb0451c..16907cdbcac 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -73,6 +73,7 @@ from ..makeutil import Makefile MOZBUILD_VARIABLES = [ 'ANDROID_GENERATED_RESFILES', 'ANDROID_RES_DIRS', + 'ASFLAGS', 'CMSRCS', 'CMMSRCS', 'CPP_UNIT_TESTS', diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 7495ec9326c..ca9e8d5f8b8 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -1362,6 +1362,15 @@ VARIABLES = { appear in the moz.build file. """, None), + 'ASFLAGS': (List, list, + """Flags passed to the assembler for all of the assembly source files + declared in this directory. + + Note that the ordering of flags matters here; these flags will be + added to the assembler's command line in the same order as they + appear in the moz.build file. + """, None), + 'LDFLAGS': (List, list, """Flags passed to the linker when linking all of the libraries and executables declared in this directory. diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 75c1c824e49..5f5ab9dac82 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -582,7 +582,8 @@ class TreeMetadataEmitter(LoggingMixin): for dll in context['DELAYLOAD_DLLS']]) context['OS_LIBS'].append('delayimp') - for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'LDFLAGS']: + for v in ['CFLAGS', 'CXXFLAGS', 'CMFLAGS', 'CMMFLAGS', 'ASFLAGS', + 'LDFLAGS']: if v in context and context[v]: passthru.variables['MOZBUILD_' + v] = context[v] diff --git a/xpcom/reflect/xptcall/md/unix/Makefile.in b/xpcom/reflect/xptcall/md/unix/Makefile.in index 80dc57011c4..e4cdc389bbc 100644 --- a/xpcom/reflect/xptcall/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/md/unix/Makefile.in @@ -31,16 +31,6 @@ endif endif -###################################################################### -# M68k -###################################################################### - -ifeq ($(OS_ARCH),Linux) -ifneq (,$(findstring mips, $(OS_TEST))) -ASFLAGS += -I$(DIST)/include -endif -endif - ###################################################################### # PowerPC ###################################################################### @@ -52,20 +42,6 @@ ifeq ($(OS_ARCH),AIX) CXXFLAGS := $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS)) endif -###################################################################### -# SPARC -###################################################################### -# -# Solaris/SPARC -# -ifeq ($(OS_ARCH),SunOS) -ifneq (86,$(findstring 86,$(OS_TEST))) -ifdef HAVE_64BIT_BUILD -ASFLAGS += -xarch=v9 -endif -endif -endif - include $(topsrcdir)/config/rules.mk ifeq ($(OS_ARCH),Linux) @@ -98,10 +74,6 @@ xptcstubsdef_asm.solx86: $(DIST)/include/xptcstubsdef.inc -e 's/^\(STUB_ENTRY\)(\([0-9][0-9]\))/\12\(\2\)/' \ -e 's/^\(STUB_ENTRY\)(\([0-9][0-9][0-9]\))/\13\(\2\)/' \ $(DIST)/include/xptcstubsdef.inc > $@ -ifeq (x86_64,$(OS_TEST)) -ASFLAGS += -xarch=amd64 -endif - endif endif endif diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build index e6f410ff42a..4f70e14a2fe 100644 --- a/xpcom/reflect/xptcall/md/unix/moz.build +++ b/xpcom/reflect/xptcall/md/unix/moz.build @@ -59,6 +59,7 @@ if CONFIG['OS_ARCH'] == 'SunOS' and '86' in CONFIG['OS_TEST']: 'xptcstubs_x86_64_linux.cpp' ] else: + ASFLAGS += ['-xarch=amd64'] SOURCES += [ 'xptcinvoke_x86_64_solaris.cpp', 'xptcstubs_asm_x86_64_solaris_SUNW.s', @@ -271,6 +272,7 @@ if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD') and CONFIG['OS_TEST'] == 'sparc64 if CONFIG['OS_ARCH'] == 'SunOS' and '86' not in CONFIG['OS_TEST']: if CONFIG['HAVE_64BIT_BUILD']: + ASFLAGS += ['-xarch=v9'] SOURCES += [ 'xptcinvoke_sparcv9_solaris.cpp', 'xptcstubs_sparcv9_solaris.cpp',