Welcome to Centmin Mod Community
Register Now

Beta Branch Testing GCC 8 & Clang 5/6 compiler for Centmin Mod Nginx & PHP-FPM

Discussion in 'Beta release code' started by eva2000, Jan 14, 2018.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    Like GCC 7 and Clang 4/5 testing previously, I am also starting to test optional support for using GCC 8 compiler for compiling Nginx and PHP-FPM with eventually. Currently, there's no YUM packages for GCC 8 as it's still in development. But I am testing GCC 8 snapshot releases. Updated: Clang 5.0.1 and Clang 6.0.0 coming along nicely too.

    Example of Binutils 2.29.1 and GCC 8 snapshot installed
    Code (Text):
    *************************************************
    * Setup /opt/gcc-8-20180107/enable
    *************************************************
    
    *************************************************
    * Setup /opt/gcc-8-20180107/enable completed
    *************************************************
    
    /opt/gcc-8-20180107/bin/ld -v
    GNU ld (GNU Binutils) 2.29.1
    
    /opt/gcc-8-20180107/bin/ld.gold -v
    GNU gold (GNU Binutils 2.29.1) 1.14
    
    /opt/gcc-8-20180107/bin/ld.bfd -v
    GNU ld (GNU Binutils) 2.29.1
    
    /opt/gcc-8-20180107/bin/gcc --version
    gcc (GCC) 8.0.0 20180107 (experimental)
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    /opt/gcc-8-20180107/bin/g++ --version
    g++ (GCC) 8.0.0 20180107 (experimental)
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    *************************************************
    * Compile GCC Completed
    *************************************************
    

    symlink to make it easier to detect for Nginx and PHP-FPM compiles
    Code (Text):
    ls -lah /opt/gcc8
    lrwxrwxrwx 1 root root 19 Jan 14 02:22 /opt/gcc8 -> /opt/gcc-8-20180107
    

    Code (Text):
    /opt/gcc8/bin/gcc -v
    Using built-in specs.
    COLLECT_GCC=/opt/gcc8/bin/gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-8-20180107/libexec/gcc/x86_64-redhat-linux/8.0.0/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-8-20180107 --disable-multilib --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 8.0.0 20180107 (experimental) (GCC)
    

    Though right now Nginx fails to compile with GCC 8 installed - so some ways to go before we will see it working. So more private testing :)
    Code (Text):
    ./configure --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib" --with-cc-opt="-m64 -march=native -g -O3 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security  -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf" --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-compat --with-http_stub_status_module --with-http_secure_link_module --with-libatomic --with-http_gzip_static_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module --with-stream_geoip_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --with-stream=dynamic --with-stream_ssl_module --with-http_realip_module --add-dynamic-module=../ngx-fancyindex-0.4.2 --add-module=../ngx_cache_purge-2.4.2 --add-module=../ngx_devel_kit-0.3.0 --add-dynamic-module=../set-misc-nginx-module-0.31 --add-dynamic-module=../echo-nginx-module-0.61 --add-module=../redis2-nginx-module-0.14 --add-module=../ngx_http_redis-0.3.7 --add-module=../memc-nginx-module-0.18 --add-module=../srcache-nginx-module-0.31 --add-dynamic-module=../headers-more-nginx-module-0.33 --with-pcre=../pcre-8.41 --with-pcre-jit --with-zlib=../zlib-1.2.11 --with-http_ssl_module --with-http_v2_module --with-openssl=../libressl-2.6.4
    checking for OS
     + Linux 2.6.32-042stab120.19 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 8.0.0 20180107 (experimental) (GCC)
    checking for gcc -pipe switch ... found
    checking for --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib" ... not found
    ./configure: error: the invalid value in --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib"
    

    nginx error log
    Code (Text):
    cat /svr-setup/nginx-1.13.8/objs/autoconf.err
    
    ----------------------------------------
    checking for C compiler
    
    ----------------------------------------
    checking for gcc -pipe switch
    
    ----------------------------------------
    checking for --with-ld-opt="-lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib"
    
    objs/autotest.c:9:1: internal compiler error: Segmentation fault
     }
     ^
    0xb0eadf crash_signal
            ../../gcc/toplev.c:325
    0x873f6b hash_table<indirect_string_hasher, xcallocator>::elements() const
            ../../gcc/hash-table.h:388
    0x873f6b void hash_table<indirect_string_hasher, xcallocator>::traverse<dwarf_form, &(output_indirect_string(indirect_string_node**, dwarf_form))>(dwarf_form)
            ../../gcc/hash-table.h:987
    0x841748 output_indirect_strings
            ../../gcc/dwarf2out.c:27799
    0x8725d2 dwarf2out_early_finish
            ../../gcc/dwarf2out.c:30894
    0x7f4fe8 symbol_table::finalize_compilation_unit()
            ../../gcc/cgraphunit.c:2713
    Please submit a full bug report,
    with preprocessed source if appropriate.
    Please include the complete backtrace with any bug report.
    See <https://gcc.gnu.org/bugs/> for instructions.
    ----------
    #include <sys/types.h>
    
    int main(void) {
        ;
        return 0;
    }
    
    ----------
    ccache gcc -m64 -march=native -g -O3 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf -o objs/autotest objs/autotest.c -lrt -ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib
    ----------
    

    no problems with GCC 7.2.1 though
     
  2. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    Looks like Nginx doesn't like to be compiled with GCC 8 when -gsplit-dwarf parameter was set. Could be a GCC 8 regression bug since it's stilll in development. That got me past the internal compiler error segmentation fault above. But ran into more errors hanging up on -Werror=cast-function-type related warnings so need to add another compile flag to Nginx compile routines when GCC 8 is used for -Wno-cast-function-type
    Code (Text):
    ccache gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -m64 -march=x86-64 -g -O3 -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security  -Wp,-D_FORTIFY_SOURCE=2 -DNDK_SET_VAR -DNDK_UPSTREAM_LIST -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_devel_kit-0.3.0/objs -I objs/addon/ndk -I ../pcre-8.41 -I ../libressl-2.6.4/.openssl/include -I ../zlib-1.2.11 -I objs -I src/http -I src/http/modules -I src/http/v2 -I ../ngx_devel_kit-0.3.0/src -I ../ngx_devel_kit-0.3.0/src -I ../ngx_devel_kit-0.3.0/objs -I objs/addon/ndk \
            -o objs/src/http/ngx_http_upstream.o \
            src/http/ngx_http_upstream.c
    src/http/ngx_http_script.c: In function 'ngx_http_script_add_copy_code':
    src/http/ngx_http_script.c:698:18: error: cast between incompatible function types from 'size_t (*)(ngx_http_script_engine_t *)' {aka 'long unsigned int (*)(struct <anonymous> *)'} to 'void (*)(ngx_http_script_engine_t *)' {aka 'void (*)(struct <anonymous> *)'} [-Werror=cast-function-type]
         code->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
                      ^
    src/http/ngx_http_script.c: In function 'ngx_http_script_add_var_code':
    src/http/ngx_http_script.c:787:18: error: cast between incompatible function types from 'size_t (*)(ngx_http_script_engine_t *)' {aka 'long unsigned int (*)(struct <anonymous> *)'} to 'void (*)(ngx_http_script_engine_t *)' {aka 'void (*)(struct <anonymous> *)'} [-Werror=cast-function-type]
         code->code = (ngx_http_script_code_pt) ngx_http_script_copy_var_len_code;
                      ^
    src/http/ngx_http_script.c: In function 'ngx_http_script_add_capture_code':
    src/http/ngx_http_script.c:1181:18: error: cast between incompatible function types from 'size_t (*)(ngx_http_script_engine_t *)' {aka 'long unsigned int (*)(struct <anonymous> *)'} to 'void (*)(ngx_http_script_engine_t *)' {aka 'void (*)(struct <anonymous> *)'} [-Werror=cast-function-type]
         code->code = (ngx_http_script_code_pt)
                      ^
    src/http/ngx_http_script.c: In function 'ngx_http_script_add_full_name_code':
    src/http/ngx_http_script.c:1296:18: error: cast between incompatible function types from 'size_t (*)(ngx_http_script_engine_t *)' {aka 'long unsigned int (*)(struct <anonymous> *)'} to 'void (*)(ngx_http_script_engine_t *)' {aka 'void (*)(struct <anonymous> *)'} [-Werror=cast-function-type]
         code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code;
                      ^
    cc1: all warnings being treated as errors
    make[1]: *** [objs/src/http/ngx_http_script.o] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make[1]: Leaving directory `/svr-setup/nginx-1.13.8'
    make: *** [build] Error 2
    

    Looking much better with workaround for GCC 8 compiled Nginx. First successful Nginx + GCC 8 compilation :D

    with LibreSSL 2.6.4
    with OpenSSL 1.1.0g and setting variable LIBRESSL_SWITCH='n' in persistent config file /etc/centminmod/custom_config.inc prior to Nginx compile via centmin.sh menu option 4
     
    • Like Like x 1
  3. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5

    Guide To GCC & Clang Compiler Selection For Nginx Installs



    Centmin Mod 123.09beta01 LEMP stack can allow users to optionally select their own choice of compilers for Nginx and PHP-FPM. Below is example for Nginx where you can choose between native CentOS GCC version, GCC 5.3.1, GCC 6.3.1, GCC 7.2.1, Clang 3.4.2, Clang 4.0.1 and soon GCC 8.0 and Clang 5.0. As discussed here, depending on pairing of compiler and specific cpu model, you can get better Nginx or PHP-FPM performance usually between 5-10%. Which may offset some of the performance loss due to Linux Kernel Page Table Isolation updates to fix Meltdown/Spectre vulnerabilities :)

    Blow is a list of persisent config file /etc/centminmod/custom_config.inc variables controlling which compiler and version is used for GCC or Clang compilers with Nginx + switching from default LibreSSL 2.6.4 to OpenSSL 1.1.0g. You set these variables BEFORE you run centmin.sh menu option 4 to recompile your Nginx versions.

    You can check nginx -V output's built by line for details.

    For GCC 8.0 - note experimental and not enabled in public Centmin Mod 123.09beta01 code yet and undergoing private testing right now.
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='y'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 7.2.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='y'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 6.3.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='y'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 5.3.1
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

    For GCC 4.8.5 native CentOS 7.4 OS provided
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='n'
    

    For Clang 3.4.2
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='n'
    

    For Clang 4.0.1 add CLANG_FOUR='y'
    Code (Text):
    LIBRESSL_SWITCH='n'
    CLANG_FOUR='y'
    CLANG='y'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    NGINX_DEVTOOLSETGCC='y'
    

     
  4. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    Doing some quick Siege static web serving benchmarks on 2 cpu thread OpenVZ VPS server which sports an Intel E5-1650v3 @3.50Ghz processor running Centmin Mod 123.09beta01 on CentOS 7.4 64bit.

    Siege test paramaters and changing comment marker for each respective GCC version tested
    Code (Text):
    comment='gcc8'
    siege -b -d1s -c100 -r500 -m $comment http://localhost | tee "siege-${comment}-$(date +"%d%m%y-%H%M%S").log"
    

    Results running each Nginx + GCC pairing through 3x runs of Siege benchmarking and average of 3 runs shown.

    Notes:
    • These are just quick tests as the results aren't entirely accurate as you probably need to do more than 3x runs and being on OpenVZ virtualized server means you're subject to noisy neighbours and resource contention still.
    • Do not take these results as gospel as performance depends on your compiler + cpu model pairing. You may have a different cpu model and that may perform differently to below results. Finding the right compiler + cpu pairing is part of the fun :D

    siege-chart-gcc8-nginx-140118-01.png
     
  5. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    New January 14th, 2018 snapshot of GCC 8 has been released so started building that for testing including building a custom RPM. Moved build testing to my OVH MC-32 i7 4790K 4C/8T dedicated server for faster compile times.

    Just the GCC 8 build task ~1534 seconds - it was this fast as Centmin Mod uses compiler caching via ccache, so subsequent recompiles are faster.

    Code (Text):
    *************************************************
    Setup /opt/gcc-8-20180114/enable
    *************************************************
    
    *************************************************
    Setup /opt/gcc-8-20180114/enable completed
    *************************************************
    
    /opt/gcc-8-20180114/bin/ld -v
    GNU ld (GNU Binutils) 2.29.1
    
    /opt/gcc-8-20180114/bin/ld.gold -v
    GNU gold (GNU Binutils 2.29.1) 1.14
    
    /opt/gcc-8-20180114/bin/ld.bfd -v
    GNU ld (GNU Binutils) 2.29.1
    
    /opt/gcc-8-20180114/bin/gcc --version
    gcc (GCC) 8.0.0 20180114 (experimental)
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    
    /opt/gcc-8-20180114/bin/g++ --version
    g++ (GCC) 8.0.0 20180114 (experimental)
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    
    RPMs Built
    
    /svr-setup/gcc-8-20180114/test/gcc-all-8.0-1.x86_64.rpm
    
    *************************************************
    Compile GCC Completed
    log: /root/centminlogs/tools-gcc-install_160118-181920.log
    *************************************************
    
    Total GCC Install Time: 1534.884407254 seconds
    

    Code (Text):
    /opt/gcc8/bin/gcc -v
    Using built-in specs.
    COLLECT_GCC=/opt/gcc8/bin/gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-8-20180114/libexec/gcc/x86_64-redhat-linux/8.0.0/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-8-20180114 --disable-multilib --enable-shared --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-install-libiberty --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux --enable-lto --enable-gold
    Thread model: posix
    gcc version 8.0.0 20180114 (experimental) (GCC)
    

    ccache compiler caching stats - had to bump up cache allocation from default 2GB to 8GB
    Code (Text):
    ccache -s
    cache directory                     /home/.ccache
    primary config                      /home/.ccache/ccache.conf
    secondary config      (readonly)    /usr/local/etc/ccache.conf
    cache hit (direct)                418866
    cache hit (preprocessed)           71518
    cache miss                        199055
    cache hit rate                     71.13 %
    called for link                    60404
    called for preprocessing           24744
    multiple source files                 16
    compiler produced empty output         3
    compile failed                      7202
    ccache internal error               3932
    preprocessor error                  4233
    bad compiler arguments              7022
    unsupported source language           30
    autoconf compile/link              70493
    unsupported compiler option          428
    unsupported code directive             6
    no input file                      17476
    cleanups performed                   238
    files in cache                    168818
    cache size                           2.4 GB
    max cache size                       8.0 GB
    


    Resulting Centmin Mod Nginx compiled with GCC 8 Jan 14, 2018 snapshot

    GCC Retpoline Patches For Spectre Variant 2



    The Jan 14th, 2018 GCC 8 snapshot adds the new GCC Retpoline patches to address Spectre variant 2 vulnerabilities. I confirmed they exist in my custom build GCC 8 RPM binary installations.

    For Intel i7 4790K native supported options now show the 3 new options for -mindirect-branch, -mindirect-return and -mindirect-branch-register
    Code (Text):
    /opt/gcc8/bin/gcc -c -Q -march=native --help=target
    The following options are target specific:
      -m128bit-long-double                  [enabled]
      -m16                                  [disabled]
      -m32                                  [disabled]
      -m3dnow                               [disabled]
      -m3dnowa                              [disabled]
      -m64                                  [enabled]
      -m80387                               [enabled]
      -m8bit-idiv                           [disabled]
      -m96bit-long-double                   [disabled]
      -mabi=                                sysv
      -mabm                                 [enabled]
      -maccumulate-outgoing-args            [disabled]
      -maddress-mode=                       long
      -madx                                 [disabled]
      -maes                                 [enabled]
      -malign-data=                         compat
      -malign-double                        [disabled]
      -malign-functions=                    0
      -malign-jumps=                        0
      -malign-loops=                        0
      -malign-stringops                     [enabled]
      -mandroid                             [disabled]
      -march=                               haswell
      -masm=                                att
      -mavx                                 [enabled]
      -mavx2                                [enabled]
      -mavx256-split-unaligned-load         [disabled]
      -mavx256-split-unaligned-store        [disabled]
      -mavx5124fmaps                        [disabled]
      -mavx5124vnniw                        [disabled]
      -mavx512bitalg                        [disabled]
      -mavx512bw                            [disabled]
      -mavx512cd                            [disabled]
      -mavx512dq                            [disabled]
      -mavx512er                            [disabled]
      -mavx512f                             [disabled]
      -mavx512ifma                          [disabled]
      -mavx512pf                            [disabled]
      -mavx512vbmi                          [disabled]
      -mavx512vbmi2                         [disabled]
      -mavx512vl                            [disabled]
      -mavx512vnni                          [disabled]
      -mavx512vpopcntdq                     [disabled]
      -mbionic                              [disabled]
      -mbmi                                 [enabled]
      -mbmi2                                [enabled]
      -mbranch-cost=<0,5>                   3
      -mcall-ms2sysv-xlogues                [disabled]
      -mcet                                 [disabled]
      -mcet-switch                          [disabled]
      -mcld                                 [disabled]
      -mclflushopt                          [disabled]
      -mclwb                                [disabled]
      -mclzero                              [disabled]
      -mcmodel=                             [default]
      -mcpu=                         
      -mcrc32                               [disabled]
      -mcx16                                [enabled]
      -mdispatch-scheduler                  [disabled]
      -mdump-tune-features                  [disabled]
      -mf16c                                [enabled]
      -mfancy-math-387                      [enabled]
      -mfentry                              [disabled]
      -mfma                                 [enabled]
      -mfma4                                [disabled]
      -mforce-drap                          [disabled]
      -mforce-indirect-call                 [disabled]
      -mfp-ret-in-387                       [enabled]
      -mfpmath=                             sse
      -mfsgsbase                            [enabled]
      -mfunction-return=                    keep
      -mfused-madd                   
      -mfxsr                                [enabled]
      -mgeneral-regs-only                   [disabled]
      -mgfni                                [disabled]
      -mglibc                               [enabled]
      -mhard-float                          [enabled]
      -mhle                                 [enabled]
      -miamcu                               [disabled]
      -mibt                                 [disabled]
      -mieee-fp                             [enabled]
      -mincoming-stack-boundary=            0
      -mindirect-branch-register            [disabled]
      -mindirect-branch=                    keep
      -minline-all-stringops                [disabled]
      -minline-stringops-dynamically        [disabled]
      -mintel-syntax                 
      -mlarge-data-threshold=<number>       65536
      -mlong-double-128                     [disabled]
      -mlong-double-64                      [disabled]
      -mlong-double-80                      [enabled]
      -mlwp                                 [disabled]
      -mlzcnt                               [enabled]
      -mmemcpy-strategy=             
      -mmemset-strategy=             
      -mmitigate-rop                        [disabled]
      -mmmx                                 [enabled]
      -mmovbe                               [enabled]
      -mmpx                                 [disabled]
      -mms-bitfields                        [disabled]
      -mmusl                                [disabled]
      -mmwaitx                              [disabled]
      -mno-align-stringops                  [disabled]
      -mno-default                          [disabled]
      -mno-fancy-math-387                   [disabled]
      -mno-push-args                        [disabled]
      -mno-red-zone                         [disabled]
      -mno-sse4                             [disabled]
      -mnop-mcount                          [disabled]
      -momit-leaf-frame-pointer             [disabled]
      -mpc32                                [disabled]
      -mpc64                                [disabled]
      -mpc80                                [disabled]
      -mpclmul                              [enabled]
      -mpcommit                             [disabled]
      -mpku                                 [disabled]
      -mpopcnt                              [enabled]
      -mprefer-avx128                 
      -mprefer-vector-width=                none
      -mpreferred-stack-boundary=           0
      -mprefetchwt1                         [disabled]
      -mprfchw                              [disabled]
      -mpush-args                           [enabled]
      -mrdpid                               [disabled]
      -mrdrnd                               [enabled]
      -mrdseed                              [disabled]
      -mrecip                               [disabled]
      -mrecip=                       
      -mrecord-mcount                       [disabled]
      -mred-zone                            [enabled]
      -mregparm=                            6
      -mrtd                                 [disabled]
      -mrtm                                 [disabled]
      -msahf                                [enabled]
      -msgx                                 [disabled]
      -msha                                 [disabled]
      -mshstk                               [disabled]
      -mskip-rax-setup                      [disabled]
      -msoft-float                          [disabled]
      -msse                                 [enabled]
      -msse2                                [enabled]
      -msse2avx                             [disabled]
      -msse3                                [enabled]
      -msse4                                [enabled]
      -msse4.1                              [enabled]
      -msse4.2                              [enabled]
      -msse4a                               [disabled]
      -msse5                         
      -msseregparm                          [disabled]
      -mssse3                               [enabled]
      -mstack-arg-probe                     [disabled]
      -mstack-protector-guard-offset= 
      -mstack-protector-guard-reg=   
      -mstack-protector-guard-symbol= 
      -mstack-protector-guard=              tls
      -mstackrealign                        [disabled]
      -mstringop-strategy=                  [default]
      -mstv                                 [enabled]
      -mtbm                                 [disabled]
      -mtls-dialect=                        gnu
      -mtls-direct-seg-refs                 [enabled]
      -mtune-ctrl=                   
      -mtune=                               haswell
      -muclibc                              [disabled]
      -mvaes                                [disabled]
      -mveclibabi=                          [default]
      -mvect8-ret-in-mem                    [disabled]
      -mvpclmulqdq                          [disabled]
      -mvzeroupper                          [enabled]
      -mx32                                 [disabled]
      -mxop                                 [disabled]
      -mxsave                               [enabled]
      -mxsavec                              [disabled]
      -mxsaveopt                            [enabled]
      -mxsaves                              [disabled]
    
      Known assembler dialects (for use with the -masm= option):
        att intel
    
      Known ABIs (for use with the -mabi= option):
        ms sysv
    
      Known code models (for use with the -mcmodel= option):
        32 kernel large medium small
    
      Valid arguments to -mfpmath=:
        387 387+sse 387,sse both sse sse+387 sse,387
    
      Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
        keep thunk thunk-extern thunk-inline
    
      Known data alignment choices (for use with the -malign-data= option):
        abi cacheline compat
    
      Known vectorization library ABIs (for use with the -mveclibabi= option):
        acml svml
    
      Known address mode (for use with the -maddress-mode= option):
        long short
    
      Known preferred register vector length (to use with the -mprefer-vector-width= option)
        128 256 512 none
    
      Known stack protector guard (for use with the -mstack-protector-guard= option):
        global tls
    
      Valid arguments to -mstringop-strategy=:
        byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop
        vector_loop
    
      Known TLS dialects (for use with the -mtls-dialect= option):
        gnu gnu2
    

    note the output for
    Code (Text):
    /opt/gcc8/bin/gcc -c -Q -march=native --help=target | egrep 'indirect|function-return'
      -mforce-indirect-call                    [disabled]
      -mfunction-return=                       keep
      -mindirect-branch-register               [disabled]
      -mindirect-branch=                       keep
      Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
    

    Code (Text):
      Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
        keep thunk thunk-extern thunk-inline
    


    From Benchmarking Linux With The Retpoline Patches For Spectre - Phoronix
    GCC 8 Patches Posted For Spectre Mitigation - Phoronix
    Benchmarks from Phoronix for GCC 8 new patches Benchmarking Retpoline-Enabled GCC 8 With -mindirect-branch=thunk - Phoronix

     
    Last edited: Jan 17, 2018
    • Like Like x 1
  6. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5

    Test Building GCC 7.2.1 & GCC 8.0 RPMs



    Been busy perfecting my GCC 7/8 + Binutils compilation configurations and custom RPM builds specifically for CentOS 7 64bit OS for now. Just like PHP 7 which supports Profile Guided Optimizations (PGO) to boost PHP 7 performance, GCC can be built with PGO as well for better than stock build performance. GCC can also be built with Link Time Optimization (LTO).

    So I have scripted building both GCC 7 and GCC 8 with RPMs with PGO + LTO and RPMs without PGO + LTO. Building GCC with PGO + LTO increases compilation times by ~20-25% on Intel Core i7 4790K but result in better performing GCC binaries which in turn if used to build apps i.e. using resulting GCC binary to build Centmin Mod Nginx binary, can in theory result in better Nginx performance. Haven't benchmark tested the improvements yet but from what I have seen it's between ~7-10% improvement :)

    Build both GCC 7 & GCC 8 RPMs (both PGO + non-PGO) and accompanying Binutils RPMs all at once
    Code (Text):
    -rw-r--r--   1 root  root  5.2M Jan 20 13:24 binutils-gcc7-2.29.1-1.el7.x86_64.rpm
    -rw-r--r--   1 root  root  5.2M Jan 20 12:17 binutils-gcc8-2.29.1-1.el7.x86_64.rpm
    -rw-r--r--   1 root  root   33M Jan 20 16:41 gcc7-7.2.1-1.el7.x86_64.rpm
    -rw-r--r--   1 root  root   37M Jan 20 17:09 gcc7-pgo-7.2.1-1.el7.x86_64.rpm
    -rw-r--r--   1 root  root   36M Jan 20 16:09 gcc8-8.0-1.el7.x86_64.rpm
    -rw-r--r--   1 root  root   41M Jan 20 17:46 gcc8-pgo-8.0-1.el7.x86_64.rpm
    


    GCC 7
    Code (Text):
    /opt/gcc7/bin/gcc -v
    Using built-in specs.
    COLLECT_GCC=/opt/gcc7/bin/gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-7-20180111/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-7-20180111 --disable-multilib --enable-bootstrap --enable-plugin --with-gcc-major-version-only --enable-shared --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-install-libiberty --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux --enable-lto --enable-gold
    Thread model: posix
    gcc version 7.2.1 20180111 (GCC)
    

    Code (Text):
    /opt/gcc7/bin/ld.gold -v
    GNU gold (GNU Binutils 2.29.1) 1.14
    


    GCC 8
    Code (Text):
    /opt/gcc8/bin/gcc -v 
    Using built-in specs.
    COLLECT_GCC=/opt/gcc8/bin/gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-8-20180114/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-8-20180114 --disable-multilib --enable-bootstrap --enable-plugin --with-gcc-major-version-only --enable-shared --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-install-libiberty --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux --enable-lto --enable-gold
    Thread model: posix
    gcc version 8.0.0 20180114 (experimental) (GCC)
    

    Code (Text):
    /opt/gcc8/bin/ld.gold -v
    GNU gold (GNU Binutils 2.29.1) 1.14
    


    Compiling GCC is very time consuming though not as complicated and as time consuming as compiling for Clang 4/5 compilers. My OVH i7 4790K was kept quite busy from below stats :D

    nixstats-install-all.sh-190118-03.png
    nixstats-install-all.sh-190118-04.png
     
    • Winner Winner x 1
  7. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    Latest GCC 8.0.1 20180304 built RPMs with Profile Guided Optimizations + LTO + Gold Linker :)

    Code (Text):
    /opt/gcc-8-20180304/bin/gcc -v
    Using built-in specs.
    COLLECT_GCC=/opt/gcc-8-20180304/bin/gcc
    COLLECT_LTO_WRAPPER=/opt/gcc-8-20180304/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/opt/gcc-8-20180304 --disable-multilib --enable-bootstrap --enable-plugin --with-gcc-major-version-only --enable-shared --disable-nls --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-install-libiberty --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++ --enable-initfini-array --disable-libgcj --enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux --enable-lto --enable-gold
    Thread model: posix
    gcc version 8.0.1 20180304 (experimental) (GCC)
    

    Code (Text):
    RPMs Built
    /svr-setup/binutils-gcc8-2.30-1.el7.x86_64.rpm
    /svr-setup/gcc8-pgo-8.0-1.el7.x86_64.rpm
    
    ls -lah /svr-setup | egrep 'gcc8-pgo-8.0|binutils-gcc8-2.30'
    -rw-r--r--    1 root      root       5.3M Mar  7 21:48 binutils-gcc8-2.30-1.el7.x86_64.rpm
    -rw-r--r--    1 root      root        38M Mar  7 22:27 gcc8-pgo-8.0-1.el7.x86_64.rpm
    
    Installed Packages
    Name        : binutils-gcc8
    Arch        : x86_64
    Version     : 2.30
    Release     : 1.el7
    Size        : 48 M
    Repo        : installed
    Summary     : binutils-gcc8 for centminmod.com LEMP stack installs
    URL         : https://centminmod.com
    License     : unknown
    Description : binutils-gcc8 for centminmod.com LEMP stacks
    
    
    * Wed Mar 07 2018 George Liu <centminmod.com> 2.30
    - Binutils 2.30 for centminmod.com LEMP stack installs
    

    Code (Text):
    Installed Packages
    Name        : gcc8-pgo
    Arch        : x86_64
    Version     : 8.0
    Release     : 1.el7
    Size        : 287 M
    Repo        : installed
    Summary     : gcc8-pgo for centminmod.com LEMP stack installs
    URL         : https://centminmod.com
    License     : unknown
    Description : gcc8-pgo for centminmod.com LEMP stacks
    
    
    * Wed Mar 07 2018 George Liu <centminmod.com> 8
    - GCC 8 for centminmod.com LEMP stack installs
    

    Test compile Nginx 1.13.9 with GCC 8.0.1 20180304 date snapshot + OpenSSL 1.1.1-pre2 beta for TLSv1.3 support
     
    • Like Like x 1
  8. eva2000

    eva2000 Administrator Staff Member

    33,704
    7,465
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,476
    Local Time:
    4:19 AM
    Nginx 1.13.x
    MariaDB 5.5
    Latest source compiled Clang 4.0.1, 5.0.1 and 6.0.0 compilers builds :)

    Clang 6.0.0 compiler built Centmin Mod Nginx 1.13.9 web server :D Unfortunately, some compatibility issues with Clang 6.0.0 and Cloudflare zlib forked library so have to switch back to standard zlib 1.2.11 library and Clang 6.0.0 throws up an error with OpenSSL 1.1.1-pre2 beta crypto library so using OpenSSL 1.1.0g stable
    Code (Text):
    /opt/sbin/llvm-release_60/bin/clang -v
    clang version 6.0.0 (branches/release_60 326962)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /opt/sbin/llvm-release_60/bin
    Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1
    Found candidate GCC installation: /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
    Selected GCC installation: /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1
    Candidate multilib: .;@m64
    Candidate multilib: 32;@m32
    Selected multilib: .;@m64
    

    Code (Text):
    /opt/sbin/llvm-release_50/bin/clang -v
    clang version 5.0.1 (branches/release_50 326959)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /opt/sbin/llvm-release_50/bin
    Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1
    Found candidate GCC installation: /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
    Selected GCC installation: /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.3.1
    Candidate multilib: .;@m64
    Candidate multilib: 32;@m32
    Selected multilib: .;@m64
    

    Code (Text):
    /opt/sbin/llvm-release_40/bin/clang -v
    clang version 4.0.1 (branches/release_40 326956)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /opt/sbin/llvm-release_40/bin
    Found candidate GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
    Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
    Selected GCC installation: /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1
    Candidate multilib: .;@m64
    Candidate multilib: 32;@m32
    Selected multilib: .;@m64
    
     
    • Informative Informative x 1
..
Thread Status:
Not open for further replies.