Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160926

FLAGS_COMPILER_CHECK_ARGUMENTS doesn't handle cross-compilation

    XMLWordPrintable

Details

    • b07
    • generic
    • generic

    Backports

      Description

        configure checks whether the compiler supports particular arguments e.g.

        FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror], IF_FALSE: [STACK_PROTECTOR_CFLAG=""])

        However, in situations where there is both a build and a target compiler, the only one that is checked is the one that is the current value of CXX.

        One case specifically works around this by calling FLAGS_COMPILER_CHECK_ARGUMENTS twice:

              FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
                  IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
                  IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
              )
        ...
              # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
              # CFLAGS since any target specific flags will likely not work with the
              # build compiler
              CC_OLD="$CC"
              CXX_OLD="$CXX"
              CC="$BUILD_CC"
              CXX="$BUILD_CXX"
              CFLAGS_OLD="$CFLAGS"
              CFLAGS=""
              FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
                  IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
                  IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
              )

        This really needs to be generalised into a macro that all such cases can use, to ensure both compilers are checked.

        The output should also make it clear that the two checks are different. Currently, it looks like this:

        checking if the C compiler supports "-Wno-this-is-a-warning-that-do-not-exist"... yes
        checking if the C++ compiler supports "-Wno-this-is-a-warning-that-do-not-exist"... yes
        checking if both compilers support "-Wno-this-is-a-warning-that-do-not-exist"... yes
        checking if the C compiler supports "-Wno-this-is-a-warning-that-do-not-exist"... yes
        checking if the C++ compiler supports "-Wno-this-is-a-warning-that-do-not-exist"... yes
        checking if both compilers support "-Wno-this-is-a-warning-that-do-not-exist"... yes

        which appears erroneous.

        Attachments

          Issue Links

            Activity

              People

                erikj Erik Joelsson
                andrew Andrew Hughes
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: