Received: by 10.213.65.68 with SMTP id h4csp840552imn; Tue, 20 Mar 2018 17:21:38 -0700 (PDT) X-Google-Smtp-Source: AG47ELv0NdwPQeLAb1QsZg/SHRtQkOKSvQzOJA0u4Wo1tlycjOvNMJ8x9sStoFTo0ZuSBz7180Xk X-Received: by 2002:a17:902:7787:: with SMTP id o7-v6mr18649290pll.75.1521591698129; Tue, 20 Mar 2018 17:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521591698; cv=none; d=google.com; s=arc-20160816; b=Nh71u5wUMbGjfcXY0lEmcBLL8byw4vn/+0FR0EF5vn9GzzimBibUwGF3s5xP2voUc4 DET2i4krBdEckBa8KvlfF/ZUgovB4ySxD7ob2F7rjUKHHFRGuOk0IQU4R9DjFF7oqFYM TeePGMUGfYombIsRCD2wmP10Ce0o1HXpmOTcTMPNGJ51IDokE57c6WN9GPGr8TPj8nAL 3Vxsb8G3PbWxjsPZwhxmtjcYgJ6WxjLLsS19WZCt2yZ1dombgRH7u0kBqEK3wtZNnoys 74gPmevrEvisSrWGB9tk3Pj117+lJqdb9tSSoV6P1gOPGey3IwQwR5pTaSaB+4ye/X8A +/HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=JH6mPtR0RlCZ8vP73Jw63YvVLVE+2AulKbSQ/o3uDp8=; b=eHdy6FUc15naDgxsI/YXOd9SOnzMW0yCk5VKqWvleh6i194G7UCEPkBhW42fPAWg5H dMRu0y7EtjjIdfxOKsHz4a394zR1SU4TOxs7Tj9KMqzvTcb/ITY074YSDXzcbOY8dCIO MoxIj1O57Po2tqKQtTb+M0ZClprp9DN182nEYD4JmNNhRwAsqgf6jwkHf0RJI7Z6Ak+O OkRmpxZ2eYgic9y6TLLK+7CwYP0cpCwNlRGyGnYFgt+0hAhpSHOC6m99Pu/CL6VR77Lc 2oFnCy9Q07YNO7Y0btNy/iJY4BLX/0IJBCSuCs99b8ZiQHOCzTKG5Tgh+eYnl7Dc6onQ 2KnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PGsju5ik; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e16si1849867pgq.596.2018.03.20.17.21.24; Tue, 20 Mar 2018 17:21:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PGsju5ik; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751656AbeCUAUZ (ORCPT + 99 others); Tue, 20 Mar 2018 20:20:25 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:41891 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbeCUAUX (ORCPT ); Tue, 20 Mar 2018 20:20:23 -0400 Received: by mail-pf0-f193.google.com with SMTP id f80so1327188pfa.8 for ; Tue, 20 Mar 2018 17:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=JH6mPtR0RlCZ8vP73Jw63YvVLVE+2AulKbSQ/o3uDp8=; b=PGsju5ikoS+7kXpxB0Jko5+hq8Y0Go8ZSBdK3MBbfTep2F63UIlHYyLS+DRYGkh2cv H7nE8qAFqb+15/G7JrX1dNKiB4uWGfpt+7qZryboTGJ/5HU8i9Bj9va6tpBKyVV5gFqg KXPPUAFefPPUYK44L3FQLnq8Qvitp0D26LZ+Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=JH6mPtR0RlCZ8vP73Jw63YvVLVE+2AulKbSQ/o3uDp8=; b=Qm51pvH64UAXJhEGlf5mel9zHhwJWxIMzGeBWHPDASv7UvTZmbBTSLek4eZhfNJ+TS bi1EJruMlKHu+yq7JvH1BDIhskns3Pcdv1JoPA67zFCHen+3AIrXqlU5+UCJBhHmXvj2 +Rzx1xyHMz0WO70xxzg/yrfwRbP80r9AwRKkdKoOe2sSw7MFPrFxt0l0qNwvs7euNqZ7 WTVNm2q9E4tHN20G4Ap0SpxrAHvWC/Af59hEuBxgeSMQNc9sQXWh/SJ6siI1pF6/prq+ qMQ8vXewfdKq2AmljvRZPR8RKMU2BkfE46jIDxzdlVJiCQK/ZZYp2KHW/GBY3yIkmkzi hRMw== X-Gm-Message-State: AElRT7GBsBChrTVJVSwIAZ9I/0iXwrCyD0oG65vRoioE4kkZEZyKkwjm /8n3n/x9hGuGo1lQg7705WR5NBaPuTw= X-Received: by 10.98.172.3 with SMTP id v3mr2642387pfe.140.1521591623540; Tue, 20 Mar 2018 17:20:23 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id r129sm6011276pfc.83.2018.03.20.17.20.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Mar 2018 17:20:23 -0700 (PDT) Date: Tue, 20 Mar 2018 17:20:22 -0700 From: Matthias Kaehlcke To: Russell King - ARM Linux Cc: Stefan Agner , ard.biesheuvel@linaro.org, arnd@arndb.de, nicolas.pitre@linaro.org, marc.zyngier@arm.com, behanw@converseincode.com, keescook@chromium.org, Bernhard.Rosenkranzer@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] ARM: add support for building ARM kernel with clang Message-ID: <20180321002022.GH37438@google.com> References: <20180320230206.25289-1-stefan@agner.ch> <20180320230206.25289-6-stefan@agner.ch> <20180320231832.GK2743@n2100.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180320231832.GK2743@n2100.armlinux.org.uk> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org El Tue, Mar 20, 2018 at 11:18:33PM +0000 Russell King - ARM Linux ha dit: > On Wed, Mar 21, 2018 at 12:02:06AM +0100, Stefan Agner wrote: > > Use cc-options call for compiler options which are not available > > in clang. With this patch an ARMv7 multi platform kernel can be > > successfully build using clang (tested with version 5.0.1). > > > > Based-on-patches-by: Behan Webster > > Signed-off-by: Stefan Agner Great to see your work on bringing clang support for 32-bit ARM upstream! > > --- > > arch/arm/Makefile | 2 +- > > arch/arm/boot/compressed/Makefile | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > index e9e3fde3c657..20e9fee1ccc5 100644 > > --- a/arch/arm/Makefile > > +++ b/arch/arm/Makefile > > @@ -39,7 +39,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-unaligned-access) > > endif > > > > ifeq ($(CONFIG_FRAME_POINTER),y) > > -KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog > > +KBUILD_CFLAGS +=-fno-omit-frame-pointer $(call cc-option,-mapcs,) $(call cc-option,-mno-sched-prolog,) > > Some of these options here are to ensure that we generate the following > code, so we can backtrace: > > mov ip, sp > stmfd sp!, {fp, ip, lr, pc} > sub fp, ip, #4 > > If clang isn't producing that code at the start of functions with > CONFIG_FRAME_POINTER=y, then backtracing will not work, and arguably > CONFIG_FRAME_POINTER=y is useless there. In that circumstance, it's > probably better to fail so the user can configure something more > debuggable, rather than having the kernel potentially producing > undebuggable oopses. Which option in particular is important to generate the above code for backstracing? According to the gcc doc -mapcs(-frame) is deprecated. For -mno-sched-prolog the doc says: "Prevent the reordering of instructions in the function prologue, or the merging of those instruction with the instructions in the function’s body. This means that all functions start with a recognizable set of instructions (or in fact one of a choice from a small set of different function prologues), and this information can be used to locate the start of functions inside an executable piece of code. The default is -msched-prolog." Thanks Matthias