The following change fixes the setsockopt problem. I also hacked unified.S. Implicit space register selection should be used in the loads and stores.
Dave --- /dev/null 2019-11-08 20:11:47.960000000 -0500 +++ __setsockopt.S 2019-11-10 14:25:58.291898985 -0500 @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall5_weak(setsockopt, setsockopt, __libc_setsockopt); --- setsockopt.S 2019-11-10 14:48:34.979705577 -0500 +++ /dev/null 2019-11-08 20:11:47.960000000 -0500 @@ -1,3 +0,0 @@ -#include "syscalls.h" - -syscall5(setsockopt, setsockopt); --- unified.S.save 2019-11-10 14:44:32.131897343 -0500 +++ unified.S 2019-11-10 13:26:15.216075262 -0500 @@ -42,9 +42,9 @@ nop __unified_syscall6: - ldw -0x38(%sr0, %sp), %r21 + ldw -0x38(%sp), %r21 __unified_syscall5: - ldw -0x34(%sr0, %sp), %r22 + ldw -0x34(%sp), %r22 __unified_syscall: be,l 0x100(%sr2, %r0), %sr0, %r31 nop @@ -56,12 +56,12 @@ copy %r2, %r23 bl __errno_location, %r2 copy %ret0, %r20 - stw %r20, 0(%sr0, %ret0) + stw %r20, 0(%ret0) copy %r23, %r2 #else ldil LP%errno, %r26 ldo RP%errno(%r26), %r26 - stw %ret0, 0(%r0, %r26) + stw %ret0, 0(%r26) #endif ldi -1, %ret0 .Lnoerr: