From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 888AF2C9D; Tue, 25 Feb 2025 02:10:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740449429; cv=none; b=sY91/Gl+zVNfTi8jpnKzVov8LFHc8Oy7wivfUhb/XK94YWt4wNrqq3ZEwlIptczbk4o6D92n1ol5FaVlrDsl31wb3yiSTqTdC/fdS0aJIE89QmXAmquFoDy0X2r9/6RP0Y+jAuJ7ueTopD4UmcaZx6TDHicXCH3pO+zgKn1rsyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740449429; c=relaxed/simple; bh=aaHGUOs30tNuy84PGnD8R0PY9RDSWCOwwuFCRkSChe4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qVC6HrD8DtavyxruxygWpk5/Xi+GSvj+q/sm2Rz724LS/aYb5IvnzWvSz5UOgMOO/ly5cDLnctnW+TLwR4DhlzbUPsawWmFsSHgHvbbT7+Jp50KHUeYPjdGXMvCJ7mRqVWG8RFgnpZHUB0G4DSCrlq3Vy4WTXFqbc/GDtc8pQFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 659A4C4CED6; Tue, 25 Feb 2025 02:10:26 +0000 (UTC) Date: Mon, 24 Feb 2025 21:11:02 -0500 From: Steven Rostedt To: "Arnd Bergmann" Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, bpf , linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, "Masami Hiramatsu" , "Mark Rutland" , "Mathieu Desnoyers" , "Andrew Morton" , "Peter Zijlstra" , "Linus Torvalds" , "Masahiro Yamada" , "Nathan Chancellor" , "Nicolas Schier" , "Zheng Yejian" , "Martin Kelly" , "Christophe Leroy" , "Josh Poimboeuf" , "Heiko Carstens" , "Catalin Marinas" , "Will Deacon" , "Vasily Gorbik" , "Alexander Gordeev" Subject: Re: [PATCH v5 2/6] scripts/sorttable: Have mcount rela sort use direct values Message-ID: <20250224211102.33e264fc@gandalf.local.home> In-Reply-To: <20250224172147.1de3fda5@gandalf.local.home> References: <20250218195918.255228630@goodmis.org> <20250218200022.538888594@goodmis.org> <893cd8f1-8585-4d25-bf0f-4197bf872465@app.fastmail.com> <20250224172147.1de3fda5@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 24 Feb 2025 17:21:47 -0500 Steven Rostedt wrote: > Hmm, I haven't tried building this with clang. > > Can you compile without that commit, run and give me the output from these > two programs: > > ./dump_elf_sym vmlinux __start_mcount_loc __stop_mcount_loc > ./dump_elf_rela vmlinux .rela.dyn > > If the second one fails, remove the '.rela.dyn' and see what that shows. > > https://rostedt.org/code/dump_elf_sym.c > https://rostedt.org/code/dump_elf_rela.c > Nevermind, Masami told me all I need to do is add LLVM=1 and clang can handle the cross compiling. I looked, and sure enough clang on arm64 does it the same way x86 does. So using the rela items to sort is a gcc thing :-p Can you try this patch? -- Steve diff --git a/scripts/sorttable.c b/scripts/sorttable.c index 23c7e0e6c024..07ad8116bc8d 100644 --- a/scripts/sorttable.c +++ b/scripts/sorttable.c @@ -827,9 +827,14 @@ static void *sort_mcount_loc(void *arg) pthread_exit(m_err); } - if (sort_reloc) + if (sort_reloc) { count = fill_relocs(vals, size, ehdr, emloc->start_mcount_loc); - else + /* gcc may use relocs to save the addresses, but clang does not. */ + if (!count) { + count = fill_addrs(vals, size, start_loc); + sort_reloc = 0; + } + } else count = fill_addrs(vals, size, start_loc); if (count < 0) {