aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-02-01 21:00:00 -0800
committerYonghong Song <yhs@fb.com>2020-02-04 08:53:03 -0800
commit6d07802d63a8589447de0a697696447a583de9d8 (patch)
tree9113bd562f1fb105271ed6e63ea8c28508bbaada /llvm/lib/CodeGen/MachineFunction.cpp
parent386fd2c170a78798a097650b8714183d5a9d93c6 (diff)
downloadllvm-6d07802d63a8589447de0a697696447a583de9d8.zip
llvm-6d07802d63a8589447de0a697696447a583de9d8.tar.gz
llvm-6d07802d63a8589447de0a697696447a583de9d8.tar.bz2
[BPF] handle typedef of struct/union for CO-RE relocations
Linux commit https://github.com/torvalds/linux/commit/1cf5b23988ea0086a252a5c8b005b075f1e9b030#diff-289313b9fec99c6f0acfea19d9cfd949 uses "#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record)" to apply CO-RE relocations to all records including the following pattern: #pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record) typedef struct { int a; } __t; #pragma clang attribute pop int test(__t *arg) { return arg->a; } The current approach to use struct/union type in the relocation record will result in an anonymous struct, which make later type matching difficult in bpf loader. In fact, current BPF backend will fail the above program with assertion: clang: ../lib/Target/BPF/BPFAbstractMemberAccess.cpp:796: ... Assertion `TypeName.size()' failed. clang will change to use the type of the base of the member access which will preserve the typedef modifier for the preserve_{struct,union}_access_index intrinsics in the above example. Here we adjust BPF backend to accept that the debuginfo type metadata may be 'typedef' and handle them properly. Differential Revision: https://reviews.llvm.org/D73902
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
0 files changed, 0 insertions, 0 deletions