lang/g95: blindly apply patch to help netbsd/mips build issues.

netbsd/mips gcc defaults to -mips1 which lacks ll/sc instructions
(or anything like them), and rejects the assembly code used here.

switch to mips3 (bare minimum for synchronization primitives) for
these instructions. this will result in runtime failures (illegal
instruction) on mips1, but we're unlikely to see any such users
(MIPS3 was released in 1992).

I'm not comfortable using the proper fix of switching to using
__sync_* because that seems to be a compiler builtin and gcc 4.1.2
might not have it.
Also, that change requires careful testing that this 'dumb' change
doesn't. Additionally, g95 is a dead end (upstream gone), so not
worth the effort.

PR pkg/44547: pkgsrc build failure for g95 on NetBSD/cobalt
This commit is contained in:
maya 2016-09-28 15:34:54 +00:00
parent 867aa790b8
commit 46feee1dbd
2 changed files with 24 additions and 1 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.26 2016/09/27 20:51:11 maya Exp $
$NetBSD: distinfo,v 1.27 2016/09/28 15:34:54 maya Exp $
SHA1 (g95_source.tgz) = b5e503fd6459b65cbda73190685f9490230d9cff
RMD160 (g95_source.tgz) = 98d03e9a1835f4b3553a72a798bdf1d90a757176
@ -33,3 +33,4 @@ SHA1 (patch-libf95.a-0.93_math_ff.c) = d873e3fd699d9c9fd06681c1e136cf16cf013a1a
SHA1 (patch-libf95.a-0.93_math_x87.S) = 25dc2b613969947ae60fdc9b1dc6d9524b0157be
SHA1 (patch-libf95.a-0.93_quad_power16.c) = eb6711bcd1018cac675dbbe212cd22a831a9d191
SHA1 (patch-libf95.a-0.93_runtime_main.c) = dfde68072f38bf5bbb9c54ebeea5b9ce07d0c6be
SHA1 (patch-libf95.a-0.93_runtime_mutex.c) = 8252537e4cbc5fd53b3f89e4403b581e3c73e52c

View file

@ -0,0 +1,22 @@
$NetBSD: patch-libf95.a-0.93_runtime_mutex.c,v 1.1 2016/09/28 15:34:54 maya Exp $
gcc on netbsd/mips rejects ll/sc as it targets mips1 which lacks
these instructions. tell it it's mips3 code. it will crash
at runtime for mips1 (unlikely to compile this package), but
makes it possible to build for newer mips.
--- libf95.a-0.93/runtime/mutex.c.orig 2008-09-17 03:45:13.000000000 +0000
+++ libf95.a-0.93/runtime/mutex.c
@@ -116,9 +116,12 @@ int old_val, temp;
__asm__ __volatile__(" move %5, %2 \n"
"1: move %2, %5 \n"
+ " .set push \n"
+ " .set mips3 \n"
" ll %0, %4 \n"
" bne %0, %3, 2f \n"
" sc %2, %1 \n"
+ " .set pop \n"
" beqz %2, 1b \n"
"2:\n"
: "=&r" (old_val), "=m" (*addr)