NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/49074 (lang/ruby21-base fails to link due to undefined reference to `__atomic_compare_exchange_4')



On Tue,  5 Aug 2014 12:09:15 +0000 (UTC),
martin%NetBSD.org@localhost wrote:

> Synopsis: lang/ruby21-base fails to link due to undefined reference to 
> `__atomic_compare_exchange_4'
> 
> Responsible-Changed-From-To: port-sparc-maintainer->toolchain-manager
> Responsible-Changed-By: martin%NetBSD.org@localhost
> Responsible-Changed-When: Tue, 05 Aug 2014 12:09:15 +0000
> Responsible-Changed-Why:
> This is a more broad issue, we need to add support for all the
> __sync* builtins for the C++ memory model
> listed in /usr/src/external/gpl3/gcc/dist/gcc/sync-builtins.def
> and treat them like we did with the __sync_* stuff (including a test
> case and fixing all build breakage)
> .

Based on infomation from @obache via twitter, I added checks
__atomic_compare_exchange_n into ruby's configure script as
following:

----8<--------8<--------8<--------8<--------8<----
--- configure.orig-pkgsrc-patched       2014-08-28 17:16:21.000000000 +0900
+++ configure   2014-08-28 17:28:28.000000000 +0900
@@ -13115,6 +13115,7 @@
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 unsigned char atomic_var;
+unsigned char atomic_var2;
 int
 main ()
 {
@@ -13123,6 +13124,8 @@
                        __atomic_exchange_n(&atomic_var, 1, __ATOMIC_SEQ_CST);
                        __atomic_fetch_add(&atomic_var, 1, __ATOMIC_SEQ_CST);
                        __atomic_fetch_sub(&atomic_var, 1, __ATOMIC_SEQ_CST);
+                       __atomic_compare_exchange_n(&atomic_var, &atomic_var2, 
0, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+                       __atomic_compare_exchange_n(&atomic_var, &atomic_var2, 
1, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
 
   ;
   return 0;
----8<--------8<--------8<--------8<--------8<----

This let result of "checking for __atomic builtins..." be no,
and use of these builtin function is avoided. Tested on 
netbsd-7 branch, synchronized end of last week.

Note: __atomic_exchange_n, __atomic_fetch_add and __atomic_fetch_sub
exist for sparc port, so the result of check for these builtin 
functions is yes regularly.

This seem to be not a good way to solve the problem, however, 
this evades the problem that lang/ruby212 cannot be built in
sparc port.

I cannot judge this problem is NetBSD's toolchain problem
or ruby's configfure script is irresponsible. 

Anyway, I report the newest trying result.


Lecturer / Faculty of Software & Info. Sci., Iwate Prefectural Univ.
Nobuyoshi Sato, Ph.D / nobu-s%iwate-pu.ac.jp@localhost / +81-19-694-2612



Home | Main Index | Thread Index | Old Index