IBM is still selling AIX?!
(Which stands for: it Ain't unIX ;-) )

-----Original Message-----
From: Chris <> 
Sent: Monday, February 3, 2020 6:10 AM
Subject: [PATCH] AIX 7.2 support

Hello everybody,

I spent some time making haproxy compile and run successfully on AIX
7.2 using GCC 8.3 and wanted to contribute my patch in the hope that it could 
be merged. The patch is based on the current haproxy 2.1 head revision. I can 
make one for the development branch too - but it should be basically identical.

--- Makefile.old 2020-02-03 10:56:25.000000000 +0000
+++ Makefile 2020-02-03 11:32:00.735254403 +0000
@@ -144,13 +144,13 @@
 # Use TARGET=<target_name> to optimize for a specifc target OS among the  # 
following list (use the default "generic" if uncertain) :
 #    linux-glibc, linux-glibc-legacy, solaris, freebsd, openbsd, netbsd,
-#    cygwin, haiku, aix51, aix52, osx, generic, custom
+#    cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic, custom

 # Use CPU=<cpu_name> to optimize for a particular CPU, among the following  # 
list :
-#    generic, native, i586, i686, ultrasparc, custom
+#    generic, native, i586, i686, ultrasparc, power8, power9, custom
 CPU = generic

 #### Architecture, used when not building for native architecture @@ -257,6 
+257,8 @@
 CPU_CFLAGS.i586       = -O2 -march=i586
 CPU_CFLAGS.i686       = -O2 -march=i686
 CPU_CFLAGS.ultrasparc = -O6 -mcpu=v9 -mtune=ultrasparc
+CPU_CFLAGS.power8     = -O2 -mcpu=power8 -mtune=power8
+CPU_CFLAGS.power9     = -O2 -mcpu=power9 -mtune=power9
 CPU_CFLAGS            = $(CPU_CFLAGS.$(CPU))

 #### ARCH dependant flags, may be overridden by CPU flags @@ -381,7 +383,7 @@

-# AIX 5.2 and above
+# AIX 5.2
 ifeq ($(TARGET),aix52)
   set_target_defaults = $(call default_opts, \

+# AIX 7.2 and above
+ifeq ($(TARGET),aix72-gcc)
+  set_target_defaults = $(call default_opts, \
+  TARGET_LDFLAGS  = -latomic
 # Cygwin
 ifeq ($(TARGET),cygwin)
   set_target_defaults = $(call default_opts, \ @@ -754,7 +764,7 @@
  @echo "Please choose the target among the following supported list :"
  @echo "   linux-glibc, linux-glibc-legacy, solaris, freebsd, openbsd, netbsd,"
- @echo "   cygwin, haiku, aix51, aix52, osx, generic, custom"
+ @echo "   cygwin, haiku, aix51, aix52, aix72-gcc, osx, generic, custom"
  @echo "Use \"generic\" if you don't want any optimization, \"custom\" if you"
  @echo "want to precisely tweak every option, or choose the target which"
@@ -832,7 +842,7 @@
    else \
      echo "TARGET not set, you may pass 'TARGET=xxx' to set one among :";\
      echo "  linux-glibc, linux-glibc-legacy, solaris, freebsd, netbsd, osx,"; 
-     echo "  openbsd, aix51, aix52, cygwin, haiku, generic, custom"; \
+     echo "  openbsd, aix51, aix52, aix72-gcc, cygwin, haiku,
generic, custom"; \
  $(Q)echo;echo "Enabled features for TARGET '$(TARGET)' (disable with
'USE_xxx=') :"
  $(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),$(opt),)); echo "  $$*" | (fmt || cat) 2>/dev/null

The patch implements a new TARGET called aix72-gcc and also adds 2 CPUs (power8 
and power9). Here is my proof-of-work:

-bash-4.4$ gmake -j8 TARGET=aix72-gcc CPU=power8 USE_ZLIB=1 
ZLIB_LIB=/opt/haproxy/lib ZLIB_INC=/opt/haproxy/include USE_OPENSSL=1 
SSL_LIB=/opt/haproxy/lib SSL_INC=/opt/haproxy/include USE_PCRE2=1
USE_PCRE2_JIT=1 PCREDIR=/opt/haproxy USE_LUA=1 LUA_LIB=/opt/haproxy/lib 
LUA_INC=/opt/haproxy/include/lua LUA_LIB_NAME=lua LUA_LD_FLAGS= 
  CC      src/ev_poll.o
  CC      src/ssl_sock.o
  CC      src/hlua.o
  CC      src/hlua_fcn.o
  CC      src/mux_h2.o
  CC      src/stream.o
  CC      src/mux_fcgi.o
  CC      src/cfgparse-listen.o
src/hlua.c: In function 'hlua_panic_ljmp':
src/hlua.c:128:1: warning: no return statement in function returning non-void 
[-Wreturn-type]  static int hlua_panic_ljmp(lua_State *L) { 
longjmp(safe_ljmp_env, 1); }  ^~~~~~
  CC      src/http_ana.o
  CC      src/stats.o
  CC      src/mux_h1.o
  CC      src/flt_spoe.o
  CC      src/server.o
  CC      src/cfgparse.o
  CC      src/checks.o
  CC      src/backend.o
  CC      src/log.o
  CC      src/peers.o
  CC      src/cli.o
  CC      src/haproxy.o
  CC      src/stick_table.o
  CC      src/standard.o
  CC      src/sample.o
  CC      src/proxy.o
  CC      src/stream_interface.o
  CC      src/pattern.o
  CC      src/dns.o
  CC      src/proto_tcp.o
  CC      src/listener.o
  CC      src/cfgparse-global.o
  CC      src/h1.o
  CC      src/http_rules.o
  CC      src/http_fetch.o
  CC      src/cache.o
  CC      src/session.o
  CC      src/fcgi-app.o
  CC      src/connection.o
  CC      src/tcp_rules.o
  CC      src/filters.o
  CC      src/task.o
  CC      src/mworker.o
  CC      src/map.o
  CC      src/h1_htx.o
  CC      src/trace.o
  CC      src/flt_trace.o
  CC      src/acl.o
  CC      src/http_htx.o
  CC      src/flt_http_comp.o
  CC      src/payload.o
  CC      src/vars.o
  CC      src/debug.o
  CC      src/mux_pt.o
  CC      src/http_act.o
  CC      src/h2.o
  CC      src/queue.o
  CC      src/fd.o
  CC      src/proto_uxst.o
  CC      src/lb_chash.o
  CC      src/ring.o
  CC      src/frontend.o
  CC      src/raw_sock.o
  CC      src/xprt_handshake.o
  CC      src/htx.o
  CC      src/memory.o
  CC      src/applet.o
  CC      src/channel.o
  CC      src/signal.o
  CC      src/lb_fwrr.o
  CC      src/ev_select.o
  CC      src/sink.o
  CC      src/http_conv.o
  CC      src/proto_sockpair.o
  CC      src/mworker-prog.o
  CC      src/activity.o
  CC      src/lb_fwlc.o
  CC      src/http.o
  CC      src/lb_fas.o
  CC      src/uri_auth.o
  CC      src/hathreads.o
  CC      src/regex.o
  CC      src/auth.o
  CC      src/buffer.o
  CC      src/compression.o
  CC      src/proto_udp.o
  CC      src/lb_map.o
  CC      src/chunk.o
  CC      src/wdt.o
  CC      src/hpack-dec.o
  CC      src/action.o
  CC      src/xxhash.o
  CC      src/pipe.o
  CC      src/shctx.o
  CC      src/hpack-tbl.o
  CC      src/http_acl.o
  CC      src/sha1.o
  CC      src/time.o
  CC      src/hpack-enc.o
  CC      src/fcgi.o
  CC      src/arg.o
  CC      src/base64.o
  CC      src/protocol.o
  CC      src/freq_ctr.o
  CC      src/lru.o
  CC      src/hpack-huff.o
  CC      src/dict.o
  CC      src/hash.o
  CC      src/mailers.o
  CC      src/version.o
  CC      contrib/prometheus-exporter/service-prometheus.o
  CC      ebtree/ebtree.o
  CC      ebtree/eb32sctree.o
  CC      ebtree/eb32tree.o
  CC      ebtree/eb64tree.o
  CC      ebtree/ebmbtree.o
  CC      ebtree/ebsttree.o
  CC      ebtree/ebimtree.o
  CC      ebtree/ebistree.o
  LD      haproxy

-bash-4.4$ ./haproxy -vv
HA-Proxy version 2.1.2 2019/12/21 -
Status: stable branch - will stop receiving fixes around Q1 2021.
Known bugs:
Build options :
  TARGET  = aix72-gcc
  CPU     = power8
  CC      = gcc
  CFLAGS  = -O2 -mcpu=power8 -mtune=power8 -g -fno-strict-aliasing 
-Wdeclaration-after-statement -fwrapv -Wno-unused-label -Wno-sign-compare 
-Wno-unused-parameter -Wno-old-style-declaration -Wno-ignored-qualifiers 
-Wno-clobbered -Wno-missing-field-initializers -Wno-implicit-fallthrough 
-Wno-stringop-overflow -Wno-cast-function-type -Wtype-limits 
-Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference -D_H_XMEM -D_H_VAR


Default settings :
  bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with multi-threading support (MAX_THREADS=32, default=1).
Built with OpenSSL version : OpenSSL 1.1.1d  10 Sep 2019 Running on OpenSSL 
version : OpenSSL 1.1.1d  10 Sep 2019 OpenSSL library supports TLS extensions : 
yes OpenSSL library supports SNI : yes OpenSSL library supports : TLSv1.0 
TLSv1.1 TLSv1.2 TLSv1.3 Built with Lua version : Lua 5.3.5 Built with 
transparent proxy support using:
Built with PCRE2 version : 10.34 2019-11-21
PCRE2 library supports JIT : yes
Encrypted password support via crypt(3): yes Built with zlib version : 1.2.11 
Running on zlib version : 1.2.11 Compression algorithms supported : 
identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip") 
Built with the Prometheus exporter as a service

Available polling systems :
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 2 (2 usable), will use poll.

Available multiplexer protocols :
(protocols marked as <default> cannot be specified using 'proto' keyword)
              h2 : mode=HTTP       side=FE|BE     mux=H2
            fcgi : mode=HTTP       side=BE        mux=FCGI
       <default> : mode=HTTP       side=FE|BE     mux=H1
       <default> : mode=TCP        side=FE|BE     mux=PASS

Available services :

Available filters :
        [SPOE] spoe
        [CACHE] cache
        [FCGI] fcgi-app
        [TRACE] trace
        [COMP] compression

If you have any questions feel free to ask and please keep me on CC for this 

have a nice day,

Reply via email to