Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling PIN tool with dependencies

As the title states, I am looking for a way to make compile my PIN tool with some dependencies. So for example if I #include "somefile.h" in my PIN tool, and generate some object file g++ -c somefile.cpp, how do I link my object file to compile with my PIN tool so I can use it's functionality in my PIN tool?

like image 575
TypeKazt Avatar asked Sep 10 '25 21:09

TypeKazt


1 Answers

So I was able to find some documentation on altering the "makefile.rules" under PIN's website here. For my situation these 6 lines below would be added to the end of "makefile.rules".

$(OBJDIR)"somefile"$(OBJ_SUFFIX): "somefile".cpp "somefile".h
    $(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

$(OBJDIR)"PinFile"$(OBJ_SUFFIX): "pin_tool".cpp
    $(CXX) $(TOOL_CXXFLAGS) $(COMP_OBJ)$@ $<

$(OBJDIR)"pin_tool"$(PINTOOL_SUFFIX): $(OBJDIR)"somefile"$(OBJ_SUFFIX) $(OBJDIR)"PinFile"$(OBJ_SUFFIX) "somefile".h
    $(LINKER) $(TOOL_LDFLAGS_NOOPT) $(LINK_EXE)$@ $(^:%.h=) $(TOOL_LPATHS) $(TOOL_LIBS)

The only thing that would change from one make file to another would be the words I put in quotes. Note that the quoted words should not have quotes around them in the actual "makefile.rules"

like image 161
TypeKazt Avatar answered Sep 13 '25 17:09

TypeKazt