Subject: Re: FAILED unresolved symbol vfs_truncate on arm64 with LLVM

From: Jiri Olsa <[email-masked]>
Date: Tue, 9 Feb 2021 17:13:38 +0100

On Tue, Feb 09, 2021 at 04:09:36PM +0100, Jiri Olsa wrote:

SNIP

> > > > >                 DW_AT_prototyped        (true)
> > > > >                 DW_AT_type      (0x01cfdfe4 "long int")
> > > > >                 DW_AT_external  (true)
> > > > >
> > > > 
> > > > Ok, the problem appears to be not in DWARF, but in mcount_loc data.
> > > > vfs_truncate's address is not recorded as ftrace-attachable, and thus
> > > > pahole ignores it. I don't know why this happens and it's quite
> > > > strange, given vfs_truncate is just a normal global function.
> > 
> > right, I can't see it in mcount adresses.. but it begins with instructions
> > that appears to be nops, which would suggest it's traceable
> > 
> > 	ffff80001031f430 <vfs_truncate>:
> > 	ffff80001031f430: 5f 24 03 d5   hint    #34
> > 	ffff80001031f434: 1f 20 03 d5   nop
> > 	ffff80001031f438: 1f 20 03 d5   nop
> > 	ffff80001031f43c: 3f 23 03 d5   hint    #25
> > 
> > > > 
> > > > I'd like to understand this issue before we try to fix it, but there
> > > > is at least one improvement we can make: pahole should check ftrace
> > > > addresses only for static functions, not the global ones (global ones
> > > > should be always attachable, unless they are special, e.g., notrace
> > > > and stuff). We can easily check that by looking at the corresponding
> > > > symbol. But I'd like to verify that vfs_truncate is ftrace-attachable
> 
> I'm still trying to build the kernel.. however ;-)

I finally reproduced.. however arm's not using mcount_loc
but some other special section.. so it's new mess for me

however I tried the same build without LLVM=1 and it passed,
so my guess is that clang is doing something unexpected

jirka