1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00
llvm-mirror/lib/Target/BPF
Yonghong Song 09dda61130 [BPF] fix typedef issue for offset relocation
Currently, the CO-RE offset relocation does not work
if any struct/union member or array element is a typedef.
For example,
  typedef const int arr_t[7];
  struct input {
      arr_t a;
  };
  func(...) {
       struct input *in = ...;
       ... __builtin_preserve_access_index(&in->a[1]) ...
  }
The BPF backend calculated default offset is 0 while
4 is the correct answer. Similar issues exist for struct/union
typedef's.

When getting struct/union member or array element type,
we should trace down to the type by skipping typedef
and qualifiers const/volatile as this is what clang did
to generate getelementptr instructions.
(const/volatile member type qualifiers are already
ignored by clang.)

This patch fixed this issue, for each access index,
skipping typedef and const/volatile/restrict BTF types.

Signed-off-by: Yonghong Song <yhs@fb.com>

Differential Revision: https://reviews.llvm.org/D65259

llvm-svn: 367062
2019-07-25 21:47:27 +00:00
..
AsmParser Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
Disassembler Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
MCTargetDesc Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
TargetInfo Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
BPF.h [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BPF.td [BPF] add code-gen support for JMP32 instructions 2019-02-07 10:43:09 +00:00
BPFAbstractMemberAccess.cpp [BPF] fix CO-RE incorrect index access string 2019-07-25 16:01:26 +00:00
BPFAsmPrinter.cpp [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BPFCallingConv.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFCORE.h [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BPFFrameLowering.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFFrameLowering.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFInstrFormats.td [BPF] add code-gen support for JMP32 instructions 2019-02-07 10:43:09 +00:00
BPFInstrInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFInstrInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFInstrInfo.td bpf: enable sub-register code-gen for XADD 2019-02-28 19:21:28 +00:00
BPFISelDAGToDAG.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFISelLowering.cpp [BPF] add code-gen support for JMP32 instructions 2019-02-07 10:43:09 +00:00
BPFISelLowering.h [TargetLowering] Change getOptimalMemOpType to take a function attribute list 2019-04-30 08:38:12 +00:00
BPFMCInstLower.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFMCInstLower.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFMIChecking.cpp bpf: enable sub-register code-gen for XADD 2019-02-28 19:21:28 +00:00
BPFMIPeephole.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFMISimplifyPatchable.cpp [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BPFRegisterInfo.cpp CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
BPFRegisterInfo.h CodeGen: Introduce a class for registers 2019-06-24 15:50:29 +00:00
BPFRegisterInfo.td Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFSelectionDAGInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFSelectionDAGInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BPFSubtarget.cpp [BPF] add code-gen support for JMP32 instructions 2019-02-07 10:43:09 +00:00
BPFSubtarget.h [BPF] add code-gen support for JMP32 instructions 2019-02-07 10:43:09 +00:00
BPFTargetMachine.cpp [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BPFTargetMachine.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BTF.def [BPF] Add BTF Var and DataSec Support 2019-03-16 15:36:31 +00:00
BTF.h [BPF] Support for compile once and run everywhere 2019-07-09 15:28:41 +00:00
BTFDebug.cpp [BPF] fix typedef issue for offset relocation 2019-07-25 21:47:27 +00:00
BTFDebug.h [BPF] fix typedef issue for offset relocation 2019-07-25 21:47:27 +00:00
CMakeLists.txt [BPF] Fix a typo in the file name 2019-07-09 18:35:46 +00:00
LLVMBuild.txt [BPF] Move InstPrinter files to MCTargetDesc. NFC 2019-05-11 01:13:21 +00:00