summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-10-10 15:33:09 +0000
committerYonghong Song <yhs@fb.com>2019-10-10 15:33:09 +0000
commitd46a6a9e6865ef71f754d8bcaae5205cf484856d (patch)
tree08aadd8d663a62a88d6fbad47898da3c93330baa /llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
parent4abac53302775af3c5ed396883207b5b45ba030f (diff)
downloadbcm5719-llvm-d46a6a9e6865ef71f754d8bcaae5205cf484856d.tar.gz
bcm5719-llvm-d46a6a9e6865ef71f754d8bcaae5205cf484856d.zip
[BPF] Remove relocation for patchable externs
Previously, patchable extern relocations are introduced to patch external variables used for multi versioning in compile once, run everywhere use case. The load instruction will be converted into a move with an patchable immediate which can be changed by bpf loader on the host. The kernel verifier has evolved and is able to load and propagate constant values, so compiler relocation becomes unnecessary. This patch removed codes related to this. Differential Revision: https://reviews.llvm.org/D68760 llvm-svn: 374367
Diffstat (limited to 'llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp')
-rw-r--r--llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp19
1 files changed, 3 insertions, 16 deletions
diff --git a/llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp b/llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
index b363179e25b..3321464a1dd 100644
--- a/llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
+++ b/llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
@@ -11,19 +11,15 @@
// ldd r2, r1, 0
// add r3, struct_base_reg, r2
//
-// Here @global should either present a AMA (abstruct member access) or
-// a patchable extern variable. And these two kinds of accesses
-// are subject to bpf load time patching. After this pass, the
+// Here @global should represent an AMA (abstruct member access).
+// Such an access is subject to bpf load time patching. After this pass, the
// code becomes
// ld_imm64 r1, @global
// add r3, struct_base_reg, r1
//
// Eventually, at BTF output stage, a relocation record will be generated
// for ld_imm64 which should be replaced later by bpf loader:
-// r1 = <calculated offset> or <to_be_patched_extern_val>
-// add r3, struct_base_reg, r1
-// or
-// ld_imm64 r1, <to_be_patched_extern_val>
+// r1 = <calculated field_info>
// add r3, struct_base_reg, r1
//
//===----------------------------------------------------------------------===//
@@ -120,15 +116,6 @@ bool BPFMISimplifyPatchable::removeLD() {
if (GVar->hasAttribute(BPFCoreSharedInfo::AmaAttr)) {
assert(ImmVal == 0);
IsCandidate = true;
- } else if (!GVar->hasInitializer() && GVar->hasExternalLinkage() &&
- GVar->getSection() ==
- BPFCoreSharedInfo::PatchableExtSecName) {
- if (ImmVal == 0)
- IsCandidate = true;
- else
- errs() << "WARNING: unhandled patchable extern "
- << GVar->getName() << " with load offset " << ImmVal
- << "\n";
}
}
}
OpenPOWER on IntegriCloud