diff options
author | Mark H Weaver <mhw@netris.org> | 2013-11-03 18:08:33 -0500 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2013-11-03 23:25:54 -0500 |
commit | 2c1ceeacdf00c9fa6b4324b693c9998745f84b1c (patch) | |
tree | 4101306a1d39055bffe6802c0f8edaa70daf78bf /gnu | |
parent | 69f777d14caa50a3a0d0167910ddb9a5910d4ab2 (diff) | |
download | patches-2c1ceeacdf00c9fa6b4324b693c9998745f84b1c.tar patches-2c1ceeacdf00c9fa6b4324b693c9998745f84b1c.tar.gz |
gnu: binutils: apply fixes and workarounds for Loongson 2F CPUs.
* gnu/packages/patches/binutils-loongson-madd-fix.patch: New file.
* gnu/packages/patches/binutils-loongson-workaround.patch: New file.
* gnu/packages/base.scm (binutils): Add patches.
* gnu-system.am (dist_patch_DATA): Add patches.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/base.scm | 4 | ||||
-rw-r--r-- | gnu/packages/patches/binutils-loongson-madd-fix.patch | 44 | ||||
-rw-r--r-- | gnu/packages/patches/binutils-loongson-workaround.patch | 34 |
3 files changed, 81 insertions, 1 deletions
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm index f89d618cdf..41e1a8d049 100644 --- a/gnu/packages/base.scm +++ b/gnu/packages/base.scm @@ -321,7 +321,9 @@ change.") (sha256 (base32 "15qhbkz3r266xaa52slh857qn3abw7rb2x2jnhpfrafpzrb4x4gy")) - (patches (list (search-patch "binutils-ld-new-dtags.patch"))))) + (patches (list (search-patch "binutils-ld-new-dtags.patch") + (search-patch "binutils-loongson-workaround.patch") + (search-patch "binutils-loongson-madd-fix.patch"))))) (build-system gnu-build-system) ;; Split Binutils in several outputs, mostly to avoid collisions in diff --git a/gnu/packages/patches/binutils-loongson-madd-fix.patch b/gnu/packages/patches/binutils-loongson-madd-fix.patch new file mode 100644 index 0000000000..364ccd67e3 --- /dev/null +++ b/gnu/packages/patches/binutils-loongson-madd-fix.patch @@ -0,0 +1,44 @@ +Fix the Loongson 2F specific fused multiply-add instructions on paired singles to +use the encoding recognized by the processor, as opposed to the mistaken english +Loongson 2F documentation. + +Patch by Mark H Weaver <mhw@netris.org>. + +--- binutils/opcodes/mips-opc.c.orig 2012-09-04 10:21:10.000000000 -0400 ++++ binutils/opcodes/mips-opc.c 2013-10-06 02:23:33.679983766 -0400 +@@ -931,7 +931,7 @@ + {"madd.s", "D,S,T", 0x72000018, 0xffe0003f, RD_S|RD_T|WR_D|FP_S, 0, IL2F }, + {"madd.ps", "D,R,S,T", 0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5_33 }, + {"madd.ps", "D,S,T", 0x45600018, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2E }, +-{"madd.ps", "D,S,T", 0x71600018, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, ++{"madd.ps", "D,S,T", 0x72c00018, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, + {"madd", "s,t", 0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 }, + {"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 }, + {"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, 0, G1 }, +@@ -1041,7 +1041,7 @@ + {"msub.s", "D,S,T", 0x72000019, 0xffe0003f, RD_S|RD_T|WR_D|FP_S, 0, IL2F }, + {"msub.ps", "D,R,S,T", 0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5_33 }, + {"msub.ps", "D,S,T", 0x45600019, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2E }, +-{"msub.ps", "D,S,T", 0x71600019, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, ++{"msub.ps", "D,S,T", 0x72c00019, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, + {"msub", "s,t", 0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 }, + {"msub", "s,t", 0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 }, + {"msub", "7,s,t", 0x70000004, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 }, +@@ -1157,7 +1157,7 @@ + {"nmadd.s", "D,S,T", 0x7200001a, 0xffe0003f, RD_S|RD_T|WR_D|FP_S, 0, IL2F }, + {"nmadd.ps","D,R,S,T", 0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5_33 }, + {"nmadd.ps", "D,S,T", 0x4560001a, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2E }, +-{"nmadd.ps", "D,S,T", 0x7160001a, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, ++{"nmadd.ps", "D,S,T", 0x72c0001a, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, + {"nmsub.d", "D,R,S,T", 0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I4_33 }, + {"nmsub.d", "D,S,T", 0x4620001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2E }, + {"nmsub.d", "D,S,T", 0x7220001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, +@@ -1166,7 +1166,7 @@ + {"nmsub.s", "D,S,T", 0x7200001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_S, 0, IL2F }, + {"nmsub.ps","D,R,S,T", 0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5_33 }, + {"nmsub.ps", "D,S,T", 0x4560001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2E }, +-{"nmsub.ps", "D,S,T", 0x7160001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, ++{"nmsub.ps", "D,S,T", 0x72c0001b, 0xffe0003f, RD_S|RD_T|WR_D|FP_D, 0, IL2F }, + /* nop is at the start of the table. */ + {"nor", "d,v,t", 0x00000027, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 }, + {"nor", "t,r,I", 0, (int) M_NOR_I, INSN_MACRO, 0, I1 }, diff --git a/gnu/packages/patches/binutils-loongson-workaround.patch b/gnu/packages/patches/binutils-loongson-workaround.patch new file mode 100644 index 0000000000..f43572a53d --- /dev/null +++ b/gnu/packages/patches/binutils-loongson-workaround.patch @@ -0,0 +1,34 @@ +Enable the workaround for the Loongson 2F bug by default. + +Patch by Mark H Weaver <mhw@netris.org>. + +--- binutils/gas/config/tc-mips.c.orig 2012-09-04 10:21:03.000000000 -0400 ++++ binutils/gas/config/tc-mips.c 2013-10-06 02:23:21.651983768 -0400 +@@ -910,10 +910,10 @@ + }; + + /* ...likewise -mfix-loongson2f-jump. */ +-static bfd_boolean mips_fix_loongson2f_jump; ++static bfd_boolean mips_fix_loongson2f_jump = FALSE; + + /* ...likewise -mfix-loongson2f-nop. */ +-static bfd_boolean mips_fix_loongson2f_nop; ++static bfd_boolean mips_fix_loongson2f_nop = TRUE; + + /* True if -mfix-loongson2f-nop or -mfix-loongson2f-jump passed. */ + static bfd_boolean mips_fix_loongson2f; +--- binutils/gas/testsuite/gas/mips/mips.exp.orig 2012-09-04 10:17:13.000000000 -0400 ++++ binutils/gas/testsuite/gas/mips/mips.exp 2013-10-06 02:23:21.663983768 -0400 +@@ -91,6 +91,12 @@ + + # Catch because the variable won't be set the first time through. + catch {unset mips_arches} ++ ++ # Disable the loongson2f nop fix by default, because most of the ++ # existing test cases for mips will fail otherwise. ++ global ASFLAGS ++ set old_ASFLAGS "$ASFLAGS" ++ set ASFLAGS "$ASFLAGS -mno-fix-loongson2f-nop" + } + + # mips_arch_create ARCH GPRSIZE EXTENDS PROPS AS_FLAGS OBJDUMP_FLAGS \ |