[PATCH] D83289: [BPF] Emit unknown types as byte arrays

Ilya Leoshkevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 03:23:38 PDT 2020


iii created this revision.
iii added a reviewer: yonghong-song.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.

Some BPF programs compiled on s390 fail to load, because s390
arch-specific linux headers contain float and double types. At the
moment there is no BTF_KIND for floats and doubles, so release version
of LLVM ends up emitting type id 0 for them, which in-kernel verifier
does not accept. This should also be the case for structs and enums
with >=64k members.

Fix by emitting byte arrays instead of real types. Another option would
be to skip the offending types altogether, but this would be
unnecessarily restrictive. Yet another option would be what pahole does

- represent floats and doubles as ints, but that won't cover other

"weird" cases like large structs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83289

Files:
  llvm/lib/Target/BPF/BTFDebug.cpp
  llvm/lib/Target/BPF/BTFDebug.h
  llvm/test/CodeGen/BPF/BTF/double.ll
  llvm/test/CodeGen/BPF/BTF/float.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83289.275975.patch
Type: text/x-patch
Size: 17488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/c5d085bd/attachment.bin>


More information about the llvm-commits mailing list