Commit fdb0ace2 authored by Brenden Blanco's avatar Brenden Blanco

Add #define for ".bpf.fn."

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent ba7dd24e
...@@ -76,7 +76,7 @@ using std::unique_ptr; ...@@ -76,7 +76,7 @@ using std::unique_ptr;
using std::vector; using std::vector;
using namespace llvm; using namespace llvm;
const string BPFModule::FN_PREFIX = ".bpf.fn."; const string BPFModule::FN_PREFIX = BPF_FN_PREFIX;
// Snooping class to remember the sections as the JIT creates them // Snooping class to remember the sections as the JIT creates them
class MyMemoryManager : public SectionMemoryManager { class MyMemoryManager : public SectionMemoryManager {
......
...@@ -1166,7 +1166,7 @@ StatusTuple CodegenLLVM::visit_func_decl_stmt_node(FuncDeclStmtNode *n) { ...@@ -1166,7 +1166,7 @@ StatusTuple CodegenLLVM::visit_func_decl_stmt_node(FuncDeclStmtNode *n) {
Function *fn = mod_->getFunction(n->id_->name_); Function *fn = mod_->getFunction(n->id_->name_);
if (fn) return mkstatus_(n, "Function %s already defined", n->id_->c_str()); if (fn) return mkstatus_(n, "Function %s already defined", n->id_->c_str());
fn = Function::Create(fn_type, GlobalValue::ExternalLinkage, n->id_->name_, mod_); fn = Function::Create(fn_type, GlobalValue::ExternalLinkage, n->id_->name_, mod_);
fn->setSection(".bpf.fn." + n->id_->name_); fn->setSection(BPF_FN_PREFIX + n->id_->name_);
BasicBlock *label_entry = BasicBlock::Create(ctx(), "entry", fn); BasicBlock *label_entry = BasicBlock::Create(ctx(), "entry", fn);
B.SetInsertPoint(label_entry); B.SetInsertPoint(label_entry);
......
...@@ -37,6 +37,8 @@ class StructType; ...@@ -37,6 +37,8 @@ class StructType;
class SwitchInst; class SwitchInst;
} }
#define BPF_FN_PREFIX ".bpf.fn."
namespace ebpf { namespace ebpf {
namespace cc { namespace cc {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment