Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3013022pxb; Mon, 18 Oct 2021 06:36:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiBQNECG2Z5mN/7AZgXxfMyFQQUXFNEq343Ez6Gj+y0/7qiOwTX3rBYp5wBI6pV90nIYeq X-Received: by 2002:a17:902:9b8a:b0:13f:c286:a060 with SMTP id y10-20020a1709029b8a00b0013fc286a060mr4085502plp.66.1634564168267; Mon, 18 Oct 2021 06:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634564168; cv=none; d=google.com; s=arc-20160816; b=WD8N59tqLNp6RdP0tOHw7Kds4JJ4tEJoaY+UVbUlHaFf4+xOgw1FtsJGaWEX7YfewT 8C8y6p2tfjtxUjvNoVc2xVMfAQezENprZV7v1TQNtMYASraNM09OBe1U2OREVH6pU4F9 JF/H4VGksquRv7gYwtBnAYuGlKwWkV/CaTxoIfvi2N3L9yeZHy5w+A7eCQnIlEjcMnxr n/PwWpotrSnAhcQlzTGqVDw/lpByAyeeUrmfHdDl+Nn9UxKyp18KajuDUBP2mhgHEozQ +jzJJnM0MChGvIXBKCUCfGzBnoIwfA271DPkP/zX7sCr3Fl6spbTCVIaEh42dfFlqqPy C3ZA== 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=+lPM9Q9eWq7IF0zONjiNF8JuOCjHJCp6Qut04O1NIMw=; b=cyoJfGWWhuWRevgRnieIryH+AYSU36paVCUOXvjIo5vmot25+Xh1c8mcZ/CzjPGQAm AdIglPwDD5Ds3B8pZO4LC8wWjAVY2Z3uiZkEUYjjDu4nG+ZrcA0R6Dex+wYO0iQ44Kb/ vRcdt6zzzGbtl/E91Pd6l3hb3vZRh8kl8hMfjFPRrSvpLXUFzdoi5aC38kWnrEjKWWGV bPUtXjCvtDOjIa+S8BrWY6lgHeuIMprQq2OQXBv+034ggUKvLclaJ+W2Reismwn2b3jJ yUwWaqI0uSZ0YeJEwKvFAd/oPCHZs8rB7Tdv+k1uHbGUeJb6YyeVv1F7ZWKO6Oqm/jVj EuDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ke8yEoa1; 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 g12si18306578pjl.69.2021.10.18.06.35.55; Mon, 18 Oct 2021 06:36: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=Ke8yEoa1; 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 S232683AbhJRNfo (ORCPT + 99 others); Mon, 18 Oct 2021 09:35:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:42838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbhJRNeK (ORCPT ); Mon, 18 Oct 2021 09:34:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C145661352; Mon, 18 Oct 2021 13:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563799; bh=6Vp21lSexe6z120mdDelmfwJ35ap7XXTqN+VwLxH3y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ke8yEoa1dwy6wAPWPbFgIWk4xCdmx4lVbtZeRfg7S8ru9PSn0TI/kB0V+M1tQZay9 L6OL89L8VWjvRNjo/7zHq65QpHYJ0RwVVHaMUPsnohe4NDm/10ohVDFuDl7GougyEe Bj1cl7J5Dpe8k7UbxiOF9J/F7qmCLwPU9X0tYRL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greentime Hu , "Steven Rostedt (VMware)" Subject: [PATCH 5.4 08/69] nds32/ftrace: Fix Error: invalid operands (*UND* and *UND* sections) for `^ Date: Mon, 18 Oct 2021 15:24:06 +0200 Message-Id: <20211018132329.735104300@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132329.453964125@linuxfoundation.org> References: <20211018132329.453964125@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: Steven Rostedt commit be358af1191b1b2fedebd8f3421cafdc8edacc7d upstream. I received a build failure for a new patch I'm working on the nds32 architecture, and when I went to test it, I couldn't get to my build error, because it failed to build with a bunch of: Error: invalid operands (*UND* and *UND* sections) for `^' issues with various files. Those files were temporary asm files that looked like: kernel/.tmp_mc_fork.s I decided to look deeper, and found that the "mc" portion of that name stood for "mcount", and was created by the recordmcount.pl script. One that I wrote over a decade ago. Once I knew the source of the problem, I was able to investigate it further. The way the recordmcount.pl script works (BTW, there's a C version that simply modifies the ELF object) is by doing an "objdump" on the object file. Looks for all the calls to "mcount", and creates an offset of those locations from some global variable it can use (usually a global function name, found with <.*>:). Creates a asm file that is a table of references to these locations, using the found variable/function. Compiles it and links it back into the original object file. This asm file is called ".tmp_mc_.s". The problem here is that the objdump produced by the nds32 object file, contains things that look like: 0000159a <.L3^B1>: 159a: c6 00 beqz38 $r6, 159a <.L3^B1> 159a: R_NDS32_9_PCREL_RELA .text+0x159e 159c: 84 d2 movi55 $r6, #-14 159e: 80 06 mov55 $r0, $r6 15a0: ec 3c addi10.sp #0x3c Where ".L3^B1 is somehow selected as the "global" variable to index off of. Then the assembly file that holds the mcount locations looks like this: .section __mcount_loc,"a",@progbits .align 2 .long .L3^B1 + -5522 .long .L3^B1 + -5384 .long .L3^B1 + -5270 .long .L3^B1 + -5098 .long .L3^B1 + -4970 .long .L3^B1 + -4758 .long .L3^B1 + -4122 [...] And when it is compiled back to an object to link to the original object, the compile fails on the "^" symbol. Simple solution for now, is to have the perl script ignore using function symbols that have an "^" in the name. Link: https://lkml.kernel.org/r/20211014143507.4ad2c0f7@gandalf.local.home Cc: stable@vger.kernel.org Acked-by: Greentime Hu Fixes: fbf58a52ac088 ("nds32/ftrace: Add RECORD_MCOUNT support") Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- scripts/recordmcount.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl @@ -222,7 +222,7 @@ if ($arch =~ /(x86(_64)?)|(i386)/) { $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; $section_regex = "Disassembly of section\\s+(\\S+):"; -$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; +$function_regex = "^([0-9a-fA-F]+)\\s+<([^^]*?)>:"; $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; $section_type = '@progbits'; $mcount_adjust = 0;