Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1530703

Re: [PATCH v3 19/30] perf clang jit: Insignt BPF and JIT functions in a Module

From Alexei Starovoitov <alexei.starovoitov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 19/30] perf clang jit: Insignt BPF and JIT functions in a Module
Date 2016-11-26 18:40 +0100
Message-ID <sHP7c-189-23@gated-at.bofh.it> (permalink)
References <sHFhv-3nx-5@gated-at.bofh.it> <sHFhw-3nx-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Nov 26, 2016 at 07:03:43AM +0000, Wang Nan wrote:
> Identify BPF functions, JIT functions and maps during init. Functions in
> section starting with "perfhook:" are JIT functions. They will be JIT
> compiled and hooked at perfhooks.
> 
> During init of PerfModule, mark JIT functions as AvailableExternallyLinkage.
> LLVM skips functions with linkage like this so they won't be compiled
> into BPF objects.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
...
> +void PerfModule::prepareBPF(void)
> +{
> +	for (llvm::Function *F : JITFunctions)
> +		F->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage);
> +	for (llvm::Function *F : BPFFunctions)
> +		F->setLinkage(llvm::GlobalValue::ExternalLinkage);
> +
> +}
> +
> +void PerfModule::prepareJIT(void)
> +{
> +	for (llvm::Function *F : BPFFunctions)
> +		F->setLinkage(llvm::GlobalValue::AvailableExternallyLinkage);
> +	for (llvm::Function *F : JITFunctions)
> +		F->setLinkage(llvm::GlobalValue::ExternalLinkage);
> +
> +}

Nice trick.
Please document it in the perf+llvm design doc.

Acked-by: Alexei Starovoitov <ast@kernel.org>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v3 19/30] perf clang jit: Insignt BPF and JIT functions in a Module Wang Nan <wangnan0@huawei.com> - 2016-11-26 08:10 +0100
  Re: [PATCH v3 19/30] perf clang jit: Insignt BPF and JIT functions  in a Module Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-26 18:40 +0100

csiph-web