Re: Check pahole availibity and BPF support of toolchain before starting a Linux kernel build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 12, 2021 at 05:14:42PM +0100, Sedat Dilek wrote:
> On Tue, Jan 12, 2021 at 2:10 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >
> > On Tue, Jan 12, 2021 at 11:46:22AM +0100, Jiri Olsa wrote:
> > > On Mon, Jan 11, 2021 at 02:34:04PM -0800, Tom Stellard wrote:
> > > > On 1/11/21 2:31 PM, Jiri Olsa wrote:
> > > > > On Mon, Jan 11, 2021 at 10:30:22PM +0100, Sedat Dilek wrote:
> > > > >
> > > > > SNIP
> > > > >
> > > > > > > >
> > > > > > > > Building a new Linux-kernel...
> > > > > > > >
> > > > > > > > - Sedat -
> > > > > > > >
> > > > > > > > [1] https://git.kernel.org/pub/scm/devel/pahole/pahole.git/
> > > > > > > > [2] https://github.com/ClangBuiltLinux/tc-build/issues/129#issuecomment-758026878
> > > > > > > > [3] https://github.com/ClangBuiltLinux/tc-build/issues/129#issuecomment-758056553
> > > > > > >
> > > > > > > There are no significant bug fixes between pahole 1.19 and master that
> > > > > > > would solve this problem, so let's try to repro this.
> > > > > > >
> > > > > >
> > > > > > You are right pahole fom latest Git does not solve the issue.
> > > > > >
> > > > > > + info BTFIDS vmlinux
> > > > > > + [  != silent_ ]
> > > > > > + printf   %-7s %s\n BTFIDS vmlinux
> > > > > >   BTFIDS  vmlinux
> > > > > > + ./tools/bpf/resolve_btfids/resolve_btfids vmlinux
> > > > > > FAILED: load BTF from vmlinux: Invalid argument
> > > > >
> > > > > hm, is there a .BTF section in vmlinux?
> > > > >
> > > > > is this working over vmlinux:
> > > > >   $ bpftool btf dump file ./vmlinux
> > > > >
> > > > > do you have a verbose build output? I'd think pahole scream first..
> > > > >
> > > >
> > > > It does.  For me, pahole segfaults at scripts/link-vmlinux.sh:131.  This is
> > > > pretty easy for me to reproduce.  I have logs, what other information would
> > > > be helpful?  How about a pahole backtrace?
> > >
> > > that'd be great.. I'll try to reproduce, but with the latest clang
> > > it will take me some time
> >
> > reproduced, attached pahole patch fixes it for me,
> >
> > looks like gcc never left function without name,
> > which does not seem to be the case for clang
> >
> > I'll send full patch later today
> >
> 
> Thanks for the diff.
> 
> Unfortunately, it does not apply on latest pahole git.
> 
> $ git describe
> v1.19-7-gb688e3597060

sry wrong master.. how about this one

jirka


---
diff --git a/btf_encoder.c b/btf_encoder.c
index 333973054b61..17f7a14f2ef0 100644
--- a/btf_encoder.c
+++ b/btf_encoder.c
@@ -72,6 +72,8 @@ static int collect_function(struct btf_elf *btfe, GElf_Sym *sym)
 
 	if (elf_sym__type(sym) != STT_FUNC)
 		return 0;
+	if (!elf_sym__name(sym, btfe->symtab))
+		return 0;
 
 	if (functions_cnt == functions_alloc) {
 		functions_alloc = max(1000, functions_alloc * 3 / 2);
@@ -730,9 +732,11 @@ int cu__encode_btf(struct cu *cu, int verbose, bool force,
 		if (!has_arg_names(cu, &fn->proto))
 			continue;
 		if (functions_cnt) {
-			struct elf_function *func;
+			const char *name = function__name(fn, cu);
+			struct elf_function *func = NULL;
 
-			func = find_function(btfe, function__name(fn, cu));
+			if (name)
+				func = find_function(btfe, name);
 			if (!func || func->generated)
 				continue;
 			func->generated = true;
-- 
2.26.2




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux