]> granicus.if.org Git - libatomic_ops/commitdiff
Support MIPS rel6
authorYunQiang Su <wzssyqa@gmail.com>
Fri, 16 Mar 2018 06:58:22 +0000 (09:58 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 27 Mar 2018 07:36:09 +0000 (10:36 +0300)
Don't set mips2/3 for mips r6.  MIPS release 6 changes the encoding of
some instructions, including ll/sc.  Setting mips2/3 here produces the
binary with the old encoding (not compatible with mips r6).

This patch has no effect if gcc 4.9+ or clang 3.5+ unless
AO_DISABLE_GCC_ATOMICS is defined manually in CFLAGS.

* src/atomic_ops/sysdeps/gcc/mips.h [AO_DISABLE_GCC_ATOMICS
&& __mips_isa_rev>=6] (AO_MIPS_SET_ISA): Define to empty string
(instead of ".set mips2" or ".set mips3").

src/atomic_ops/sysdeps/gcc/mips.h

index d7a36208085876ea86c116b8d1bdb162e47d8158..34cc4fbb33974fe87f9f3f4f7a90bec25a0e2ea8 100644 (file)
 
 # if !defined(_ABI64) || _MIPS_SIM != _ABI64
 #   define AO_T_IS_INT
-#   define AO_MIPS_SET_ISA    "       .set mips2\n"
+#   if __mips_isa_rev >= 6
+      /* Encoding of ll/sc in mips rel6 differs from that of mips2/3. */
+#     define AO_MIPS_SET_ISA  ""
+#   else
+#     define AO_MIPS_SET_ISA  "       .set mips2\n"
+#   endif
 #   define AO_MIPS_LL_1(args) "       ll " args "\n"
 #   define AO_MIPS_SC(args)   "       sc " args "\n"
 # else
-#   define AO_MIPS_SET_ISA    "       .set mips3\n"
+#   if __mips_isa_rev >= 6
+#     define AO_MIPS_SET_ISA  ""
+#   else
+#     define AO_MIPS_SET_ISA  "       .set mips3\n"
+#   endif
 #   define AO_MIPS_LL_1(args) "       lld " args "\n"
 #   define AO_MIPS_SC(args)   "       scd " args "\n"
-# endif
+# endif /* _MIPS_SIM == _ABI64 */
 
 #ifdef AO_ICE9A1_LLSC_WAR
   /* ICE9 rev A1 chip (used in very few systems) is reported to */