haproxy: tweak thread activation
PATCH 1/1 haproxy: tweak thread activation
If threads are enabled, as described in include/common/hathreads.h, haproxy uses __sync_*_4 intrisics if gcc < 4.7. Otherwise, haproxy uses __atomic_ intrinsics.
As a result, instead of adding a dependency on BR2_TOOLCHAIN_HAS_SYNC_4 and BR2_TOOLCHAIN_HAS_ATOMIC in Config.in, enable threads only if the dependencies are fulfilled in haproxy.mk
Fixes:
- http://autobuild.buildroot.org/results/7f24873ecdd9246c95c03bb8d2fcd4c16c488c6c
--- package/haproxy/Config.in | 1 - package/haproxy/haproxy.mk | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-)
package/haproxy/Config.in +0 -1
@@ -1,7 +1,6 @@ config BR2_PACKAGE_HAPROXY bool "haproxy" depends on BR2_USE_MMU # fork() - depends on BR2_TOOLCHAIN_HAS_SYNC_4 # __sync_*_4 intrisics help HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and
package/haproxy/haproxy.mk +6 -0
@@ -20,7 +20,13 @@ HAPROXY_LIBS += -latomic endif ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +# threads uses atomics on gcc >= 4.7 and sync otherwise (see +# include/common/hathreads.h) +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_ATOMIC),y:y) HAPROXY_MAKE_OPTS += USE_THREAD=1 +else ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_SYNC_4),:y) +HAPROXY_MAKE_OPTS += USE_THREAD=1 +endif endif ifeq ($(BR2_PACKAGE_LUA_5_3),y)
Signature · 1 line
2.17.1
PATCH 1/1 haproxy: tweak thread activation
Quoted 3 lines · Fabrice Fontaine
If threads are enabled, as described in
include/common/hathreads.h, haproxy uses __sync_*_4 intrisics if gcc < 4.7. Otherwise, haproxy uses__atomic_intrinsics.
So the problem really is that haproxy is to stupid to realize that it should
fall back on __sync if __atomic is not available...
But trying to encode that in a hand-rolled Makefile is insane. So this approach
looks good to me.
Regards,
Arnout
Quoted 45 lines
As a result, instead of adding a dependency on
BR2_TOOLCHAIN_HAS_SYNC_4andBR2_TOOLCHAIN_HAS_ATOMICin Config.in, enable threads only if the dependencies are fulfilled in haproxy.mkFixes:
- http://autobuild.buildroot.org/results/7f24873ecdd9246c95c03bb8d2fcd4c16c488c6cSigned-off-by Fabrice Fontaine <[email protected]>--- package/haproxy/Config.in | 1 - package/haproxy/haproxy.mk | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-)package/haproxy/Config.in +0
-1@@ -1,7 +1,6 @@ config BR2_PACKAGE_HAPROXY bool "haproxy" depends on BR2_USE_MMU # fork() - depends on BR2_TOOLCHAIN_HAS_SYNC_4 # __sync_*_4 intrisics help HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP andpackage/haproxy/haproxy.mk +6
-0@@ -20,7 +20,13 @@ HAPROXY_LIBS += -latomic endif ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +# threads uses atomics on gcc >= 4.7 and sync otherwise (see +# include/common/hathreads.h) +ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_ATOMIC),y:y) HAPROXY_MAKE_OPTS += USE_THREAD=1 +else ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_4_7):$(BR2_TOOLCHAIN_HAS_SYNC_4),:y) +HAPROXY_MAKE_OPTS += USE_THREAD=1 +endif endif ifeq ($(BR2_PACKAGE_LUA_5_3),y)
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 haproxy: tweak thread activation
In reply to Fabrice FontaineQuoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Fabrice" == Fabrice Fontaine <[email protected]> writes:
If threads are enabled, as described in
include/common/hathreads.h, haproxy uses __sync_*_4 intrisics if gcc < 4.7. Otherwise, haproxy uses__atomic_intrinsics.
Quoted 8 lines
As a result, instead of adding a dependency on
BR2_TOOLCHAIN_HAS_SYNC_4andBR2_TOOLCHAIN_HAS_ATOMICin Config.in, enable threads only if the dependencies are fulfilled in haproxy.mkFixes:
- http://autobuild.buildroot.org/results/7f24873ecdd9246c95c03bb8d2fcd4c16c488c6cSigned-off-by Fabrice Fontaine <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard