socsvn commit: r272764 - soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw

dpl at FreeBSD.org dpl at FreeBSD.org
Thu Aug 21 11:52:19 UTC 2014


Author: dpl
Date: Thu Aug 21 11:52:18 2014
New Revision: 272764
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272764

Log:
  Added boilerplate to JIT compile, and get crfree only when using FreeBSD

Modified:
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Aug 21 10:54:39 2014	(r272763)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Aug 21 11:52:18 2014	(r272764)
@@ -18,6 +18,7 @@
 #include <llvm/IR/Value.h>
 #include <llvm/Support/MemoryBuffer.h>
 #include <llvm/Support/ErrorOr.h>
+#include <llvm/Support/TargetSelect.h>
 #define _KERNEL
 
 extern "C" {
@@ -270,7 +271,9 @@
 		// Functions declared at bitcode.
 		printfFunc = mod->getFunction("printf");
 		ipfw_find_rule = mod->getFunction("ipfw_find_rule");
+#ifdef __FreeBSD__
 		crfree = mod->getFunction("crfree");
+#endif
 	}
 
 	// Allocate and initialize LLVM vars.
@@ -833,11 +836,14 @@
 extern "C" funcptr
 compile_code(struct ip_fw_args *args, struct ip_fw_chain *chain)
 {
-	ipfwJIT compiler(args, chain);
-
 	int res;
 	int f_pos = 0;
 
+	InitializeNativeTarget();
+	LLVMLinkInJIT();
+
+	ipfwJIT compiler(args, chain);
+
 	// Fill up needed local variables.
 	compiler.emit_lookpkt_call();
 


More information about the svn-soc-all mailing list