From b2b655561cd37c17971b071b705fb07b57056b1f Mon Sep 17 00:00:00 2001 From: whh8b <whh8b@git.zephyr-software.com> Date: Mon, 17 Aug 2015 23:41:59 +0000 Subject: [PATCH] Move plugin into its own module. --- .gitattributes | 4 -- zipr_large_only_plugin/SConscript | 59 ----------------- zipr_large_only_plugin/SConstruct | 55 ---------------- zipr_large_only_plugin/large_only.cpp | 91 --------------------------- zipr_large_only_plugin/large_only.h | 79 ----------------------- 5 files changed, 288 deletions(-) delete mode 100644 zipr_large_only_plugin/SConscript delete mode 100644 zipr_large_only_plugin/SConstruct delete mode 100644 zipr_large_only_plugin/large_only.cpp delete mode 100644 zipr_large_only_plugin/large_only.h diff --git a/.gitattributes b/.gitattributes index 782ca106c..01d43119f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,3 @@ /set_ida_server -text /start_dev.sh -text /svn.externals.uva_dev -text -zipr_large_only_plugin/SConscript -text -zipr_large_only_plugin/SConstruct -text -zipr_large_only_plugin/large_only.cpp -text -zipr_large_only_plugin/large_only.h -text diff --git a/zipr_large_only_plugin/SConscript b/zipr_large_only_plugin/SConscript deleted file mode 100644 index ead2f5919..000000000 --- a/zipr_large_only_plugin/SConscript +++ /dev/null @@ -1,59 +0,0 @@ -import shutil -import os -import tarfile - -Import('env') - - -#print 'env=' -#print env.Dump() - - - -myenv=env -myenv.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME']) -myenv.Replace(ZIPR_HOME=os.environ['ZIPR_HOME']) -myenv.Replace(ZIPR_SDK=os.environ['ZIPR_SDK']) -myenv.Replace(ZIPR_INSTALL=os.environ['ZIPR_INSTALL']) -myenv.Replace(do_cgc=ARGUMENTS.get("do_cgc",0)) - -if 'do_cgc' in env and int(env['do_cgc']) == 1: - myenv.Append(CFLAGS=" -DCGC ") - myenv.Append(CCFLAGS=" -DCGC ") - - - - -files= ''' - large_only.cpp - ''' - -# ELFIO needs to be first so we get the zipr version instead of the sectrans version. the zipr version is modified to include get_offset. -cpppath=''' - . - $ZIPR_HOME/third_party/ELFIO/elfio-2.2 - $SECURITY_TRANSFORMS_HOME/include/ - $SECURITY_TRANSFORMS_HOME/libIRDB/include/ - $SECURITY_TRANSFORMS_HOME/beaengine/include - $SECURITY_TRANSFORMS_HOME/beaengine/beaengineSources/Includes/ - $SECURITY_TRANSFORMS_HOME/tools/transforms - $ZIPR_HOME/include/ - $ZIPR_SDK/include/ - ''' - -libs=''' - ''' - -libpath=''' - $SECURITY_TRANSFORMS_HOME/lib - ''' - -myenv.Append(CCFLAGS=" -Wall ") - -myenv=myenv.Clone(CPPPATH=Split(cpppath), LIBS=Split(libs), LIBPATH=Split(libpath), SHLIBSUFFIX=".zpi", SHLIBPREFIX="") -lib=myenv.SharedLibrary("large_only", Split(files)) - -install=myenv.Install("$ZIPR_INSTALL/plugins/", lib) -Default(install) - - diff --git a/zipr_large_only_plugin/SConstruct b/zipr_large_only_plugin/SConstruct deleted file mode 100644 index 1ef882f00..000000000 --- a/zipr_large_only_plugin/SConstruct +++ /dev/null @@ -1,55 +0,0 @@ -import os -import sys - - -env=Environment() - -# default build options -env.Replace(CFLAGS="-fPIC -w ") -env.Replace(CXXFLAGS="-fPIC -w ") -env.Replace(LINKFLAGS="-fPIC ") - -# parse arguments -env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME']) -env.Replace(ZIPR_HOME=os.environ['ZIPR_HOME']) -env.Replace(ZIPR_INSTALL=os.environ['ZIPR_INSTALL']) -env.Replace(ZIPR_SDK=os.environ['ZIPR_SDK']) -env.Replace(debug=ARGUMENTS.get("debug",0)) -env.Replace(do_64bit_build=ARGUMENTS.get("do_64bit_build",0)) - - -if int(env['debug']) == 1: - print "Setting debug mode" - env.Append(CFLAGS=" -g") - env.Append(CXXFLAGS=" -g") - env.Append(LINKFLAGS=" -g") -else: - print "Setting release mode" - env.Append(CFLAGS=" -O3") - env.Append(CXXFLAGS=" -O3") - env.Append(LINKFLAGS=" -O3") -#env.Append(CXXFLAGS=" -std=c++0x") - -# set 32/64 bit build properly -#print "env[64bit]="+str(env['do_64bit_build']) -#if env['do_64bit_build'] is None: -# print 'Defaulting to default compilation size.' -#elif int(env['do_64bit_build']) == 1: -# print 'Using 64-bit compilation size.' -# env.Append(CFLAGS=" -m64") -# env.Append(CXXFLAGS=" -m64") -# env.Append(LINKFLAGS=" -m64") -# env.Append(SHLINKFLAGS=" -m64") -#else: -# print 'Using 32-bit compilation size.' -# env.Append(CFLAGS=" -m32") -# env.Append(CXXFLAGS=" -m32") -# env.Append(LINKFLAGS=" -m32") -# env.Append(SHLINKFLAGS=" -m32") - -env['build_appfw']=0 -env['build_tools']=0 - -Export('env') -SConscript("SConscript", variant_dir='build') - diff --git a/zipr_large_only_plugin/large_only.cpp b/zipr_large_only_plugin/large_only.cpp deleted file mode 100644 index f20c40f98..000000000 --- a/zipr_large_only_plugin/large_only.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2014 Zephyr Software LLC. All rights reserved. - * - * This software is furnished under a license and/or other restrictive - * terms and may be used and copied only in accordance with such terms - * and the inclusion of the above copyright notice. This software or - * any other copies thereof may not be provided or otherwise made - * available to any other person without the express written consent - * of an authorized representative of Zephyr Software LCC. Title to, - * ownership of, and all rights in the software is retained by - * Zephyr Software LCC. - * - * Zephyr Software LLC. Proprietary Information - * - * Unless otherwise specified, the information contained in this - * directory, following this legend, and/or referenced herein is - * Zephyr Software LLC. (Zephyr) Proprietary Information. - * - * CONTACT - * - * For technical assistance, contact Zephyr Software LCC. at: - * - * - * Zephyr Software, LLC - * 2040 Tremont Rd - * Charlottesville, VA 22911 - * - * E-mail: jwd@zephyr-software.com - **************************************************************************/ - - -#include <zipr_sdk.h> -#include <string> -#include <algorithm> -#include "utils.hpp" -#include "Rewrite_Utility.hpp" -#include "large_only.h" - -using namespace libIRDB; -using namespace std; -using namespace Zipr_SDK; -using namespace ELFIO; - -LargeOnly_t::LargeOnly_t(MemorySpace_t *p_ms, - elfio *p_elfio, - FileIR_t *p_firp, - Options_t *p_opts, - InstructionLocationMap_t *p_fil) : - m_memory_space(*p_ms), - m_elfio(*p_elfio), - m_firp(*p_firp), - m_opts(*p_opts), - final_insn_locations(*p_fil) -{ -} - -void LargeOnly_t::RemoveSmallMemorySpaces(void) -{ - Range_t removableRange; - Range_t largeRange; - if (m_opts.GetVerbose()) - cout << "Starting to remove all small memory spaces." << endl; - while (m_memory_space.GetRangeCount() != 0) - { - removableRange = m_memory_space.GetFreeRange(0); - if (removableRange.GetEnd() == -1) - largeRange = removableRange; - m_memory_space.RemoveFreeRange(removableRange); - if (m_opts.GetVerbose()) - cout << "Memory space size: " - << m_memory_space.GetRangeCount() - << endl; - } - m_memory_space.AddFreeRange(largeRange); - if (m_opts.GetVerbose()) - { - cout << "After removing all small memory spaces:" << endl; - m_memory_space.PrintMemorySpace(cout); - } -} - -extern "C" -Zipr_SDK::ZiprPluginInterface_t* GetPluginInterface( - Zipr_SDK::MemorySpace_t *p_ms, - ELFIO::elfio *p_elfio, - libIRDB::FileIR_t *p_firp, - Zipr_SDK::Options_t *p_opts, - Zipr_SDK::InstructionLocationMap_t *p_fil) -{ - return new LargeOnly_t(p_ms,p_elfio,p_firp,p_opts,p_fil); -} diff --git a/zipr_large_only_plugin/large_only.h b/zipr_large_only_plugin/large_only.h deleted file mode 100644 index fcb0cb62e..000000000 --- a/zipr_large_only_plugin/large_only.h +++ /dev/null @@ -1,79 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2014 Zephyr Software LLC. All rights reserved. - * - * This software is furnished under a license and/or other restrictive - * terms and may be used and copied only in accordance with such terms - * and the inclusion of the above copyright notice. This software or - * any other copies thereof may not be provided or otherwise made - * available to any other person without the express written consent - * of an authorized representative of Zephyr Software LCC. Title to, - * ownership of, and all rights in the software is retained by - * Zephyr Software LCC. - * - * Zephyr Software LLC. Proprietary Information - * - * Unless otherwise specified, the information contained in this - * directory, following this legend, and/or referenced herein is - * Zephyr Software LLC. (Zephyr) Proprietary Information. - * - * CONTACT - * - * For technical assistance, contact Zephyr Software LCC. at: - * - * - * Zephyr Software, LLC - * 2040 Tremont Rd - * Charlottesville, VA 22911 - * - * E-mail: jwd@zephyr-software.com - **************************************************************************/ - -#ifndef large_only_h -#define large_only_h - -#include <libIRDB-core.hpp> - -class LargeOnly_t : public Zipr_SDK::ZiprPluginInterface_t -{ - public: - LargeOnly_t(Zipr_SDK::MemorySpace_t *p_ms, - ELFIO::elfio *p_elfio, - libIRDB::FileIR_t *p_firp, - Zipr_SDK::Options_t *p_opts, - Zipr_SDK::InstructionLocationMap_t *p_fil); - virtual void PinningBegin() - { - } - virtual void PinningEnd() - { - cout<<"Push64Plugin: Ending pinning, applying push64 relocs."<<endl; - RemoveSmallMemorySpaces(); - } - virtual void DollopBegin() - { - } - virtual void DollopEnd() - { - } - virtual void CallbackLinkingBegin() - { - } - virtual void CallbackLinkingEnd() - { - } - - private: - void RemoveSmallMemorySpaces(void); - // references to input - Zipr_SDK::MemorySpace_t &m_memory_space; - ELFIO::elfio& m_elfio; - libIRDB::FileIR_t& m_firp; - Zipr_SDK::Options_t& m_opts; - Zipr_SDK::InstructionLocationMap_t &final_insn_locations; - - // local data. - libIRDB::InstructionSet_t plopped_relocs; - -}; - -#endif -- GitLab