OSDN Git Service

[bpf] allow direct and indirect calls
authorAlexei Starovoitov <alexei.starovoitov@gmail.com>
Sun, 19 Nov 2017 01:35:00 +0000 (01:35 +0000)
committerAlexei Starovoitov <alexei.starovoitov@gmail.com>
Sun, 19 Nov 2017 01:35:00 +0000 (01:35 +0000)
commitb5cbc7760ab82c55ee8b340624c9119dfc592e26
treef9b152293d9cadc1a6fdac0219725bed1dc3895e
parent83b54ba25b0372c793ab98fc00c37cbf01571601
[bpf] allow direct and indirect calls

kernel verifier is becoming smarter and soon will support
direct and indirect function calls.
Remove obsolete error from BPF backend.
Make call to use PCRel_4 fixup.
'bpf to bpf' calls are distinguished from 'bpf to kernel' calls
by insn->src_reg == BPF_PSEUDO_CALL == 1 which is used as relocation
indicator similar to ld_imm64->src_reg == BPF_PSEUDO_MAP_FD == 1
The actual 'call' instruction remains the same for both
'bpf to kernel' and 'bpf to bpf' calls.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318614 91177308-0d34-0410-b5e6-96231b3b80d8
12 files changed:
lib/Target/BPF/BPFISelLowering.cpp
lib/Target/BPF/BPFInstrInfo.td
lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
test/CodeGen/BPF/cc_args.ll
test/CodeGen/BPF/cc_args_be.ll
test/CodeGen/BPF/cc_ret.ll
test/CodeGen/BPF/fi_ri.ll
test/CodeGen/BPF/sanity.ll
test/CodeGen/BPF/undef.ll
test/CodeGen/BPF/warn-call.ll