Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1944384ybl; Thu, 29 Aug 2019 00:59:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC6lMHouLeXzDzfsf7XFLSyRMOkhlFmZ8Q3QkubGMYn0oJo7xKjv223TjtmixSoMwdyNFB X-Received: by 2002:a62:64d4:: with SMTP id y203mr9573762pfb.91.1567065588312; Thu, 29 Aug 2019 00:59:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567065588; cv=none; d=google.com; s=arc-20160816; b=QQPB5ntGJFMacNdAd0WUZCyJ36jD7K+JG5YTAoonNpp6lyeOy4aCBvoZlhWtAs3gzY 4mgtekZ9JMDRFX04CPCVSenB6CdY9unzYSJhQ8MxSq1mTBrWNY6SFydMWLT4rNrQLkO9 IoVj9E3O3YLb950R4YsNVElDkybLAst1sUk70m+aFWVXZUzjhimToMFR8p8OVak/72T+ vLr60dX4+VONl6q29O1mS4+dAYC/qOKJmvnfU7W+f4S3UOFo4PtssVEgovp+0e+6w5fy cu8rz/ftljUZKmjeb4a1fDLr3UA9NuCZRFdBDahnnAPuxDqkbs8mPSXGpN4Od0dqTb7x KMng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=z8mT125lg2u4srukuCuOIjTA/fSrbJ4+/sfujlxob84=; b=CnnL0d3gPz3Ip76ojQFOKd2lG13kIwyoQwqCCrbFvhdlCRfRp2mHM38pWEO73Itwpz zyduPjgcPXggTAkeWMucOpfe1YmshxX0NUxNuqJFRE/cGB2NedlYMyHnBhjzLVCHHg2D 4FOjjFD+qBqSVxwhVQP9XCNJifg6pgjsIwEhE2Mm9sl3jAakK8sBeYrsOQwe5Rz8eW6K /zUMHB73lFnFVpPvmkt1FgwUmBHfPtcrF/6+qSJVOpnmGllvAQnG+w2tpr+ZSXaL6WOr eGxyLllTdPpfYy3qqdgwO7Xse88HLqxztiGd4y5RHN4AyO6QB7PvOpN28oq8blcySnxP 1WAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=VK1CIOcB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7si1529479pjf.74.2019.08.29.00.59.33; Thu, 29 Aug 2019 00:59:48 -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=@agner.ch header.s=dkim header.b=VK1CIOcB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbfH2H5M (ORCPT + 99 others); Thu, 29 Aug 2019 03:57:12 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:40222 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfH2H5M (ORCPT ); Thu, 29 Aug 2019 03:57:12 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 5BBF95C061A; Thu, 29 Aug 2019 09:57:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1567065430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z8mT125lg2u4srukuCuOIjTA/fSrbJ4+/sfujlxob84=; b=VK1CIOcB1OD/huRZhcJJs7rGkMfngWojEwTyYxRkZBs998yEtvOfwwRz1yi1MVI8hBPZPd gXsfuV4XFGLjWcEXKdsIIJIkXsTlIiLHfX+Sbqdb3ErBs3rMCK0qrqY65QKkQ4GQnm4DtX Unb+CFRUfzjOj4Yrg44luRuLTzZCbgU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Thu, 29 Aug 2019 09:57:10 +0200 From: Stefan Agner To: Nathan Chancellor Cc: Russell King , Nick Desaulniers , Arnd Bergmann , Matthias Kaehlcke , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] ARM: Emit __gnu_mcount_nc when using Clang 10.0.0 or newer In-Reply-To: <20190829062635.45609-1-natechancellor@gmail.com> References: <20190829062635.45609-1-natechancellor@gmail.com> Message-ID: X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-08-29 08:26, Nathan Chancellor wrote: > Currently, multi_v7_defconfig + CONFIG_FUNCTION_TRACER fails to build > with clang: > > arm-linux-gnueabi-ld: kernel/softirq.o: in function `_local_bh_enable': > softirq.c:(.text+0x504): undefined reference to `mcount' > arm-linux-gnueabi-ld: kernel/softirq.o: in function `__local_bh_enable_ip': > softirq.c:(.text+0x58c): undefined reference to `mcount' > arm-linux-gnueabi-ld: kernel/softirq.o: in function `do_softirq': > softirq.c:(.text+0x6c8): undefined reference to `mcount' > arm-linux-gnueabi-ld: kernel/softirq.o: in function `irq_enter': > softirq.c:(.text+0x75c): undefined reference to `mcount' > arm-linux-gnueabi-ld: kernel/softirq.o: in function `irq_exit': > softirq.c:(.text+0x840): undefined reference to `mcount' > arm-linux-gnueabi-ld: kernel/softirq.o:softirq.c:(.text+0xa50): more > undefined references to `mcount' follow > > clang can emit a working mcount symbol, __gnu_mcount_nc, when > '-meabi gnu' is passed to it. Until r369147 in LLVM, this was > broken and caused the kernel not to boot because the calling > convention was not correct. Now that it is fixed, add this to > the command line when clang is 10.0.0 or newer so everything > works properly. Cool, finally function tracing with Clang :-) > > Link: https://github.com/ClangBuiltLinux/linux/issues/35 > Link: https://bugs.llvm.org/show_bug.cgi?id=33845 > Link: > https://github.com/llvm/llvm-project/commit/16fa8b09702378bacfa3d07081afe6b353b99e60 > Signed-off-by: Nathan Chancellor Reviewed-by: Stefan Agner -- Stefan > --- > arch/arm/Makefile | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index c3624ca6c0bc..7b5a26a866fc 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -112,6 +112,12 @@ ifeq ($(CONFIG_ARM_UNWIND),y) > CFLAGS_ABI +=-funwind-tables > endif > > +ifeq ($(CONFIG_CC_IS_CLANG),y) > +ifeq ($(shell test $(CONFIG_CLANG_VERSION) -ge 100000; echo $$?),0) > +CFLAGS_ABI +=-meabi gnu > +endif > +endif > + > # Accept old syntax despite ".syntax unified" > AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)