From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45754C433E0 for ; Wed, 3 Feb 2021 12:20:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0255C64F95 for ; Wed, 3 Feb 2021 12:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234378AbhBCMUV (ORCPT ); Wed, 3 Feb 2021 07:20:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbhBCMUT (ORCPT ); Wed, 3 Feb 2021 07:20:19 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5FE9C061573 for ; Wed, 3 Feb 2021 04:19:38 -0800 (PST) Received: from zn.tnic (p200300ec2f0c84005017455b058bf408.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:8400:5017:455b:58b:f408]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 35AC91EC047F; Wed, 3 Feb 2021 13:19:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1612354777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nj2ilHOLZKWctzV9AdEGYD+lgbpOZAlL7qxf96POKHE=; b=Hnv7ulWZLBwNx1QGEuQob+JDDNev4A5bkqRQKtXOYq+sXalhniywh/YQdkj8x1KFaFpc7K +h7I18QVnXdFFeDlDpEau431GbsmCkfVdqspNWZDWOgPCSxhSr9EgjJf40uRUNmJnC+XTu e+aacKqKwDtnhweC0AHbqKf4I9d23Yk= Date: Wed, 3 Feb 2021 13:19:34 +0100 From: Borislav Petkov To: John Millikin Cc: Nathan Chancellor , hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Thomas Gleixner , Ingo Molnar , John Millikin Subject: Re: [PATCH v2] arch/x86: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) Message-ID: <20210203121934.GC13819@zn.tnic> References: <37DE7046-5096-4C0C-A96D-FD168A849DFD@zytor.com> <20201226075347.GA1977841@ubuntu-m3-large-x86> <3b793c42-8983-4502-1f9e-729cc0ebec47@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3b793c42-8983-4502-1f9e-729cc0ebec47@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Dec 26, 2020 at 05:41:25PM +0900, John Millikin wrote: > When cross-compiling with Clang, the `$(CLANG_FLAGS)' variable > contains additional flags needed to build C and assembly sources > for the target platform. Normally this variable is automatically > included in `$(KBUILD_CFLAGS)' by via the top-level Makefile. > > The x86 real-mode makefile builds `$(REALMODE_CFLAGS)' from a > plain assignment and therefore drops the Clang flags. This causes > Clang to not recognize x86-specific assembler directives: > >   arch/x86/realmode/rm/header.S:36:1: error: unknown directive >   .type real_mode_header STT_OBJECT ; .size real_mode_header, .-real_mode_header >   ^ > > Explicit propagation of `$(CLANG_FLAGS)' to `$(REALMODE_CFLAGS)', > which is inherited by real-mode make rules, fixes cross-compilation > with Clang for x86 targets. > > Relevant flags: > > * `--target' sets the target architecture when cross-compiling. This >   flag must be set for both compilation and assembly (`KBUILD_AFLAGS') >   to support architecture-specific assembler directives. > > * `-no-integrated-as' tells clang to assemble with GNU Assembler >   instead of its built-in LLVM assembler. This flag is set by default >   unless `LLVM_IAS=1' is set, because the LLVM assembler can't yet >   parse certain GNU extensions. > > Signed-off-by: John Millikin > --- > Changes in v2: >   - Reworded the commit message to highlight that this is for >     cross-compilation. >   - Removed the `ifdef CONFIG_CC_IS_CLANG' guard. > >  arch/x86/Makefile | 1 + >  1 file changed, 1 insertion(+) > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 7116da3980be..412b849063ec 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -33,6 +33,7 @@ REALMODE_CFLAGS += -ffreestanding >  REALMODE_CFLAGS += -fno-stack-protector This one too: checking file arch/x86/Makefile patch: **** malformed patch at line 62:  REALMODE_CFLAGS += -fno-stack-protector -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette