On Sat, Nov 30, 2013 at 3:47 PM, Qingping Hou <qingpinghou@xxxxxxxxx> wrote: > On 11/29/2013 10:39 PM, Jovi Zhangwei wrote: >> On Sat, Nov 30, 2013 at 4:47 AM, Qingping Hou <dave2008713@xxxxxxxxx> wrote: >>> From: Yicheng Qin <qycqycqycqycqyc@xxxxxxxxx> >>> >>> This patch adds rule to build ffi module into ktap. >>> Also, it introduces FFI flag to enable/disable FFI funtionality. >>> >>> Signed-off-by: Yicheng Qin <qycqycqycqycqyc@xxxxxxxxx> >>> Signed-off-by: Qingping Hou <qingping.hou@xxxxxxxxx> >>> --- >>> Makefile | 34 ++++++++++++++++++++++++++++++++++ >>> 1 file changed, 34 insertions(+) >>> >>> diff --git a/Makefile b/Makefile >>> index 621e125..ee7e8da 100644 >>> --- a/Makefile >>> +++ b/Makefile >>> @@ -3,6 +3,9 @@ >>> # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds) >>> # (this will also disable resolve resolving symbols in DSO functionality) >>> # >>> +# Define FFI if you want to compile ktap with FFI support. By default This >>> +# toggle is off. >>> +# >>> # Define amalg to enable amalgamation build, This compiles the ktapvm as >>> # one huge C file and allows GCC to generate faster and shorter code. Alas, >>> # this requires lots of memory during the build. >>> @@ -20,20 +23,35 @@ all: mod ktap >>> INC = include >>> INTP = interpreter >>> >>> + >>> +FFIDIR = $(INTP)/ffi >>> KTAP_LIBS = -lpthread >>> >>> LIB_OBJS += $(INTP)/lib_base.o $(INTP)/lib_kdebug.o $(INTP)/lib_timer.o \ >>> $(INTP)/lib_ansi.o >>> >>> ifndef amalg >>> +ifdef FFI >>> +FFI_OBJS += $(FFIDIR)/ffi_call.o $(FFIDIR)/ffi_type.o >>> $(FFIDIR)/ffi_symbol.o \ >>> + $(FFIDIR)/call_x86_64.o $(FFIDIR)/cdata.o $(FFIDIR)/ffi_util.o >>> +INTP_OBJS += $(FFI_OBJS) >>> +LIB_OBJS += $(INTP)/lib_ffi.o >>> +endif >>> INTP_OBJS += $(INTP)/ktap.o $(INTP)/kp_load.o $(INTP)/kp_obj.o \ >>> $(INTP)/kp_str.o $(INTP)/kp_tab.o $(INTP)/kp_vm.o \ >>> $(INTP)/kp_opcode.o $(INTP)/kp_transport.o \ >>> $(LIB_OBJS) >>> else >>> +ifdef FFI >>> +INTP_OBJS += $(FFIDIR)/call_x86_64.o >>> +endif >> >> Why not include ffi/call_x86_64.c into kp_amalg.c? >> > > That's actually assembly code used for setting hardware stack, it's > ffi/call_x86_64.S. We connot think of a good way to integrate it with > kp_amalog.c :( > Understand, so would you please add a comments in here? I didn't recognize that's a .S file in Makefile. Thanks. Jovi