Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472597pxj; Mon, 10 May 2021 03:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoA8+l/CxD7tRk7SHBQ78ueTZ8HYf2O2+Sa8ek4Qlaau63S5S2CDhxJX1raF65+pKWkcRP X-Received: by 2002:a05:6e02:13e1:: with SMTP id w1mr22755421ilj.181.1620644259432; Mon, 10 May 2021 03:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644259; cv=none; d=google.com; s=arc-20160816; b=k1ONHdECDSz6AYtXH3M8TDY8WF8g9qrjfLUV05hBWeCDCCfAxEmNj8JJcQPKybXxTG VK3ezIYSsSLpWpSTFuhO01QGqRr1HAn2pqI3+v6S0bWoCDUpeKO/yPgAioFnPpiO5L9Y z2PHQSoEqBwC6dsh/nQWm2dXHinnmorEDSnFgJpBFFWbvvtnqqsIx7fPERUR384UlVjv ogHXC8WSJYxVaQT31ttc8GyQpbmWg/V2V1TUT6Ejusm/6lpEc/rffYUy+vFB6Uh+SFkn XKQZ2XraObIKCEOpljPy2hQTROY63oBkHNTNPVkimTvAKkXyBOqr+T+3K2YnTBzNYsEX N/0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zzlbSuBDlwJJPFkwnwJ+px2HrVpI/cksl4gvMxM53d8=; b=FfbpaxFOmw4NXdvHzzdzQdD78KKmEcUiG7WPrcvIz7a+FM/XSctbBrlszZgaCkRVlW NKh3dWUBXZ5NXu2odz3A0InAenGXC6MeBmX7Y260jTAYQ22IzvK+hG7kAFRrRmox5Anc OIRYFBDUdSFf1OuWsvuclzSy+hClr4fuPYKLIQ97qZiQrAr4b6OldhC/KUZqhhEKVPlf sPPooOLSjCjbqPBl2lLIQfMUOMLB59YtNZjEisjUhusx9pWM1rYE8lOG/uglFz3fIcy+ 5yRepOkynDq8/wGbnwWSpnk33EXK2GtWeYnu/cgS1BrGYAj0XkL4X0+jqDfdzpcXBaI0 cKKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j4CL1EQw; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v11si18880076ilu.142.2021.05.10.03.57.27; Mon, 10 May 2021 03:57:39 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=j4CL1EQw; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234791AbhEJK5D (ORCPT + 99 others); Mon, 10 May 2021 06:57:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:59296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbhEJKos (ORCPT ); Mon, 10 May 2021 06:44:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3342C6146E; Mon, 10 May 2021 10:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642842; bh=B7y7D/LiS7FB1mZYocrh250FxubBhbxVNOQ3FRnbcoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4CL1EQwH6GfPiUSPODpCiXrR0tpjqUsy5pYLRyF4Z2/SdaPjcrOWvmdKRtGtjHME XkfpOd8yKuRPCb9oXlp5zZ6L92t5N4OGQGbD+etpi3ZP+w8ymA9kQrRnDJp5ym2y2f kxtfJzyYe54MDRMkTCjxp1geWzocIjT/4dUt6D2c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Millikin , Nathan Chancellor , Borislav Petkov , Ard Biesheuvel , Sedat Dilek , Sasha Levin Subject: [PATCH 5.10 073/299] x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) Date: Mon, 10 May 2021 12:17:50 +0200 Message-Id: <20210510102007.328932593@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Millikin [ Upstream commit 8abe7fc26ad8f28bfdf78adbed56acd1fa93f82d ] 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)' 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 Signed-off-by: Nathan Chancellor Signed-off-by: Borislav Petkov Acked-by: Ard Biesheuvel Tested-by: Sedat Dilek Link: https://lkml.kernel.org/r/20210326000435.4785-2-nathan@kernel.org Signed-off-by: Sasha Levin --- arch/x86/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 9c86f2dc16b1..8ed757d06f77 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -40,6 +40,7 @@ REALMODE_CFLAGS += -ffreestanding REALMODE_CFLAGS += -fno-stack-protector REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -Wno-address-of-packed-member) REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), $(cc_stack_align4)) +REALMODE_CFLAGS += $(CLANG_FLAGS) export REALMODE_CFLAGS # BITS is used as extension for files which are available in a 32 bit -- 2.30.2