[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45d2473b-76f6-4450-785e-bcc0a7e4ab5d@solarflare.com>
Date: Thu, 18 Oct 2018 17:47:11 +0100
From: Edward Cree <ecree@...arflare.com>
To: Martin Lau <kafai@...com>, Yonghong Song <yhs@...com>
CC: Alexei Starovoitov <ast@...com>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH bpf-next v2 02/13] bpf: btf: Add BTF_KIND_FUNC and
BTF_KIND_FUNC_PROTO
On 17/10/18 18:50, Martin Lau wrote:
> On Wed, Oct 17, 2018 at 10:25:21AM -0700, Yonghong Song wrote:
>> What you stated is true, BTF_KIND_FUNC_PROTO corresponds to
>> dwarf subroutine tag which has no name while BTF_KIND_FUNC
>> must have a valid name. The original design is to have both
>> since they are corresponding to different dwarf constructs.
>>
>> Martin, what do you think?
> I prefer to have separate kinds. We need a way to distinguish them.
> For example, the BTF verifier is checking it. Having two kinds is
> cleaner instead of resorting to other hints from 'struct btf_type'.
> We don't lack of bits for kind.
But my point is that (a) they can be distinguished by how they are
used, and (b) the _only_ difference between them is how they are
used. In this C code:
int a = 5;
int foo(int x) { return a; }
int *b = &a;
int (*bar)(int) = &foo;
foo and *bar are _the same type_, just as a and *b are. It's just
that C has a slightly odd way of writing
int foo(int) = lambda x: a;
and foo itself is implicitly sorta-const.
What am I missing?
-Ed
Powered by blists - more mailing lists