Re: [PATCH bpf-next 06/12] selftests/bpf: Fix selftests failure

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

 





On 5/8/22 7:21 PM, Dave Marchevsky wrote:
On 5/1/22 3:00 PM, Yonghong Song wrote:
The kflag is supported now for BTF_KIND_ENUM.
So remove the test which tests verifier failure
due to existence of kflag.

With enum64 support in kernel and libbpf,
selftest btf_dump/btf_dump failed with
no-enum64 support llvm for the following
enum definition:
  enum e2 {
         C = 100,
         D = 4294967295,
         E = 0,
  };

With the no-enum64 support llvm, the signedness is
'signed' by default, and D (4294967295 = 0xffffffff)
will print as -1. With enum64 support llvm, the signedness
is 'unsigned' and the value of D will print as 4294967295.

To confirm my understanding, this signedness-by-default change is for _printing
btf in c format only_ and doesn't correspond to any difference in interpretation
, since all BTF enums before addition of new kflag were assumed to be signed,
and new kflag's default value is signed as well.

Yes, the signedness is only used for printing in C format. For
values, the signedness is really depending on corresponding declaration
type or the context where the value is used.

In the next revision, I may change the default signedness to be unsigned
to cover common case like
   enum {
      A = 0,
      B, C, D, ...
   }


To support both old and new compilers, this patch
changed the value to 268435455 = 0xfffffff which works
with both enum64 or non-enum64 support llvm.

Signed-off-by: Yonghong Song <yhs@xxxxxx>
---

Aside from the general question, for changes in this patch:

Acked-by: Dave Marchevsky <davemarchevsky@xxxxxx>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux