mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Millikin <jmillikin@gmail.com>
To: hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org
Cc: clang-built-linux@googlegroups.com,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	John Millikin <john@john-millikin.com>
Subject: Re: [PATCH] arch/x86: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS)
Date: Sat, 26 Dec 2020 16:52:03 +0900	[thread overview]
Message-ID: <6008226d-3655-df9c-6842-8161de365ff7@gmail.com> (raw)
In-Reply-To: <37DE7046-5096-4C0C-A96D-FD168A849DFD@zytor.com>

On 12/26/20 16:35, hpa@zytor.com wrote:
> Why is CLANG_FLAGS non-null when unused? It would be better to centralize that.
CLANG_FLAGS normally propagates through inclusion in the default KBUILD_CFLAGS and KBUILD_AFLAGS, set in `/Makefile':

    # Makefile
    KBUILD_CFLAGS += $(CLANG_FLAGS)
    KBUILD_AFLAGS += $(CLANG_FLAGS)
    export CLANG_FLAGS

This default can be overridden by explicit assignment, as is done in some of the arch/x86 makefiles:

    # arch/x86/realmode/rm/Makefile
    KBUILD_CFLAGS    := $(REALMODE_CFLAGS) -D_SETUP -D_WAKEUP \
               -I$(srctree)/arch/x86/boot
    KBUILD_AFLAGS    := $(KBUILD_CFLAGS) -D__ASSEMBLY__
    KBUILD_CFLAGS    += -fno-asynchronous-unwind-tables

Since REALMODE_CFLAGS is being built up from a plain assignment, the Clang flags get lost. As a result Clang fails to compile the real-mode code when cross-compiling for an x86 target.

    arch/x86/realmode/rm/header.S:36:1: error: unknown directive
    .type real_mode_header STT_OBJECT ; .size real_mode_header, .-real_mode_header
    ^
    arch/x86/realmode/rm/header.S:36:37: error: unknown directive
    .type real_mode_header STT_OBJECT ; .size real_mode_header, .-real_mode_header
                                        ^
    arch/x86/realmode/rm/header.S:41:62: error: unknown directive
    .globl end_signature ; ; end_signature: ; .long 0x65a22c82 ; .type end_signature STT_OBJECT ; .size end_signature, .-end_signature
                                                                 ^
    arch/x86/realmode/rm/header.S:41:95: error: unknown directive
    .globl end_signature ; ; end_signature: ; .long 0x65a22c82 ; .type end_signature STT_OBJECT ; .size end_signature, .-end_signature
                                                                                                ^

This patch allows the Clang-specific flags to propagate through the REALMODE_CFLAGS variable set in `arch/x86/Makefile' and consumed by certain arch/x86 targets, which fixes cross-compilation of x86 kernels.

  reply	other threads:[~2020-12-26  7:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26  7:29 John Millikin
2020-12-26  7:35 ` hpa
2020-12-26  7:52   ` John Millikin [this message]
2020-12-26  7:53   ` Nathan Chancellor
2020-12-26  8:41     ` [PATCH v2] " John Millikin
2020-12-27  3:31       ` Nathan Chancellor
2021-02-03 12:19       ` Borislav Petkov
2021-02-03 12:24         ` Sedat Dilek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6008226d-3655-df9c-6842-8161de365ff7@gmail.com \
    --to=jmillikin@gmail.com \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=hpa@zytor.com \
    --cc=john@john-millikin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®