xen/build: introduce CLANG_FLAGS for testing other CFLAGS
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 29 May 2020 15:43:43 +0000 (16:43 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 17:58:21 +0000 (18:58 +0100)
commitfa0854478d0b2b64680e558db760851f6f1c6d16
tree7640dc9630012dde5afb71623adf26e295271bba
parent8e2aa76dc1670e82eaa15683353853bc66bf54fc
xen/build: introduce CLANG_FLAGS for testing other CFLAGS

Commit 534519f0514f ("xen: Have Kconfig check $(CC)'s version")
introduced the use of CLANG_FLAGS in Kconfig which is used when
testing for other CFLAGS via $(cc-option ...) but CLANG_FLAGS doesn't
exist in the Xen build system. (It's a Linux/Kbuild variable that
haven't been added yet.)

The missing CLANG_FLAGS isn't an issue for $(cc-option ..) but it
would be when $(as-instr ..) gets imported from Kbuild to tests
assembly instruction. We need to know if we are going to use clang's
assembler or not.

CLANG_FLAGS needs to be calculated before we call Kconfig.

So, this patch adds CLANG_FLAGS which may contain two flags which are
needed for further testing of $(CC)'s capabilities:
  -no-integrated-as
    This flags isn't new, but simply tested earlier so that it can be
    used in Kconfig. The flags is only added for x86 builds like
    before.
  -Werror=unknown-warning-option
    The one is new and is to make sure that the warning is enabled,
    even though it is by default but could be disabled in a particular
    build of clang, see Linux's commit e8de12fb7cde ("kbuild: Check
    for unknown options with cc-option usage in Kconfig and clang")

    It is present in clang 3.0.0, according Linux's commit
    589834b3a009 ("kbuild: Add -Werror=unknown-warning-option to
    CLANG_FLAGS").

(The "note" that say that the flags was only added once wasn't true
when tested on CentOS 6, so the patch uses $(or) and the flag will only
be added once.)

Fixes: 534519f0514f ("xen: Have Kconfig check $(CC)'s version")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/Makefile
xen/arch/x86/arch.mk