1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/lib/Target/BPF
Yonghong Song a6c7bc9945 bpf: avoid load from read-only sections
If users tried to have a structure decl/init code like below
   struct test_t t = { .memeber1 = 45 };
It is very likely that compiler will generate a readonly section
to hold up the init values for variable t. Later load of t members,
e.g., t.member1 will result in a read from readonly section.

BPF program cannot handle relocation. This will force users to
write:
  struct test_t t = {};
  t.member1 = 45;
This is just inconvenient and unintuitive.

This patch addresses this issue by implementing BPF PreprocessISelDAG.
For any load from a global constant structure or an global array of
constant struct, it attempts to
translate it into a constant directly. The traversal of the
constant struct and other constant data structures are similar
to where the assembler emits read-only sections.

Four different unit test cases are also added to cover
different scenarios.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 305560
2017-06-16 15:41:16 +00:00
..
Disassembler Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
InstPrinter Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
MCTargetDesc Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
TargetInfo Move the global variables representing each Target behind accessor function 2016-10-09 23:00:34 +00:00
BPF.h
BPF.td convert bpf assembler to look like kernel verifier output 2016-11-18 02:32:35 +00:00
BPFAsmPrinter.cpp bpf: clang-format on BPFAsmPrinter.cpp 2017-06-13 16:17:20 +00:00
BPFCallingConv.td
BPFFrameLowering.cpp
BPFFrameLowering.h Change eliminateCallFramePseudoInstr() to return an iterator 2016-03-31 18:33:38 +00:00
BPFInstrFormats.td
BPFInstrInfo.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
BPFInstrInfo.h Finish renaming remaining analyzeBranch functions 2016-09-14 20:43:16 +00:00
BPFInstrInfo.td bpf: set missing types in insn tablegen file 2017-06-16 15:30:55 +00:00
BPFISelDAGToDAG.cpp bpf: avoid load from read-only sections 2017-06-16 15:41:16 +00:00
BPFISelLowering.cpp [bpf] disallow global_addr+off folding 2017-05-26 22:32:41 +00:00
BPFISelLowering.h [bpf] disallow global_addr+off folding 2017-05-26 22:32:41 +00:00
BPFMCInstLower.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
BPFMCInstLower.h [bpf] error when unknown bpf helper is called 2017-01-17 07:26:17 +00:00
BPFRegisterInfo.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
BPFRegisterInfo.h
BPFRegisterInfo.td
BPFSubtarget.cpp
BPFSubtarget.h Rename TargetSelectionDAGInfo into SelectionDAGTargetInfo and move it to CodeGen/ 2016-01-27 16:32:26 +00:00
BPFTargetMachine.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
BPFTargetMachine.h Delete Reloc::Default. 2016-05-18 22:04:49 +00:00
CMakeLists.txt [BPF] Correct the file name of the -gen-asm-matcher output file to not start with X86. 2017-05-31 19:01:05 +00:00
LLVMBuild.txt [bpf] add BPF disassembler 2016-11-20 02:25:00 +00:00