Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] erlang: selectively enable libatomic_ops
@ 2014-12-23  0:53 Frank Hunleth
  2015-01-04 14:21 ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Hunleth @ 2014-12-23  0:53 UTC (permalink / raw)
  To: buildroot

Erlang can use either the system libatomic_ops or its own version.
However, if using the system version, it must find implementations for
AO_compare_and_swap() and other calls.  Since these are not available on
ARM versions before armv6+, selectively enable the use of the system
libatomic_ops.

Fixes:
  http://autobuild.buildroot.net/results/eba/eba5bf85e9ff98916cd3638b5f13ab5bd54564d8/
  http://autobuild.buildroot.net/results/c74/c743cfca629fb332bbb1327cf4ea360f0a4e4bfe/
  http://autobuild.buildroot.net/results/095/095348d4d309c2a408a3b297b4325348ed1dd7e8/

Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
---
Changes v1 -> v2:
  - Use system libatomic_ops on all platforms except those before armv6
    per investigation by Yann
  - Integrate Yann's other suggestions including comments on
    --without-libatomic-ops and cleaning up the logic in the Config.in

 package/erlang/Config.in | 12 ++++++++++++
 package/erlang/erlang.mk |  6 +++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/package/erlang/Config.in b/package/erlang/Config.in
index 56830da..cebfa2a 100644
--- a/package/erlang/Config.in
+++ b/package/erlang/Config.in
@@ -26,6 +26,18 @@ config BR2_PACKAGE_ERLANG_SMP
 	  If you do not need SMP support, turning this option off reduces
 	  compile time and the size of the Erlang installation.

+config BR2_PACKAGE_ERLANG_USE_LIBATOMIC_OPS
+	bool
+	default y
+	depends on BR2_PACKAGE_LIBATOMIC_ARCH_SUPPORTS
+	# On ARM, only armv6+ has the necessary AO_compare_and_swap()
+	depends on BR2_ARM_CPU_ARMV6 || BR2_ARM_CPU_ARMV7A || !(BR2_arm || BR2_armeb)
+	help
+	  Use the system libatomic_ops on platforms that provide
+	  implementations for AO_store(), AO_load(), and AO_compare_and_swap().
+	  Platforms without support for those functions must still use the
+	  Erlang-provided implementation.
+
 config BR2_PACKAGE_ERLANG_MEGACO
 	bool "install megaco application"
 	help
diff --git a/package/erlang/erlang.mk b/package/erlang/erlang.mk
index 0b8619e..c107745 100644
--- a/package/erlang/erlang.mk
+++ b/package/erlang/erlang.mk
@@ -22,9 +22,13 @@ ERLANG_CONF_ENV += erl_xcomp_sysroot=$(STAGING_DIR)

 ERLANG_CONF_OPTS = --without-javac

-ifeq ($(BR2_PACKAGE_LIBATOMIC_OPS),y)
+ifeq ($(BR2_PACKAGE_ERLANG_USE_LIBATOMIC_OPS),y)
 ERLANG_DEPENDENCIES += libatomic_ops
 ERLANG_CONF_OPTS += --with-libatomic_ops=$(STAGING_DIR)/usr
+else
+# --without-libatomic_ops means: do not use an external libatomic_ops;
+# atomic operations use an internal implementation instead.
+ERLANG_CONF_OPTS += --without-libatomic_ops
 endif

 # erlang uses openssl for all things crypto. Since the host tools (such as
--
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v2] erlang: selectively enable libatomic_ops
  2014-12-23  0:53 [Buildroot] [PATCH v2] erlang: selectively enable libatomic_ops Frank Hunleth
@ 2015-01-04 14:21 ` Yann E. MORIN
  2015-01-05  5:15   ` Frank Hunleth
  0 siblings, 1 reply; 3+ messages in thread
From: Yann E. MORIN @ 2015-01-04 14:21 UTC (permalink / raw)
  To: buildroot

Frank, All,

On 2014-12-22 19:53 -0500, Frank Hunleth spake thusly:
> Erlang can use either the system libatomic_ops or its own version.
> However, if using the system version, it must find implementations for
> AO_compare_and_swap() and other calls.  Since these are not available on
> ARM versions before armv6+, selectively enable the use of the system
> libatomic_ops.
> 
> Fixes:
>   http://autobuild.buildroot.net/results/eba/eba5bf85e9ff98916cd3638b5f13ab5bd54564d8/
>   http://autobuild.buildroot.net/results/c74/c743cfca629fb332bbb1327cf4ea360f0a4e4bfe/
>   http://autobuild.buildroot.net/results/095/095348d4d309c2a408a3b297b4325348ed1dd7e8/
> 
> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>

I've sent an alternate solution to this libatomic_ops issue:
    http://patchwork.ozlabs.org/patch/425174/

This is much simpler, Buildroot-wise, as it essentially patches erlang,
so that it properly use libatomic_ops.

This is the result of a past discussion with Thomas P. on IRC, where he
pointed me to a patch we have against libunwind, that does require CAS
too, and for which we add `#define AO_REQUIRE_CAS', as instructed in the
libatomic_ops documentation.

Could you please test that new patch and report on it, please?

Thanks!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v2] erlang: selectively enable libatomic_ops
  2015-01-04 14:21 ` Yann E. MORIN
@ 2015-01-05  5:15   ` Frank Hunleth
  0 siblings, 0 replies; 3+ messages in thread
From: Frank Hunleth @ 2015-01-05  5:15 UTC (permalink / raw)
  To: buildroot

Hi Yann, Thomas,

On Sun, Jan 4, 2015 at 9:21 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Frank, All,
>
> On 2014-12-22 19:53 -0500, Frank Hunleth spake thusly:
>> Erlang can use either the system libatomic_ops or its own version.
>> However, if using the system version, it must find implementations for
>> AO_compare_and_swap() and other calls.  Since these are not available on
>> ARM versions before armv6+, selectively enable the use of the system
>> libatomic_ops.
>>
>> Fixes:
>>   http://autobuild.buildroot.net/results/eba/eba5bf85e9ff98916cd3638b5f13ab5bd54564d8/
>>   http://autobuild.buildroot.net/results/c74/c743cfca629fb332bbb1327cf4ea360f0a4e4bfe/
>>   http://autobuild.buildroot.net/results/095/095348d4d309c2a408a3b297b4325348ed1dd7e8/
>>
>> Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
>
> I've sent an alternate solution to this libatomic_ops issue:
>     http://patchwork.ozlabs.org/patch/425174/
>
> This is much simpler, Buildroot-wise, as it essentially patches erlang,
> so that it properly use libatomic_ops.
>
> This is the result of a past discussion with Thomas P. on IRC, where he
> pointed me to a patch we have against libunwind, that does require CAS
> too, and for which we add `#define AO_REQUIRE_CAS', as instructed in the
> libatomic_ops documentation.
>
> Could you please test that new patch and report on it, please?

Yes. I didn't know about AO_REQUIRE_CAS, but it does sound better.
I'll try out the patch when I get a chance - probably Wednesday. Sorry
that I can't try it sooner.

Thanks,
Frank

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-05  5:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-23  0:53 [Buildroot] [PATCH v2] erlang: selectively enable libatomic_ops Frank Hunleth
2015-01-04 14:21 ` Yann E. MORIN
2015-01-05  5:15   ` Frank Hunleth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox