Last active
June 1, 2016 19:23
-
-
Save Flakebi/ed0fccee6021c28746096b2b08d21902 to your computer and use it in GitHub Desktop.
A patch to fix the SymFuzz build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/analyzer/pin.ml b/src/analyzer/pin.ml | |
index 7a0103f..fd90576 100644 | |
--- a/src/analyzer/pin.ml | |
+++ b/src/analyzer/pin.ml | |
@@ -12,7 +12,7 @@ let pin_path = | |
let instrumentor_path = | |
let path = | |
if Nativeint.size = 64 then | |
- Filename.concat toolroot "src/instrumentor/obj-intel64/symfuzz.so" | |
+ Filename.concat toolroot "src/instrumentor/obj-ia64/symfuzz.so" | |
else | |
Filename.concat toolroot "src/instrumentor/obj-ia32/symfuzz.so" | |
in | |
@@ -33,7 +33,6 @@ let execute vector logdir id sockname filenames debug_flag binname = | |
[ | |
pin_path; | |
(* "-pause_tool"; "10"; *) | |
- "-ifeellucky"; | |
"-t"; instrumentor_path; | |
"-d"; logdir; | |
"-o"; instrumentor_logpath; | |
diff --git a/src/instrumentor/main.cpp b/src/instrumentor/main.cpp | |
index bd64bf2..d5c449d 100644 | |
--- a/src/instrumentor/main.cpp | |
+++ b/src/instrumentor/main.cpp | |
@@ -65,9 +65,12 @@ public: | |
fd_type( const char* path, unsigned long pos ): | |
filename(path), position(pos) | |
{ | |
- // How to get the file size in c++ | |
- ifstream file(path, ios::binary | ios::ate); | |
- totalsize = file.tellg(); | |
+ struct stat st; | |
+ int fd = open( path, O_RDONLY); | |
+ if ( fd < 0 ) error_exit( "failed to construct fd_type" ); | |
+ fstat( fd, &st ); | |
+ close( fd ); | |
+ totalsize = (unsigned long) st.st_size; | |
} | |
fd_type( const fd_type& rhs ): | |
filename(rhs.filename), | |
@@ -544,7 +547,6 @@ VOID SyscallEntry( THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v ) | |
p_tls->arg1 = PIN_GetSyscallArgument( ctxt, std, 1 ); | |
p_tls->arg2 = PIN_GetSyscallArgument( ctxt, std, 2 ); | |
break; | |
-#ifdef SYS__llseek | |
case SYS__llseek: | |
p_tls->arg0 = PIN_GetSyscallArgument( ctxt, std, 0 ); | |
p_tls->arg1 = PIN_GetSyscallArgument( ctxt, std, 1 ); | |
@@ -552,7 +554,6 @@ VOID SyscallEntry( THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v ) | |
p_tls->arg3 = PIN_GetSyscallArgument( ctxt, std, 3 ); | |
p_tls->arg4 = PIN_GetSyscallArgument( ctxt, std, 4 ); | |
break; | |
-#endif | |
default: | |
break; | |
} | |
@@ -652,12 +653,10 @@ VOID SyscallExit( THREADID tid, CONTEXT* ctxt, SYSCALL_STANDARD std, VOID* v ) | |
case SYS_lseek: | |
syscall_post_lseek( p_tls->arg0, PIN_GetSyscallReturn( ctxt, std ) ); | |
break; | |
-#ifdef SYS__llseek | |
case SYS__llseek: | |
syscall_post__llseek( p_tls->arg0, p_tls->arg3, | |
PIN_GetSyscallReturn( ctxt, std ) ); | |
break; | |
-#endif | |
default: | |
break; | |
} | |
diff --git a/src/instrumentor/makefile.rules b/src/instrumentor/makefile.rules | |
index 513e994..c732614 100644 | |
--- a/src/instrumentor/makefile.rules | |
+++ b/src/instrumentor/makefile.rules | |
@@ -73,7 +73,7 @@ LIB_ROOTS := | |
# This section contains the build rules for all binaries that have special build rules. | |
# See makefile.default.rules for the default build rules. | |
-OCAMLPATH = $(shell ocamlfind printconf stdlib) | |
+OCAMLPATH = $(shell ocamlfind printconf path)/ocaml | |
TOOLS := $(TEST_TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX)) $(TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX)) | |
SRCS := $(wildcard *.cpp) | |
OBJS := $(SRCS:%.cpp=$(OBJDIR)%.o) | |
@@ -82,7 +82,6 @@ LIBANALYSIS_PATH := ../_build | |
LIBANALYSIS_FLAG := -Wl,--no-undefined -L$(OCAMLPATH) -L$(LIBANALYSIS_PATH) -lanalysis -lunix -lasmrun | |
ANALYSIS_API := $(OBJDIR)analysis_api$(OBJ_SUFFIX) | |
DBG=-g | |
-TOOL_CXXFLAGS += -fabi-version=2 -D_GLIBCXX_USE_CXX11_ABI=0 | |
$(OBJDIR)%$(OBJ_SUFFIX): %.cpp | |
$(CXX) $(TOOL_CXXFLAGS) $(DBG) $(COMP_OBJ)$@ $< | |
diff --git a/src/pinapi/makefile.rules b/src/pinapi/makefile.rules | |
index 7497d62..5eb9d36 100644 | |
--- a/src/pinapi/makefile.rules | |
+++ b/src/pinapi/makefile.rules | |
@@ -73,7 +73,7 @@ LIB_ROOTS := | |
# This section contains the build rules for all binaries that have special build rules. | |
# See makefile.default.rules for the default build rules. | |
-OCAMLPATH = $(shell ocamlfind printconf stdlib) | |
+OCAMLPATH = $(shell ocamlfind printconf path)/ocaml | |
TOOLS := $(TEST_TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX)) $(TOOL_ROOTS:%=$(OBJDIR)%$(PINTOOL_SUFFIX)) | |
SRCS := $(wildcard *.cpp) | |
OBJS := $(SRCS:%.cpp=$(OBJDIR)%.o) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment