Index: external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.c =================================================================== RCS file: /home/netbsd/src/external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.c,v retrieving revision 1.7 diff -p -u -r1.7 arm-common.c --- external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.c 5 Sep 2020 09:12:24 -0000 1.7 +++ external/gpl3/gcc/dist/gcc/common/config/arm/arm-common.c 23 Nov 2020 07:20:49 -0000 @@ -936,6 +936,10 @@ arm_be8_option (int argc, const char **a return ""; if (check_isa_bits_for (selected_arch->common.isa_bits, isa_bit_be8)) +#ifdef ARM_BE32_IF_POSSIBLE + /* ARMv6 supports BE32. Let's use it. */ + if (check_isa_bits_for (selected_arch->common.isa_bits, isa_bit_armv7)) +#endif return "--be8"; return ""; Index: external/gpl3/gcc/dist/gcc/config/arm/arm.c =================================================================== RCS file: /home/netbsd/src/external/gpl3/gcc/dist/gcc/config/arm/arm.c,v retrieving revision 1.10 diff -p -u -r1.10 arm.c --- external/gpl3/gcc/dist/gcc/config/arm/arm.c 5 Sep 2020 09:12:25 -0000 1.10 +++ external/gpl3/gcc/dist/gcc/config/arm/arm.c 23 Nov 2020 07:18:15 -0000 @@ -33,6 +33,7 @@ #include "memmodel.h" #include "cfghooks.h" #include "df.h" +#include "tm.h" #include "tm_p.h" #include "stringpool.h" #include "attribs.h" @@ -3068,6 +3069,14 @@ arm_option_override_internal (struct gcc if (! opts_set->x_unaligned_access) { +#ifdef ARM_BE32_IF_POSSIBLE + /* Disable unaligned access for big-endian mode on ARMv6 by default; + it cannot be used with BE32. */ + if (BYTES_BIG_ENDIAN) + opts->x_unaligned_access = (TARGET_32BIT_P (opts->x_target_flags) + && arm_arch7); + else +#endif opts->x_unaligned_access = (TARGET_32BIT_P (opts->x_target_flags) && arm_arch6 && (arm_arch_notm || arm_arch7)); } Index: external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h =================================================================== RCS file: /home/netbsd/src/external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h,v retrieving revision 1.15 diff -p -u -r1.15 netbsd-eabi.h --- external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h 19 Aug 2016 05:11:09 -0000 1.15 +++ external/gpl3/gcc/dist/gcc/config/arm/netbsd-eabi.h 23 Nov 2020 07:27:22 -0000 @@ -34,8 +34,6 @@ #undef TARGET_LINKER_EMULATION #if TARGET_BIG_ENDIAN_DEFAULT #define TARGET_LINKER_EMULATION TARGET_LINKER_BIG_EMULATION -#undef BE8_LINK_SPEC -#define BE8_LINK_SPEC " %{!mlittle-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}" #else #define TARGET_LINKER_EMULATION TARGET_LINKER_LITTLE_EMULATION #endif @@ -110,3 +108,11 @@ %{!mbig-endian:%{!mlittle-endian:-m %(linker_emulation)}} \ %(be8_link_spec) %(target_fix_v4bx_spec) \ %(netbsd_link_spec)" + +/* We use BE32 for big-endian mode on ARMv6: + - Do not emit --be8 linker flag for ARMv6 by default. See + arm_be8_option () in ../../common/config/arm/arm-common.c. + - Disable unaligned access for big-endian mode on ARMv6, + which cannot be used with BE32. See + arm_option_override_internal () in arm.c. */ +#define ARM_BE32_IF_POSSIBLE