Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp237847pxb; Wed, 3 Feb 2021 04:28:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdiojHD6u7ed2PcfR28J+V0K4m4QelI3gnwn74tLGuLlJeSZHUEkHpdfT4gEpzSuJp6BCe X-Received: by 2002:a17:906:af6b:: with SMTP id os11mr2967730ejb.472.1612355309507; Wed, 03 Feb 2021 04:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612355309; cv=none; d=google.com; s=arc-20160816; b=rKTBvTHCjBZmJb9OWm27f8jZq4j0Q6s/l3zN6XuSYvwf4VuSm6QXZXoq5Z0z9R18Hn oIAqBUUuhTSMy4qsJh+supecNpCJ++bbm33+3cjPp+Ju0F7K3WRuXZsh1fxDE+U9uhz/ ZD8TGhpckoRUT5Mu4kjRhrSvnwaUiti8QJHzFp3+TmtBpx7RIqzXQS9eHxp5d+zZWX06 +5kDjBIxxEAyoPghfs4adT2HaiisgO8IPJq4VRvobys8pJH17yYKZ3NMqAzRLI1MuRW1 leCfgZtDyFZdNN7BoXoySjCC/YEFt0rTa2x59ODZGlSTxYHGS1U7bzEo2ifhsefrmb4h cGrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=+ecq5c6sKY7cd84EJlpB3NzNUMYGSZy8yjUqdXmsGQc=; b=k2EIkbEsAK1nCFnq4WdYYyZ8JO/vExgmcH2BNkocYFN3yINLta0HjIERt56rIYPXeg qY75WX/GjtEIqLI9gNLPb+BF8nf+a2HnHSqEyHYuLy9DIxo2bDGNc/h+RBc5gy9UTPQ3 OtiiWgpcY1118DfPiQHACO98WBymuX/KrLpDL1NYuDSV7rVegryQKQx7BJnkxPk0XV/+ h8mmztZuol63/Ebb7z+x5QDY7XjVjiDdop4YlBbenRGpapsRfYBTxQwMm+iq1zTahx7c zOgjsokv4Luw6bDeRDn38PcjWIub/ghwDij/jViaye7TianOG+EucBD20Tk243re/Oi7 bXrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p75PQK9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz3si688343ejc.665.2021.02.03.04.28.04; Wed, 03 Feb 2021 04:28:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p75PQK9G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234496AbhBCMZq (ORCPT + 99 others); Wed, 3 Feb 2021 07:25:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbhBCMZo (ORCPT ); Wed, 3 Feb 2021 07:25:44 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436E6C0613D6 for ; Wed, 3 Feb 2021 04:25:04 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id s24so13419890iob.6 for ; Wed, 03 Feb 2021 04:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=+ecq5c6sKY7cd84EJlpB3NzNUMYGSZy8yjUqdXmsGQc=; b=p75PQK9GGEOh4pW2G5B8+7Rk73r0cBe+dKp/NlAR0yz+En355JUs6gZeiAUaDuPJTd DLdNmuox9J5vejEw5kPW4KAcPYsve+la1y0mdyQM6OQatSeZtcwDXIB5hZcEJueVI9bK 95ngQXKL/TsJmFuWpoEAUNIycEdcBjObrOwswKjTcwFEKhwpBOsBX52GtAu+kZuuO+Ir 9vNC/M3mPhPt0e1/kEtI+IMQtSdbX93SdfIWBG+F0FJMbYBs8tjiyF7iV762+A2cuMTJ UOu8nTibErvnC19tmrE6bhR1EpdE0lbIrE8K30ZPMYzSJIHaIMWQz4a8S7lcoQp57FpT /EXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=+ecq5c6sKY7cd84EJlpB3NzNUMYGSZy8yjUqdXmsGQc=; b=RuIelr7VbQhjuhDgfND4KPA0JiNAi7/C7UhHF781Lh1ChVOHQ2AC4FVHNkTxFMZ0Sy BgiWIXj66jIPvTiN15P9W1tEUFo1kX7MLtBr2thTqnxfGF3GSntgQChcwwtirniXbk3e T3zm/caElKOdUvBJJWlqRDwNaakmAxpu3fp1a1GhcCrU3ak0iuuqmk8Us5teBjQFJydH C3xNyiNgZYSaytRKgpMytO8P5wHophrKApmhQMw0VhNaZrv0rRyESsbZLZ6Cp03iztGX barB7LISv/09CdYICONGyBSKo8XOawFV4XIzWhOaI8mUejPV4suVPb9I1f9wY/3D5YhZ Npag== X-Gm-Message-State: AOAM533Fmwcyd6b3+VNMtXrml/OepL7z+SKZCpvYHBuakBCJtN2yFTnD 8IW8krOT4ISdQatyTyv6291LXLFR9v/oZBnw/Mg= X-Received: by 2002:a05:6602:1541:: with SMTP id h1mr2108852iow.171.1612355103342; Wed, 03 Feb 2021 04:25:03 -0800 (PST) MIME-Version: 1.0 References: <37DE7046-5096-4C0C-A96D-FD168A849DFD@zytor.com> <20201226075347.GA1977841@ubuntu-m3-large-x86> <3b793c42-8983-4502-1f9e-729cc0ebec47@gmail.com> <20210203121934.GC13819@zn.tnic> In-Reply-To: <20210203121934.GC13819@zn.tnic> Reply-To: sedat.dilek@gmail.com From: Sedat Dilek Date: Wed, 3 Feb 2021 13:24:51 +0100 Message-ID: Subject: Re: [PATCH v2] arch/x86: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) To: Borislav Petkov Cc: John Millikin , Nathan Chancellor , hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Clang-Built-Linux ML , Thomas Gleixner , Ingo Molnar , John Millikin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 3, 2021 at 1:19 PM Borislav Petkov wrote: > > 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 > I needed to touch this as it was "malformed" and did not apply cleanly. If it is not too late, feel free to add my: Tested-by: Sedat Dilek - Sedat -