diff --git a/apps/plugins/mpegplayer/libmpeg2/idct_arm.S b/apps/plugins/mpegplayer/libmpeg2/idct_arm.S index 90eb5031c7..8ff7c90629 100644 --- a/apps/plugins/mpegplayer/libmpeg2/idct_arm.S +++ b/apps/plugins/mpegplayer/libmpeg2/idct_arm.S @@ -21,6 +21,8 @@ #include "config.h" + .syntax unified + .global mpeg2_idct_copy .type mpeg2_idct_copy, %function .global mpeg2_idct_add diff --git a/apps/plugins/mpegplayer/libmpeg2/idct_armv6.S b/apps/plugins/mpegplayer/libmpeg2/idct_armv6.S index a259721410..ad28cefcf2 100644 --- a/apps/plugins/mpegplayer/libmpeg2/idct_armv6.S +++ b/apps/plugins/mpegplayer/libmpeg2/idct_armv6.S @@ -21,6 +21,8 @@ #include "config.h" + .syntax unified + .global mpeg2_idct_copy .type mpeg2_idct_copy, %function .global mpeg2_idct_add diff --git a/apps/recorder/jpeg_idct_arm.S b/apps/recorder/jpeg_idct_arm.S index 1f2603da1b..e706a17384 100644 --- a/apps/recorder/jpeg_idct_arm.S +++ b/apps/recorder/jpeg_idct_arm.S @@ -24,6 +24,8 @@ #include "config.h" #include "apps/core_asmdefs.h" + .syntax unified + .section .text .align 2 .global jpeg_idct1h diff --git a/firmware/asm/arm/lcd-as-memframe.S b/firmware/asm/arm/lcd-as-memframe.S index d42b2a920d..f69f6e5080 100644 --- a/firmware/asm/arm/lcd-as-memframe.S +++ b/firmware/asm/arm/lcd-as-memframe.S @@ -24,6 +24,8 @@ #include "config.h" #include "cpu.h" + .syntax unified + /**************************************************************************** * void lcd_copy_buffer_rect(fb_data *dst, fb_data *src, int width, * int height); diff --git a/firmware/asm/arm/memcpy.S b/firmware/asm/arm/memcpy.S index 86fc6b7930..1fbb6660e9 100644 --- a/firmware/asm/arm/memcpy.S +++ b/firmware/asm/arm/memcpy.S @@ -35,6 +35,8 @@ #define push lsr #endif + .syntax unified + /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ /* Prototype: void *mempcpy(void *dest, const void *src, size_t n); */ diff --git a/firmware/asm/arm/memmove.S b/firmware/asm/arm/memmove.S index e5c9b42928..cf22a74622 100644 --- a/firmware/asm/arm/memmove.S +++ b/firmware/asm/arm/memmove.S @@ -35,6 +35,8 @@ #define push lsr #endif + .syntax unified + .text /* diff --git a/firmware/asm/arm/memset.S b/firmware/asm/arm/memset.S index d727f2a5ec..ef5cdb5819 100644 --- a/firmware/asm/arm/memset.S +++ b/firmware/asm/arm/memset.S @@ -20,6 +20,8 @@ ****************************************************************************/ #include "config.h" + .syntax unified + .section .icode,"ax",%progbits .align 2 diff --git a/firmware/asm/arm/memset16.S b/firmware/asm/arm/memset16.S index 226eac39e1..851b9207a2 100644 --- a/firmware/asm/arm/memset16.S +++ b/firmware/asm/arm/memset16.S @@ -20,6 +20,8 @@ ****************************************************************************/ #include "config.h" + .syntax unified + .section .icode,"ax",%progbits .align 2 diff --git a/firmware/export/config.h b/firmware/export/config.h index 80d59ea836..9812db9161 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -1018,14 +1018,19 @@ Lyre prototype 1 */ * These macros are for switching on unified syntax in inline assembly. * Older versions of GCC emit assembly in divided syntax with no option * to enable unified syntax. - * - * FIXME: This needs to be looked at after the toolchain bump */ +#if (__GNUC__ < 8) #define BEGIN_ARM_ASM_SYNTAX_UNIFIED ".syntax unified\n" #define END_ARM_ASM_SYNTAX_UNIFIED ".syntax divided\n" +#else +#define BEGIN_ARM_ASM_SYNTAX_UNIFIED +#define END_ARM_ASM_SYNTAX_UNIFIED +#endif #if defined(CPU_ARM) && defined(__ASSEMBLER__) +#if (__GNUC__ < 8) .syntax unified +#endif /* ARMv4T doesn't switch the T bit when popping pc directly, we must use BX */ .macro ldmpc cond="", order="ia", regs #if ARM_ARCH == 4 && defined(USE_THUMB) @@ -1043,6 +1048,9 @@ Lyre prototype 1 */ ldr\cond pc, [sp], #4 #endif .endm +#if (__GNUC__ < 8) +.syntax divided +#endif #endif #if defined(CPU_COLDFIRE) && defined(__ASSEMBLER__) diff --git a/firmware/target/arm/ata-as-arm.S b/firmware/target/arm/ata-as-arm.S index 16c2928bf1..cec4a7e235 100644 --- a/firmware/target/arm/ata-as-arm.S +++ b/firmware/target/arm/ata-as-arm.S @@ -21,6 +21,7 @@ #include "config.h" + .syntax unified #if CONFIG_CPU == PP5002 /* Causes ATA retries on iPod G3 probably related to improper controller diff --git a/lib/arm_support/support-arm.S b/lib/arm_support/support-arm.S index 3af0c70975..d12392eeb3 100644 --- a/lib/arm_support/support-arm.S +++ b/lib/arm_support/support-arm.S @@ -30,6 +30,8 @@ #include +.syntax unified + .macro ARM_SDIV32_PRE numerator, divisor, sign /* sign[31] = divisor sign */ ands \sign, \divisor, #1<<31 diff --git a/lib/rbcodec/codecs/demac/libdemac/udiv32_arm.S b/lib/rbcodec/codecs/demac/libdemac/udiv32_arm.S index 1d19160a91..514bae2949 100644 --- a/lib/rbcodec/codecs/demac/libdemac/udiv32_arm.S +++ b/lib/rbcodec/codecs/demac/libdemac/udiv32_arm.S @@ -29,6 +29,9 @@ ****************************************************************************/ #include "config.h" + +.syntax unified + /* On targets with codec iram, a header file will be generated after an initial link of the APE codec, stating the amount of IRAM remaining for use by the reciprocal lookup table. */ diff --git a/lib/rbcodec/codecs/libtta/filter_arm.S b/lib/rbcodec/codecs/libtta/filter_arm.S index 10f1491796..d801a52419 100644 --- a/lib/rbcodec/codecs/libtta/filter_arm.S +++ b/lib/rbcodec/codecs/libtta/filter_arm.S @@ -26,6 +26,8 @@ * void hybrid_filter(fltst *fs, int *in) */ + .syntax unified + #ifdef USE_IRAM .section .icode, "ax", %progbits #else diff --git a/lib/rbcodec/dsp/dsp_arm.S b/lib/rbcodec/dsp/dsp_arm.S index 864abee4b6..b17c94fe6c 100644 --- a/lib/rbcodec/dsp/dsp_arm.S +++ b/lib/rbcodec/dsp/dsp_arm.S @@ -22,6 +22,7 @@ ****************************************************************************/ #include "rbcodecconfig.h" + .syntax unified /**************************************************************************** * void channel_mode_proc_mono(struct dsp_proc_entry *this, * struct dsp_buffer **buf_p) diff --git a/lib/rbcodec/dsp/dsp_arm_v6.S b/lib/rbcodec/dsp/dsp_arm_v6.S index aa27ec90f6..facd3facbd 100644 --- a/lib/rbcodec/dsp/dsp_arm_v6.S +++ b/lib/rbcodec/dsp/dsp_arm_v6.S @@ -20,6 +20,7 @@ ****************************************************************************/ #include "rbcodecconfig.h" + .syntax unified /**************************************************************************** * void sample_output_mono(struct sample_io_data *this, * struct dsp_buffer *src, diff --git a/lib/unwarminder/safe_read.S b/lib/unwarminder/safe_read.S index ce4913870c..557f3dca31 100644 --- a/lib/unwarminder/safe_read.S +++ b/lib/unwarminder/safe_read.S @@ -20,6 +20,8 @@ ****************************************************************************/ #include "config.h" +.syntax unified + .data was_aborted: .word 0 diff --git a/tools/configure b/tools/configure index 8a2e499a29..be4b0e3902 100755 --- a/tools/configure +++ b/tools/configure @@ -4533,7 +4533,11 @@ if [ -z "$arch" ]; then elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then arch="arm" # cpp defines like "#define __ARM_ARCH_4TE__ 1" (where we want to extract the 4) - arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep __ARM_ARCH | sed -e 's,.*\([0-9]\).*,\1,' | grep -v __ARM_ARCH)" + arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep __ARM_ARCH | sed -e 's,.*\([0-9]\).*,\1,' | grep -v __ARM_ARCH | head -1)" + if test "$gccnum" -ge "800"; then + # GCC8+ can natively emit unified asm syntax + GCCOPTS="$GCCOPTS -masm-syntax-unified" + fi elif [ -n "$(echo $cpp_defines | grep -w __mips__)" ]; then arch="mips" arch_version="$(echo $cpp_defines | tr ' ' '\012' | grep _MIPS_ARCH_MIPS | sed -e 's,.*\([0-9][0-9]\).*,\1,' | grep -v _MIPS_ARCH_MIPS)"