Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2530845pxj; Mon, 10 May 2021 05:17:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxafl3rDJ2ULZYTznnCqSVxot1sjdxIiR9qapD1LquExmxEHf647H4dghfe9T/PWqaUmFDw X-Received: by 2002:a5e:9907:: with SMTP id t7mr17541715ioj.155.1620649078322; Mon, 10 May 2021 05:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620649078; cv=none; d=google.com; s=arc-20160816; b=0bp6L8s9NMVcon03SC52AQD9A6CgE1cGgUyyYhccOEQXi/k2ooNNAHUMM6qt0bF2FY PTvswwSrrV5cKOGQ8K8DpDKwznysA5hNw4k3441eDwXXY75rhFlUsCiZJk5r1JVB7TiH JNF1DhQO//96izAbAx4kN5RrRTCNi9Ye1+uST0XVKodeaPCu4KETe+ds8xK9VpNKo0Uq a1tmadTWd2/EoZ/KCIeG6P/cxOIPZxKd/GqRcjh02mp1xPcGbzi5Jru+3K7JE/yPY0XS 9kvwcGxd660A05pqcWh8AdXLN5h3oAL0ZcUYVmBxQbVTeVmsxbPQCartQ1y9KNeN0FPU Xm+Q== 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=gk2nPkVZGAJbWkyhOskWnU0dEJvjPXzK3dJkYKiXEAc=; b=AtWnMt3yyMcEugYFHxzu2+JGj4D1N8pio/+MJvHqnRmiDTNHd9LnC6AaDMDCGR5GQy cywLlEQOV14ZsdpQB61te/g57O6qASYndAM1OCwJcfJBy15r6okT0yYSeb0l/yxAv7wf lrb/p84L8adnaDxfTxbMK8qCebsIEqxJXh3/B9+Uy67UN+Q+ZmculU9fpEUMw5QFe2Qk pfMT/bggIDU16bAj0VBdHP3y/se8vnHQ+mcTftfG2CimziAwB23RhtmEIegfa/8+feBT fN1auFZp1thaVLU82hRA03jkZF2CggM7OT7sL89O3YHX58MzDIgJTDlDOclKqgMAlgEQ gf7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rizKuBKU; 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 d12si10841730ioi.7.2021.05.10.05.17.46; Mon, 10 May 2021 05:17:58 -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=rizKuBKU; 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 S1344496AbhEJMPr (ORCPT + 99 others); Mon, 10 May 2021 08:15:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:44342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236415AbhEJLIF (ORCPT ); Mon, 10 May 2021 07:08:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3273E61613; Mon, 10 May 2021 11:00:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644457; bh=dTrnXMBO0duurkwC3GfI8kGutgmK5O/dZCHMp7jMfgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rizKuBKUdi+/1zk4bYvhf37juyvrfcC7/aOlB4+iH6rPDK80cw7TUkg7nR56/axd5 Zm2o07L4kksR1zrsgH1JZK4zur99VdxS+rvVmHr3vZRYGGHP9hy1FGvRTT1CuRhtbf Kev3wPTmg2kTqewK4HHKIHxvZIaKkEWa/OMDyovg= 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.12 091/384] x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) Date: Mon, 10 May 2021 12:18:00 +0200 Message-Id: <20210510102017.882602766@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102014.849075526@linuxfoundation.org> References: <20210510102014.849075526@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 9a85eae37b17..78faf9c7e3ae 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -33,6 +33,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