Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp413121pxj; Thu, 20 May 2021 12:14:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgD13gbKZ0j1TkDdaf5pan3iymKjPASL0OIo8XH4x9pvwEcczeF9vFusNmuPeJi1BKIwtv X-Received: by 2002:a05:6402:34d2:: with SMTP id w18mr6570840edc.358.1621538048880; Thu, 20 May 2021 12:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621538048; cv=none; d=google.com; s=arc-20160816; b=BH6Yu5wrsIPy8paR5dwqfc3Y5Ayj3wHbce89uU5KICXioxRhhWmK1dNzsgQEp2G5Av o6V20olJC18OVS45E9WGfz622krf8xfDS3wincdqazW0ERX1c89A/W5hJw7umiFEvBzO hkRKh9ki0cA0rSXgAfMwIN1QzpFBse16B73BiEQbvASYnDZbWr45sYYfCCj7VUYBonwx wExwV3gDRgdk6v4ygaG/BkWPTSojUII8k0G+nd1c6RcN3afuWlHxnYNfGzsCQuOOBBrO nV/T3Y6UBWpgkBsR5KIcO3MJzpNpjuJpYl1KvyxDAVryo2RpNxSEDYO5RYdMJvJmJMUo OAIQ== 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=yVVPrmr9/HBWd3KfVHvoyUx5GK90KWfjP2hXmQROKTc=; b=LELsXtU6KFUNYXZbYUvTl6dU+AKDEHgi9iymHNP9lrVCjGg99IbXQkIG49zj/UBrLh odmvfsU3nYoqxW/ILdejGYundF6fu9e8mw6zA1J6L/+iliStUYMIHRAq80nto7A6+36F 8D3P4xGoA5ifm53vcivbzuspIUSYJ1Varh6iv3iur4tA8ZWxQ0tW0oc7Nukl8uklZSQP nNF4sQizGZ/i9nGERs6MFAqNDJ+VyGofNgyIG/EnOlZm7zwuBRVMBZh2+fPyREaocKgp j5Iag0DDP3qwrYusRkIobIbGWJ805YKhMzUQz7W9vn8a1YagZZgppWTIOzd2Rebn3FC8 FvIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kT9mVeU6; 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 bh4si3957439ejb.358.2021.05.20.12.13.44; Thu, 20 May 2021 12:14:08 -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=kT9mVeU6; 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 S235148AbhETK3o (ORCPT + 99 others); Thu, 20 May 2021 06:29:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:47630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235825AbhETKRR (ORCPT ); Thu, 20 May 2021 06:17:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C13061999; Thu, 20 May 2021 09:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503974; bh=95U2WqULwpNN6/Z3CkkSoHFK88b2el0ua3k+wDTb7cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kT9mVeU6vQ46sIbb7F7CBewKXQSuVizhnM9eH8Kh9J9idv0+peyV1sCV8cwjSbMHC 3q2M1l5RD8ydmb2VOGV9T8wQCU40RIpHxS7P1x0IOqmI6dJhym6vdbCFdYOiXG4v3e asDHAd8IKxEiJllqILqf7TNz7qrkoq6sMhMmuND4= 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 4.14 037/323] x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) Date: Thu, 20 May 2021 11:18:49 +0200 Message-Id: <20210520092121.380750941@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 146aadeb7c8e..844d5a72d2ad 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -41,6 +41,7 @@ REALMODE_CFLAGS += $(call __cc-option, $(CC), $(REALMODE_CFLAGS), -ffreestanding REALMODE_CFLAGS += $(call __cc-option, $(CC), $(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