Details

    Description

      In order to build 10.2 and 10.3 on arm64, additional innodb files need to be built with -O0 when on 4.x gcc compiler, for example on centos7. The following patch includes the necessary fixes to the innobase CMakeLists.txt

      index d291f6f..299efe3 100644
      --- a/storage/innobase/CMakeLists.txt
      +++ b/storage/innobase/CMakeLists.txt
      @@ -175,7 +175,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
             btr/btr0btr.cc
             btr/btr0cur.cc
             buf/buf0buf.cc
      +      fts/fts0fts.cc
             gis/gis0sea.cc
      +      handler/handler0alter.cc
      +      row/row0mysql.cc
             COMPILE_FLAGS "-O0"
             )
         ENDIF()
      

      Attachments

        Activity

          What happens if they're not compiled with -O0 ?

          serg Sergei Golubchik added a comment - What happens if they're not compiled with -O0 ?

          Doesn't compile, so this will block buildbot once we get some additional servers for build / development. The patch simply expands the list of files that are compiled with no optimization for gcc < 5.2. It's a known compiler bug for arm64 and you get something like the following error:

          /root/server/storage/innobase/fts/fts0fts.cc: In function 'dberr_t fts_sync_index(fts_sync_t*, fts_index_cache_t*)':
          /root/server/storage/innobase/fts/fts0fts.cc:4035:1: error: could not split insn
           }
           ^
          (insn 627 1909 1426 (parallel [
                      (set (reg:DI 1 x1 [orig:138 D.112421 ] [138])
                          (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1  S8 A64]))
                      (set (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1  S8 A64])
                          (unspec_volatile:DI [
                                  (plus:DI (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1  S8 A64])
                                      (const_int 536870912 [0x20000000]))
                                  (const_int 5 [0x5])
                              ] UNSPECV_ATOMIC_OP))
                      (clobber (reg:CC 66 cc))
                      (clobber (reg:DI 2 x2))
                      (clobber (reg:SI 0 x0))
                  ]) /root/server/include/my_atomic.h:274 1831 {atomic_fetch_adddi}
               (expr_list:REG_UNUSED (reg:CC 66 cc)
                  (expr_list:REG_UNUSED (reg:DI 2 x2)
                      (expr_list:REG_UNUSED (reg:SI 0 x0)
                          (nil)))))
          /root/server/storage/innobase/fts/fts0fts.cc:4035:1: internal compiler error: in final_scan_insn, at final.c:2897
          Please submit a full bug report,
          with preprocessed source if appropriate.
          See <http://bugzilla.redhat.com/bugzilla> for instructions.
          

          dthompson David Thompson (Inactive) added a comment - Doesn't compile, so this will block buildbot once we get some additional servers for build / development. The patch simply expands the list of files that are compiled with no optimization for gcc < 5.2. It's a known compiler bug for arm64 and you get something like the following error: /root/server/storage/innobase/fts/fts0fts.cc: In function 'dberr_t fts_sync_index(fts_sync_t*, fts_index_cache_t*)': /root/server/storage/innobase/fts/fts0fts.cc:4035:1: error: could not split insn } ^ (insn 627 1909 1426 (parallel [ (set (reg:DI 1 x1 [orig:138 D.112421 ] [138]) (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1 S8 A64])) (set (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1 S8 A64]) (unspec_volatile:DI [ (plus:DI (mem/v:DI (reg/f:DI 19 x19 [orig:98 D.112432 ] [98]) [-1 S8 A64]) (const_int 536870912 [0x20000000])) (const_int 5 [0x5]) ] UNSPECV_ATOMIC_OP)) (clobber (reg:CC 66 cc)) (clobber (reg:DI 2 x2)) (clobber (reg:SI 0 x0)) ]) /root/server/include/my_atomic.h:274 1831 {atomic_fetch_adddi} (expr_list:REG_UNUSED (reg:CC 66 cc) (expr_list:REG_UNUSED (reg:DI 2 x2) (expr_list:REG_UNUSED (reg:SI 0 x0) (nil))))) /root/server/storage/innobase/fts/fts0fts.cc:4035:1: internal compiler error: in final_scan_insn, at final.c:2897 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions.
          danblack Daniel Black added a comment -

          dthompson as RHEL supports Arm64 I suggest lodging a bug at http://bugzilla.redhat.com/bugzilla and getting redhat to backport the appropriate compiler fix (it is their business model after all). make VERBOSE=1 and then take the failing compile line and add "-save-temps". Attach the .i* file to the bug report along with the compile line.
          From: https://gcc.gnu.org/bugs/

          danblack Daniel Black added a comment - dthompson as RHEL supports Arm64 I suggest lodging a bug at http://bugzilla.redhat.com/bugzilla and getting redhat to backport the appropriate compiler fix (it is their business model after all). make VERBOSE=1 and then take the failing compile line and add "-save-temps". Attach the .i* file to the bug report along with the compile line. From: https://gcc.gnu.org/bugs/

          I attempted to fine tune gcc flags:

          diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
          index c2d6144..3b3ec37 100644
          --- a/storage/innobase/CMakeLists.txt
          +++ b/storage/innobase/CMakeLists.txt
          @@ -164,19 +164,19 @@ ENDIF()
           
           INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
           # A GCC bug causes crash when compiling these files on ARM64 with -O1+
          -# Compile them with -O0 as a workaround.
          +# See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67143
           IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
             # Bug was fixed in GCC 5.2, so workaround only needed < 5.2
             EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
                             OUTPUT_VARIABLE GCC_VERSION)
             IF(GCC_VERSION VERSION_LESS 5.2)
          -    ADD_COMPILE_FLAGS(
          -      btr/btr0btr.cc
          -      btr/btr0cur.cc
          -      buf/buf0buf.cc
          -      gis/gis0sea.cc
          -      COMPILE_FLAGS "-O0"
          -      )
          +    ADD_COMPILE_FLAGS(btr/btr0btr.cc row/row0merge.cc srv/srv0srv.cc COMPILE_FLAGS "-fno-gcse")
          +    ADD_COMPILE_FLAGS(buf/buf0buf.cc COMPILE_FLAGS "-fno-gcse -fno-cse-follow-jumps")
          +    ADD_COMPILE_FLAGS(fts/fts0fts.cc COMPILE_FLAGS "-fno-gcse -fno-cse-follow-jumps -fno-ipa-cp-clone")
          +    ADD_COMPILE_FLAGS(gis/gis0sea.cc COMPILE_FLAGS "-O0")
          +    ADD_COMPILE_FLAGS(handler/handler0alter.cc COMPILE_FLAGS "-fno-gcse -fno-tree-dominator-opts")
          +    ADD_COMPILE_FLAGS(mtr/mtr0mtr.cc COMPILE_FLAGS "-fno-inline-functions")
          +    ADD_COMPILE_FLAGS(row/row0mysql.cc COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-ter")
             ENDIF()
           ENDIF()
           IF(MSVC)
          

          But it is quite fragile: every minor change to affected files may require adjusting these flags. Instead I've just added affected files as suggested in description.

          svoj Sergey Vojtovich added a comment - I attempted to fine tune gcc flags: diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index c2d6144..3b3ec37 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -164,19 +164,19 @@ ENDIF()   INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) # A GCC bug causes crash when compiling these files on ARM64 with -O1+ -# Compile them with -O0 as a workaround. +# See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67143 IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") # Bug was fixed in GCC 5.2, so workaround only needed < 5.2 EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) IF(GCC_VERSION VERSION_LESS 5.2) - ADD_COMPILE_FLAGS( - btr/btr0btr.cc - btr/btr0cur.cc - buf/buf0buf.cc - gis/gis0sea.cc - COMPILE_FLAGS "-O0" - ) + ADD_COMPILE_FLAGS(btr/btr0btr.cc row/row0merge.cc srv/srv0srv.cc COMPILE_FLAGS "-fno-gcse") + ADD_COMPILE_FLAGS(buf/buf0buf.cc COMPILE_FLAGS "-fno-gcse -fno-cse-follow-jumps") + ADD_COMPILE_FLAGS(fts/fts0fts.cc COMPILE_FLAGS "-fno-gcse -fno-cse-follow-jumps -fno-ipa-cp-clone") + ADD_COMPILE_FLAGS(gis/gis0sea.cc COMPILE_FLAGS "-O0") + ADD_COMPILE_FLAGS(handler/handler0alter.cc COMPILE_FLAGS "-fno-gcse -fno-tree-dominator-opts") + ADD_COMPILE_FLAGS(mtr/mtr0mtr.cc COMPILE_FLAGS "-fno-inline-functions") + ADD_COMPILE_FLAGS(row/row0mysql.cc COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-ter") ENDIF() ENDIF() IF(MSVC) But it is quite fragile: every minor change to affected files may require adjusting these flags. Instead I've just added affected files as suggested in description.

          People

            svoj Sergey Vojtovich
            dthompson David Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.