Skip to content
Snippets Groups Projects
Commit 872f26ac authored by jdh8d's avatar jdh8d
Browse files

updates to build libstars.a for linking with irdb xforms.

Former-commit-id: 80e6a405cf3a55069877419544b71d2e17a851ac
parent 71002cb5
No related branches found
No related tags found
No related merge requests found
......@@ -1058,6 +1058,12 @@ tools/inferfn/SConstruct -text
tools/inferfn/inferfn.cpp -text
tools/inferfn/inferfn.hpp -text
tools/inferfn/inferfn_driver.cpp -text
tools/kill_deads/Makefile.in -text
tools/kill_deads/SConscript -text
tools/kill_deads/SConstruct -text
tools/kill_deads/kill_deads.cpp -text
tools/kill_deads/kill_deads.hpp -text
tools/kill_deads/kill_deads_driver.cpp -text
tools/meds2pdb/Makefile.in -text
tools/meds2pdb/SConscript -text
tools/meds2pdb/SConstruct -text
......
......@@ -80,6 +80,13 @@ libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
libtransform=SConscript("libtransform/SConscript", variant_dir='scons_build/libtransform')
libIRDB=SConscript("libIRDB/SConscript", variant_dir='scons_build/libIRDB')
if 'build_stars' in env and int(env['build_stars']) == 1:
stars_path=os.environ['SMPSA_HOME']
stars_sconscript=os.path.join(stars_path,"SConscript");
argenv=env.Clone()
Export('argenv')
libstars=SConscript(stars_sconscript, variant_dir='scons_build/stars')
if 'build_tools' not in env or env['build_tools'] is None or int(env['build_tools']) == 1:
SConscript("tools/SConscript", variant_dir='scons_build/tools')
......
......@@ -15,10 +15,12 @@ env.Replace(LINKFLAGS="-fPIC -w ")
# parse arguments
env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
env.Replace(SMPSA_HOME=os.environ['SMPSA_HOME'])
env.Replace(do_64bit_build=ARGUMENTS.get("do_64bit_build",None))
env.Replace(debug=ARGUMENTS.get("debug",0))
env.Replace(build_appfw=ARGUMENTS.get("build_appfw", 1))
env.Replace(build_tools=ARGUMENTS.get("build_tools", 1))
env.Replace(build_stars=ARGUMENTS.get("build_stars", 1))
env.Replace(build_cgc=ARGUMENTS.get("build_cgc", 0))
......
......@@ -17,6 +17,7 @@ dirs='''
watch_syscall
cookbook
dump_map
kill_deads
'''
cgc_dirs='''
c2e
......
PROGS=fix_rets.exe
CXX=@CXX@
CXXFLAGS=
INCLUDE=-I. -I../include -I../xform -I../../beaengine/include -I../../libIRDB/include/ -I../../libMEDSannotation/include/ -I../libtransform/include/ -I../transforms
CXXFLAGS= @EXTRA_CXXFLAGS@ $(INCLUDE) -Wall
LIBS=-L../../lib -lxform -lIRDB-core -lIRDB-cfg -lBeaEngine_s_d -lpqxx -lMEDSannotation -ltransform -lpq
OBJS=fix_rets.o fix_rets_driver.o
programs=fix_rets.exe
.SUFFIXES: .o .c .exe .cpp .hpp
all: $(programs)
@echo "---------------------------------------------"
@echo "- Fix Rets directory -- Build complete -"
@echo "---------------------------------------------"
-include $(OBJS:.o=.d)
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp
@#
@# build dependencies -- http://scottmcpeak.com/autodepend/autodepend.html
@#
@cpp -M $(CXXFLAGS) $*.cpp > $*.d || true
@cp -f $*.d $*.d.tmp
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
clean:
rm -f *.o core *.exe
$(programs): ../../lib/*.a
fix_rets.exe: $(OBJS)
$(CXX) $(CXXFLAGS) $^ $(INCLUDE) $(LIBS) -o $@
import os
Import('env')
myenv=env.Clone()
myenv.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
cpppath='''
$SECURITY_TRANSFORMS_HOME/include
$SECURITY_TRANSFORMS_HOME/libIRDB/include
$SECURITY_TRANSFORMS_HOME/libMEDSannotation/include
$SECURITY_TRANSFORMS_HOME/beaengine/include
$SECURITY_TRANSFORMS_HOME/tools/transforms
$SMPSA_HOME/include
'''
files=Glob( Dir('.').srcnode().abspath+"/*.cpp")
pgm="kill_deads.exe"
LIBPATH="$SECURITY_TRANSFORMS_HOME/lib"
LIBS=Split("stars "+ env.subst('$BASE_IRDB_LIBS')+ " IRDB-cfg IRDB-util transform rewrite MEDSannotation ")
myenv=myenv.Clone(CPPPATH=Split(cpppath))
pgm=myenv.Program(pgm, files, LIBPATH=LIBPATH, LIBS=LIBS)
#install=myenv.Install("$SECURITY_TRANSFORMS_HOME/bin/", pgm)
install=myenv.Install("$SECURITY_TRANSFORMS_HOME/plugins_install/", pgm)
Default(install)
env=Environment()
Export('env')
lib=SConscript("SConscript")
/*
* Copyright (c) 2014, 2015 - University of Virginia
*
* This file may be used and modified for non-commercial purposes as long as
* all copyright, permission, and nonwarranty notices are preserved.
* Redistribution is prohibited without prior written consent from the University
* of Virginia.
*
* Please contact the authors for restrictions applying to commercial use.
*
* THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Author: University of Virginia
* e-mail: jwd@virginia.com
* URL : http://www.cs.virginia.edu/
*
*/
#include "kill_deads.hpp"
#include <assert.h>
#include <stars.h>
using namespace libTransform;
using namespace libIRDB;
using namespace STARS;
using namespace std;
KillDeads::KillDeads(FileIR_t *p_variantIR, pqxxDB_t& p_dbinterface)
:
Transform(NULL, p_variantIR, NULL),
dbinterface(p_dbinterface)
{
}
int KillDeads::execute()
{
IRDB_Interface_t stars_analysis_engine(dbinterface);
stars_analysis_engine.do_STARS(getFileIR());
}
/*
* Copyright (c) 2014, 2015 - University of Virginia
*
* This file may be used and modified for non-commercial purposes as long as
* all copyright, permission, and nonwarranty notices are preserved.
* Redistribution is prohibited without prior written consent from the University
* of Virginia.
*
* Please contact the authors for restrictions applying to commercial use.
*
* THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Author: University of Virginia
* e-mail: jwd@virginia.com
* URL : http://www.cs.virginia.edu/
*
*/
#ifndef _LIBTRANSFORM_KILL_DEADS_H
#define _LIBTRANSFORM_KILL_DEADS_H
#include <libIRDB-core.hpp>
#include "../../libtransform/include/transform.hpp"
#include "../../libMEDSannotation/include/VirtualOffset.hpp"
class KillDeads : public libTransform::Transform
{
public:
KillDeads(libIRDB::FileIR_t *p_variantIR, libIRDB::pqxxDB_t &p_dbinterface);
int execute();
private:
libIRDB::pqxxDB_t &dbinterface;
};
#endif
/*
* Copyright (c) 2014, 2015 - University of Virginia
*
* This file may be used and modified for non-commercial purposes as long as
* all copyright, permission, and nonwarranty notices are preserved.
* Redistribution is prohibited without prior written consent from the University
* of Virginia.
*
* Please contact the authors for restrictions applying to commercial use.
*
* THIS SOURCE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Author: University of Virginia
* e-mail: jwd@virginia.com
* URL : http://www.cs.virginia.edu/
*
*/
#include <stdlib.h>
#include <fstream>
#include <libIRDB-core.hpp>
#include <libgen.h>
#include "kill_deads.hpp"
using namespace std;
using namespace libIRDB;
void usage(char* name)
{
cerr<<"Usage: "<<name<<" <variant_id>\n";
}
int main(int argc, char **argv)
{
if(argc != 2)
{
usage(argv[0]);
exit(1);
}
string programName(argv[0]);
int variantID = atoi(argv[1]);
VariantID_t *pidp=NULL;
/* setup the interface to the sql server */
pqxxDB_t pqxx_interface;
BaseObj_t::SetInterface(&pqxx_interface);
pidp=new VariantID_t(variantID);
assert(pidp->IsRegistered()==true);
cout<<"ret_shadow_stack.exe started\n";
bool one_success = false;
for(set<File_t*>::iterator it=pidp->GetFiles().begin();
it!=pidp->GetFiles().end();
++it)
{
File_t* this_file = *it;
FileIR_t *firp = new FileIR_t(*pidp, this_file);
cout<<"Transforming "<<this_file->GetURL()<<endl;
assert(firp && pidp);
try
{
KillDeads kill_deads(firp, pqxx_interface);
int success=kill_deads.execute();
if (success)
{
cout<<"Writing changes for "<<this_file->GetURL()<<endl;
one_success = true;
firp->WriteToDB();
delete firp;
}
else
{
cout<<"Skipping (no changes) "<<this_file->GetURL()<<endl;
}
}
catch (DatabaseError_t pnide)
{
cerr << programName << ": Unexpected database error: " << pnide << "file url: " << this_file->GetURL() << endl;
}
catch (...)
{
cerr << programName << ": Unexpected error file url: " << this_file->GetURL() << endl;
}
} // end file iterator
// if any integer transforms for any files succeeded, we commit
if (one_success)
{
cout<<"Commiting changes...\n";
pqxx_interface.Commit();
}
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment