diff --git a/.gitignore b/.gitignore index 160f5ab4f0f16f3fed80e012e75b956c175abb49..34c990bdd7c20ecc073c37ee18470f277d361f75 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ src/libehp.a src/.*.swp src/*.o include/.*.swp +*.os +*.so diff --git a/SConscript b/SConscript index 932057a93c601dc177601a387794d7153b1b8f44..0e75488488e1872d94ecaaf4c0c0ca241ce67156 100644 --- a/SConscript +++ b/SConscript @@ -17,23 +17,24 @@ import os Import('env') +myenv=env.Clone(); -env.Replace(debug=ARGUMENTS.get("debug",0)) -env.Append(CFLAGS=" -DUSE_ELFIO ") -env.Append(CXXFLAGS=" -DUSE_ELFIO ") -if int(env['debug']) == 1: +myenv.Replace(debug=ARGUMENTS.get("debug",0)) +myenv.Append(CFLAGS=" -DUSE_ELFIO=1 ") +myenv.Append(CXXFLAGS=" -DUSE_ELFIO=1 ") +if int(myenv['debug']) == 1: print "Setting debug mode" - env.Append(CFLAGS=" -g ") - env.Append(CXXFLAGS=" -g ") - env.Append(LINKFLAGS=" -g ") + myenv.Append(CFLAGS=" -g ") + myenv.Append(CXXFLAGS=" -g ") + myenv.Append(LINKFLAGS=" -g ") else: print "Setting release mode" - env.Append(CFLAGS=" -O3 ") - env.Append(CXXFLAGS=" -O3 ") - env.Append(LINKFLAGS=" -O3 ") + myenv.Append(CFLAGS=" -O3 ") + myenv.Append(CXXFLAGS=" -O3 ") + myenv.Append(LINKFLAGS=" -O3 ") -lib=SConscript("src/SConscript") +lib=myenv.SConscript("src/SConscript") Return('lib') diff --git a/include/ehp.hpp b/include/ehp.hpp index a67d65380d0891aa1c7dc20798e5ed6072496323..d8d8d387aafb9691e985366c0dfac20ee30fa8f4 100644 --- a/include/ehp.hpp +++ b/include/ehp.hpp @@ -25,6 +25,10 @@ #include <vector> +#ifndef USE_ELFIO +#define USE_ELFIO 1 +#endif + namespace EHP { @@ -196,7 +200,7 @@ class EHFrameParser_t virtual const CIEVector_t* getCIEs() const =0; virtual const FDEContents_t* findFDE(uint64_t addr) const =0; -#ifdef USE_ELFIO +#if USE_ELFIO static unique_ptr<const EHFrameParser_t> factory(const string filename); #endif static unique_ptr<const EHFrameParser_t> factory( diff --git a/src/SConscript b/src/SConscript index 6acef90596544070bd20f769d579f0473869401a..189ce76e6c58aadcd378399fe17a0af42c95086c 100644 --- a/src/SConscript +++ b/src/SConscript @@ -26,20 +26,10 @@ cpppath=''' ''' cpppath=cpppath+Dir('.').srcnode().abspath+'/../third-party/elfio-code' -AddOption('--no_elfio', - dest='no_elfio', - action='store_true', - default=False, - help='Do not use Elfio library to parse elf files') - -cpp_defines={} -if( not GetOption('no_elfio')): - cpp_defines['USE_ELFIO']=1 - LIBPATH="$SECURITY_TRANSFORMS_HOME/lib" LIBS=Split("") -myenv=myenv.Clone(CPPPATH=Split(cpppath),CPPDEFINES=cpp_defines) +myenv=myenv.Clone(CPPPATH=Split(cpppath)) myenv.Append(CXXFLAGS = " -std=c++11 -Wall -Werror -fmax-errors=2 -fPIC ") lib1=myenv.Library("ehp", Split(files), LIBPATH=LIBPATH, LIBS=LIBS) diff --git a/src/ehp.cpp b/src/ehp.cpp index 02b6305dfbbe89d377a224c0245feb17d3d323e6..3e8fe15b188c2acab40b3ed6b22ed6aa7d26a83d 100644 --- a/src/ehp.cpp +++ b/src/ehp.cpp @@ -29,7 +29,11 @@ #include "ehp_priv.hpp" #include "scoop_replacement.hpp" -#ifdef USE_ELFIO +#ifndef USE_ELFIO +#define USE_ELFIO 1 +#endif + +#if USE_ELFIO #include <elfio/elfio.hpp> #endif #include <elf.h> @@ -37,7 +41,7 @@ using namespace std; using namespace EHP; -#ifdef USE_ELFIO +#if USE_ELFIO using namespace ELFIO; #endif @@ -1949,7 +1953,7 @@ const FDEContents_t* split_eh_frame_impl_t<ptrsize>::findFDE(uint64_t addr) cons return raw_ret_ptr; } -#ifdef USE_ELFIO +#if USE_ELFIO unique_ptr<const EHFrameParser_t> EHFrameParser_t::factory(const string filename) { auto elfiop=unique_ptr<elfio>(new elfio);