package/erlang: fix detection of libatomic_ops
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 4 Jan 2015 14:17:14 +0000 (15:17 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 4 Jan 2015 20:26:07 +0000 (21:26 +0100)
commit4a9df2942470241d7a96f326f0e7012aacd36f2e
tree61be751657e2ff0c280b75a82c0eb17c17e0e2e6
parent4dc54da061b27379adb9728bf337ab07b2daefe2
package/erlang: fix detection of libatomic_ops

For some platforms, hardware-assisted compare-and-swap may not be
available, so libatomic_ops will not provide it.

However, libatomic_ops can provide a purely software CAS emulation, but
must be instructed to do so. erlang just forgot to tell libatomic_ops
that it does require CAS.

Fix that by defining AO_REQUIRE_CAS before including atmoic_ops.h, like
is done in libunwind, as pointed out by Thomas.

Also, erlang has a convoluted, mind-alterating set on aclocal.m4 macros,
that just forgets to link against -latomic_ops when checking CAS is
available, so that even if CAS is available, configure chokes.

Since I would like to keep the little sanity I still have, just force
linking with -latomic_ops. This is useless when the check is natrally
sucessful (i.e. on platforms where CAS is available in HW), but we
would eventually link with -latomic_ops there, too; it's just redundant.

Overall, just consider that erlang requires libatomic_ops, so forcibly
depend on it, it is easier than trying to disable it. We can revisit
that whenever someone wants to run erlang on a platform for which there
is no libatomic_ops support.

Fixes a slew of autobuild ARM failures:
    http://autobuild.buildroot.org/results/e7b/e7bfc4893dea6b133f0794ef44d50ad89bcb6662/
    http://autobuild.buildroot.org/results/3e9/3e9c307f1ec6536482641019dcaa94677f7267a3/
    http://autobuild.buildroot.org/results/a85/a85ca414e5b67af46510abd7b610eb5ae8661de4/
    [...]

[Thomas: fix minor typos in commit log, add dependency on
BR2_PACKAGE_LIBATOMIC_ARCH_SUPPORTS to the Erlang comment about thread
and shared library dependency.]

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Frank Hunleth <fhunleth@troodon-software.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/erlang/0001-build-fix.patch [new file with mode: 0644]
package/erlang/0002-erts-ethread-instruct-libatomic_ops-we-do-require-CA.patch [new file with mode: 0644]
package/erlang/Config.in
package/erlang/erlang-build-fix.patch [deleted file]
package/erlang/erlang.mk