[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250224211102.33e264fc@gandalf.local.home>
Date: Mon, 24 Feb 2025 21:11:02 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Arnd Bergmann" <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, bpf <bpf@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org, linux-s390@...r.kernel.org, "Masami
Hiramatsu" <mhiramat@...nel.org>, "Mark Rutland" <mark.rutland@....com>,
"Mathieu Desnoyers" <mathieu.desnoyers@...icios.com>, "Andrew Morton"
<akpm@...ux-foundation.org>, "Peter Zijlstra" <peterz@...radead.org>,
"Linus Torvalds" <torvalds@...ux-foundation.org>, "Masahiro Yamada"
<masahiroy@...nel.org>, "Nathan Chancellor" <nathan@...nel.org>, "Nicolas
Schier" <nicolas@...sle.eu>, "Zheng Yejian" <zhengyejian1@...wei.com>,
"Martin Kelly" <martin.kelly@...wdstrike.com>, "Christophe Leroy"
<christophe.leroy@...roup.eu>, "Josh Poimboeuf" <jpoimboe@...hat.com>,
"Heiko Carstens" <hca@...ux.ibm.com>, "Catalin Marinas"
<catalin.marinas@....com>, "Will Deacon" <will@...nel.org>, "Vasily Gorbik"
<gor@...ux.ibm.com>, "Alexander Gordeev" <agordeev@...ux.ibm.com>
Subject: Re: [PATCH v5 2/6] scripts/sorttable: Have mcount rela sort use
direct values
On Mon, 24 Feb 2025 17:21:47 -0500
Steven Rostedt <rostedt@...dmis.org> 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) {
Powered by blists - more mailing lists