Received: by 10.223.185.116 with SMTP id b49csp3142972wrg; Mon, 12 Feb 2018 21:44:49 -0800 (PST) X-Google-Smtp-Source: AH8x224rL5bD8mr4Xr+sWkdppt5xENMu+/JlUpEtZgQYBMldJxOsz7b+DEd/RpCrlczWMirlqDG6 X-Received: by 10.101.72.75 with SMTP id i11mr91949pgs.78.1518500689764; Mon, 12 Feb 2018 21:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518500689; cv=none; d=google.com; s=arc-20160816; b=pUwWyhA6qB7gUTPxUHz5RWEDs/uAEaGW7wnn0X9joDByNjSLvyhWJAfMcOhviAOz4M srzZZoKJLksL6S12zjTmJ1ZXwxcsLviRicwuOWn4iDVFZTYH2aPfXaTv0dDwZWl+Iexk m61DChX+aI6dXnyY0TZ704XVmSwhUjDwtQCwKYzApgKONB/mjQFOvZl72mXAS56Gd4I4 4J7xpF7hT/IEWBxb1jWXYg4TYzoW06U04T/WsFCVdQZRw85jjvoWerdK4H3z3YMuphY3 xY0Zv+U5Qi64Ef48Tb3JvYdQS+vnKv41g3BNsKZndPutqXFoFlf1+mqzsuOWoeugtSqw 4IcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=qdXXozlRsj8GEVjQIUb1tF36ZlByqoQ7TsXZ7BfbIf0=; b=rxhd5WWLrId1GKnNvKTp3EYftMdRfQZmh0aCtLkLlxagdxhjzEpfu5a1skLo6PG3Ub fE2U3MrewUQizzi9Y/cgQjL4ncFBHMy51IGIkPu3lFWI1vF6awOyEVnPCrI/NxedJWlF 3ytkhOZAmr+YzNIzF1hCjMlD7Z/qmZ0/1Y1mtpQE6PsYzH1Cz9tP8mbMtfEDqsa81ofJ rAK8e9twzq4rSZwotUdjzJovqe0Y+dE7tMgHSSr64JmHw76vJ0V35l6k1mCm6j1JFq4F ErhxfQ91JVIm5kzwtRuSGvzg19uh0marv8wU0kAKU6M6Xl4/unUmsyjIxOYOWOk8dz+G jFwg== ARC-Authentication-Results: i=1; mx.google.com; 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 k3-v6si449760pld.296.2018.02.12.21.44.05; Mon, 12 Feb 2018 21:44:49 -0800 (PST) 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; 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 S1754019AbeBMFmT (ORCPT + 99 others); Tue, 13 Feb 2018 00:42:19 -0500 Received: from exmail.andestech.com ([59.124.169.137]:19335 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751794AbeBMFmQ (ORCPT ); Tue, 13 Feb 2018 00:42:16 -0500 Received: from ATCSQR.andestech.com (localhost [127.0.0.2] (may be forged)) by ATCSQR.andestech.com with ESMTP id w1D5GJWF046253 for ; Tue, 13 Feb 2018 13:16:19 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id w1D5G1FT046210; Tue, 13 Feb 2018 13:16:01 +0800 (GMT-8) (envelope-from alankao@andestech.com) Received: from atcsqa06.andestech.com (10.0.1.85) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.123.3; Tue, 13 Feb 2018 13:17:11 +0800 From: Alan Kao To: Palmer Dabbelt , Albert Ou , "Steven Rostedt" , Ingo Molnar , , , CC: Alan Kao Subject: [PATCH v4 1/6] riscv/ftrace: Add RECORD_MCOUNT support Date: Tue, 13 Feb 2018 13:13:16 +0800 Message-ID: <1518498801-677-2-git-send-email-alankao@andestech.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518498801-677-1-git-send-email-alankao@andestech.com> References: <1518498801-677-1-git-send-email-alankao@andestech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.1.85] X-DNSRBL: X-MAIL: ATCSQR.andestech.com w1D5G1FT046210 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now recordmcount.pl recognizes RISC-V object files. For the mechanism to work, we have to disable the linker relaxation. Cc: Greentime Hu Signed-off-by: Alan Kao --- arch/riscv/Kconfig | 1 + arch/riscv/Makefile | 3 +++ scripts/recordmcount.pl | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 9e1074fd5cca..570af19a54ea 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -120,6 +120,7 @@ config ARCH_RV64I select 64BIT select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER + select HAVE_FTRACE_MCOUNT_RECORD endchoice diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index 6719dd30ec5b..899226e0da7d 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -11,6 +11,9 @@ LDFLAGS := OBJCOPYFLAGS := -O binary LDFLAGS_vmlinux := +ifeq ($(CONFIG_DYNAMIC_FTRACE),y) + LDFLAGS_vmlinux := --no-relax +endif KBUILD_AFLAGS_MODULE += -fPIC KBUILD_CFLAGS_MODULE += -fPIC diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 2033af758173..d44d55db7c06 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -376,6 +376,11 @@ if ($arch eq "x86_64") { $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s__mcount\$"; $type = ".quad"; $alignment = 8; +} elsif ($arch eq "riscv") { + $function_regex = "^([0-9a-fA-F]+)\\s+<([^.0-9][0-9a-zA-Z_\\.]+)>:"; + $mcount_regex = "^\\s*([0-9a-fA-F]+):\\sR_RISCV_CALL\\s_mcount\$"; + $type = ".quad"; + $alignment = 2; } else { die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; } -- 2.15.1