diff options
| author | Yonghong Song <yhs@fb.com> | 2019-09-18 03:49:07 +0000 |
|---|---|---|
| committer | Yonghong Song <yhs@fb.com> | 2019-09-18 03:49:07 +0000 |
| commit | c68ee0ce70438c267f802b1c2f19cf011414c0c0 (patch) | |
| tree | f4181a82674c573fb6e99e934d5e53ee40dea8e8 /llvm/lib/Target | |
| parent | 4a07336a886d6fa908ee19d72abe0ecb3732b377 (diff) | |
| download | bcm5719-llvm-c68ee0ce70438c267f802b1c2f19cf011414c0c0.tar.gz bcm5719-llvm-c68ee0ce70438c267f802b1c2f19cf011414c0c0.zip | |
[BPF] Permit all user instructed offset relocatiions
Currently, not all user specified relocations
(with clang intrinsic __builtin_preserve_access_index())
will turn into relocations.
In the current implementation, a __builtin_preserve_access_index()
chain is turned into relocation only if the result of the clang
intrinsic is used in a function call or a nonzero offset computation
of getelementptr. For all other cases, the relocatiion request
is ignored and the __builtin_preserve_access_index() is turned
into regular getelementptr instructions.
The main reason is to mimic bpf_probe_read() requirement.
But there are other use cases where relocatable offset is
generated but not used for bpf_probe_read(). This patch
relaxed previous constraints when to generate relocations.
Now, all user __builtin_preserve_access_index() will have
relocations generated.
Differential Revision: https://reviews.llvm.org/D67688
llvm-svn: 372198
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index e4f29fbb3db..c682c46fe31 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -375,6 +375,8 @@ void BPFAbstractMemberAccess::traceAICall(CallInst *Call, uint32_t Kind, traceGEP(GI, Call, Kind, ParentMeta, ParentAI); else BaseAICalls[Call] = Kind; + } else { + BaseAICalls[Call] = Kind; } } } @@ -406,6 +408,8 @@ void BPFAbstractMemberAccess::traceBitCast(BitCastInst *BitCast, traceGEP(GI, Parent, Kind, ParentMeta, ParentAI); else BaseAICalls[Parent] = Kind; + } else { + BaseAICalls[Parent] = Kind; } } } @@ -436,6 +440,8 @@ void BPFAbstractMemberAccess::traceGEP(GetElementPtrInst *GEP, CallInst *Parent, traceGEP(GI, Parent, Kind, ParentMeta, ParentAI); else BaseAICalls[Parent] = Kind; + } else { + BaseAICalls[Parent] = Kind; } } } |

