diff --git a/SConstruct b/SConstruct index 4d1a659fb11f64da7bb6349e5551267505527453..50b543904a0e0fb832848c06bb2f8481fb698923 100644 --- a/SConstruct +++ b/SConstruct @@ -39,24 +39,32 @@ if 'build_cgc' in env and int(env['build_cgc']) == 1: env.Append(LINKFLAGS=" -DCGC ") - - # 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") + 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.Append(CFLAGS=" -m32 ") + env.Append(CXXFLAGS=" -m32 ") + env.Append(LINKFLAGS=" -m32 ") + env.Append(SHLINKFLAGS=" -m32 ") + + + +# add extra flag for solaris. +(sysname, nodename, release, version, machine)=os.uname() +if sysname == "SunOS": + env.Append(LINKFLAGS=" -L/opt/csw/lib ") + env.Append(CFLAGS=" -I/opt/csw/include ") + env.Append(CXXFLAGS=" -I/opt/csw/include ") + Export('env') SConscript("SConscript", variant_dir='build') diff --git a/beaengine/SConscript b/beaengine/SConscript index 900dcacb20e22459b0e3a5b1077b64a97b8766c5..8590b6c8f2db54a085c3dfe82e91bc63692721af 100644 --- a/beaengine/SConscript +++ b/beaengine/SConscript @@ -16,7 +16,7 @@ cpppath=''' #print 'myenv[cflags]='+str(myenv['CFLAGS']) #print 'myenv=\n' #print myenv.Dump() -myenv=myenv.Clone(CPPPATH=Split(cpppath)) +myenv=myenv.Clone(CPPPATH=Split(cpppath), CC="$CXX" ) lib=myenv.Library("BeaEngine_s_d", Split(files)) install=myenv.Install("$SECURITY_TRANSFORMS_HOME/lib/", lib) diff --git a/beaengine/beaengineSources/BeaEngine.c b/beaengine/beaengineSources/BeaEngine.c index a66025fa616f6cf75ee9e57ba0d5dbc5116de1fd..4c21ac43ade7ba57db1b91573100887fae5a2b40 100644 --- a/beaengine/beaengineSources/BeaEngine.c +++ b/beaengine/beaengineSources/BeaEngine.c @@ -1,57 +1,57 @@ -/* - * BeaEngine 4 - x86 & x86-64 disassembler library - * - * Copyright 2006-2010, BeatriX - * File coded by BeatriX - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "beaengine/BeaEngine.h" -#include "Includes/protos.h" -#include "Includes/internal_datas.h" -#include "Includes/instr_set/Data_opcode.h" -#include "Includes/instr_set/opcodes_A_M.c" -#include "Includes/instr_set/opcodes_N_Z.c" -#include "Includes/instr_set/opcodes_Grp1.c" -#include "Includes/instr_set/opcodes_Grp2.c" -#include "Includes/instr_set/opcodes_Grp3.c" -#include "Includes/instr_set/opcodes_Grp4.c" -#include "Includes/instr_set/opcodes_Grp5.c" -#include "Includes/instr_set/opcodes_Grp6.c" -#include "Includes/instr_set/opcodes_Grp7.c" -#include "Includes/instr_set/opcodes_Grp8.c" -#include "Includes/instr_set/opcodes_Grp9.c" -#include "Includes/instr_set/opcodes_Grp12.c" -#include "Includes/instr_set/opcodes_Grp13.c" -#include "Includes/instr_set/opcodes_Grp14.c" -#include "Includes/instr_set/opcodes_Grp15.c" -#include "Includes/instr_set/opcodes_Grp16.c" -#include "Includes/instr_set/opcodes_FPU.c" -#include "Includes/instr_set/opcodes_MMX.c" -#include "Includes/instr_set/opcodes_SSE.c" -#include "Includes/instr_set/opcodes_AES.c" -#include "Includes/instr_set/opcodes_CLMUL.c" -#include "Includes/instr_set/opcodes_VEX.c" -#include "Includes/instr_set/opcodes_prefixes.c" -#include "Includes/Routines_ModRM.c" -#include "Includes/Routines_Disasm.c" -#include "Includes/BeaEngineVersion.c" - -void BeaEngine(void){return;} +/* + * BeaEngine 4 - x86 & x86-64 disassembler library + * + * Copyright 2006-2010, BeatriX + * File coded by BeatriX + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "beaengine/BeaEngine.h" +#include "Includes/protos.h" +#include "Includes/internal_datas.h" +#include "Includes/instr_set/Data_opcode.h" +#include "Includes/instr_set/opcodes_A_M.c" +#include "Includes/instr_set/opcodes_N_Z.c" +#include "Includes/instr_set/opcodes_Grp1.c" +#include "Includes/instr_set/opcodes_Grp2.c" +#include "Includes/instr_set/opcodes_Grp3.c" +#include "Includes/instr_set/opcodes_Grp4.c" +#include "Includes/instr_set/opcodes_Grp5.c" +#include "Includes/instr_set/opcodes_Grp6.c" +#include "Includes/instr_set/opcodes_Grp7.c" +#include "Includes/instr_set/opcodes_Grp8.c" +#include "Includes/instr_set/opcodes_Grp9.c" +#include "Includes/instr_set/opcodes_Grp12.c" +#include "Includes/instr_set/opcodes_Grp13.c" +#include "Includes/instr_set/opcodes_Grp14.c" +#include "Includes/instr_set/opcodes_Grp15.c" +#include "Includes/instr_set/opcodes_Grp16.c" +#include "Includes/instr_set/opcodes_FPU.c" +#include "Includes/instr_set/opcodes_MMX.c" +#include "Includes/instr_set/opcodes_SSE.c" +#include "Includes/instr_set/opcodes_AES.c" +#include "Includes/instr_set/opcodes_CLMUL.c" +#include "Includes/instr_set/opcodes_VEX.c" +#include "Includes/instr_set/opcodes_prefixes.c" +#include "Includes/Routines_ModRM.c" +#include "Includes/Routines_Disasm.c" +#include "Includes/BeaEngineVersion.c" + +void BeaEngine(void){return;} diff --git a/beaengine/include/beaengine/basic_types.h b/beaengine/include/beaengine/basic_types.h index 80e46f9157e6555a6548f829b0fbb4c279a300b2..4d080dfd0d71f4ba88846f34525af8725e16ab0c 100644 --- a/beaengine/include/beaengine/basic_types.h +++ b/beaengine/include/beaengine/basic_types.h @@ -1,272 +1,272 @@ -/** - * @file basic_types.h - * @author <igor.gutnik@gmail.com> - * @date Thu Dec 24 19:31:22 2009 - * - * @brief Definitions of fixed-size integer types for various platforms - * - * This file is part of BeaEngine. - * - * BeaEngine is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * BeaEngine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef __BEA_BASIC_TYPES_HPP__ -#define __BEA_BASIC_TYPES_HPP__ - -#include <stddef.h> - -#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) -#include <stdint.h> -#endif - -#if defined(_MSC_VER) && !defined(__BORLANDC__) - /* - * Windows/Visual C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed __int64 Int64; - typedef unsigned __int64 UInt64; - #if defined(_WIN64) - #define BEA_PTR_IS_64_BIT 1 - typedef signed __int64 IntPtr; - typedef unsigned __int64 UIntPtr; - #else - typedef signed long IntPtr; - typedef size_t UIntPtr; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__POCC__) - /* - * PellesC - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long long Int64; - typedef unsigned long long UInt64; - #if defined(_WIN64) - #define BEA_PTR_IS_64_BIT 1 - typedef signed long long IntPtr; - typedef unsigned long long UIntPtr; - #else - typedef signed long IntPtr; - typedef size_t UIntPtr; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__GNUC__) || defined(__LCC__) - /* - * Unix/GCC - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef intptr_t IntPtr; - typedef uintptr_t UIntPtr; - #if defined(__LP64__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) - typedef __int64 Int64; - typedef unsigned __int64 UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__DECCXX) - /* - * Compaq C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed __int64 Int64; - typedef unsigned __int64 UInt64; - #if defined(__VMS) - #if defined(__32BITS) - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #else - typedef Int64 IntPtr; - typedef UInt64 UIntPtr; - #define BEA_PTR_IS_64_BIT 1 - #endif - #else - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__HP_aCC) - /* - * HP Ansi C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__LP64__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) - /* - * SUN Forte C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__sparcv9) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__IBMCPP__) - /* - * IBM XL C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if defined(__64BIT__) - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#elif defined(__BORLANDC__) - /* - * Borland C/C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef unsigned __int64 Int64; - typedef signed __int64 UInt64; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #define BEA_HAVE_INT64 1 -#elif defined(__WATCOMC__) - /* - * Watcom C/C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef unsigned __int64 Int64; - typedef signed __int64 UInt64; - #define BEA_HAVE_INT64 1 - typedef size_t UIntPtr; -#elif defined(__sgi) - /* - * MIPSpro C++ - */ - typedef signed char Int8; - typedef unsigned char UInt8; - typedef signed short Int16; - typedef unsigned short UInt16; - typedef signed int Int32; - typedef unsigned int UInt32; - typedef signed long IntPtr; - typedef unsigned long UIntPtr; - #if _MIPS_SZLONG == 64 - #define BEA_PTR_IS_64_BIT 1 - #define BEA_LONG_IS_64_BIT 1 - typedef signed long Int64; - typedef unsigned long UInt64; - #else - typedef signed long long Int64; - typedef unsigned long long UInt64; - #endif - #define BEA_HAVE_INT64 1 -#endif - -#if defined(_MSC_VER) || defined(__BORLANDC__) - #define W64LIT(x) x##ui64 -#else - #define W64LIT(x) x##ULL -#endif - - -#ifndef C_STATIC_ASSERT -#define C_STATIC_ASSERT(tag_name, x) \ - typedef int cache_static_assert_ ## tag_name[(x) * 2-1] -#endif - -C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); -C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); - -C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); -C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); - -C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); -C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); - -C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); -C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); - -#endif +/** + * @file basic_types.h + * @author <igor.gutnik@gmail.com> + * @date Thu Dec 24 19:31:22 2009 + * + * @brief Definitions of fixed-size integer types for various platforms + * + * This file is part of BeaEngine. + * + * BeaEngine is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BeaEngine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef __BEA_BASIC_TYPES_HPP__ +#define __BEA_BASIC_TYPES_HPP__ + +#include <stddef.h> + +#if defined(__GNUC__) || defined (__INTEL_COMPILER) || defined(__LCC__) || defined(__POCC__) +#include <stdint.h> +#endif + +#if defined(_MSC_VER) && !defined(__BORLANDC__) + /* + * Windows/Visual C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed __int64 Int64; + typedef unsigned __int64 UInt64; + #if defined(_WIN64) + #define BEA_PTR_IS_64_BIT 1 + typedef signed __int64 IntPtr; + typedef unsigned __int64 UIntPtr; + #else + typedef signed long IntPtr; + typedef size_t UIntPtr; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__POCC__) + /* + * PellesC + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long long Int64; + typedef unsigned long long UInt64; + #if defined(_WIN64) + #define BEA_PTR_IS_64_BIT 1 + typedef signed long long IntPtr; + typedef unsigned long long UIntPtr; + #else + typedef signed long IntPtr; + typedef size_t UIntPtr; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__GNUC__) || defined(__LCC__) + /* + * Unix/GCC + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef intptr_t IntPtr; + typedef uintptr_t UIntPtr; + #if defined(__LP64__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + #if defined (__INTEL_COMPILER) || defined (__ICC) || defined (_ICC) + typedef __int64 Int64; + typedef unsigned __int64 UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__DECCXX) + /* + * Compaq C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed __int64 Int64; + typedef unsigned __int64 UInt64; + #if defined(__VMS) + #if defined(__32BITS) + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #else + typedef Int64 IntPtr; + typedef UInt64 UIntPtr; + #define BEA_PTR_IS_64_BIT 1 + #endif + #else + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__HP_aCC) + /* + * HP Ansi C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__LP64__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) + /* + * SUN Forte C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__sparcv9) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__IBMCPP__) + /* + * IBM XL C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if defined(__64BIT__) + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#elif defined(__BORLANDC__) + /* + * Borland C/C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef unsigned __int64 Int64; + typedef signed __int64 UInt64; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #define BEA_HAVE_INT64 1 +#elif defined(__WATCOMC__) + /* + * Watcom C/C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef unsigned __int64 Int64; + typedef signed __int64 UInt64; + #define BEA_HAVE_INT64 1 + typedef size_t UIntPtr; +#elif defined(__sgi) + /* + * MIPSpro C++ + */ + typedef signed char Int8; + typedef unsigned char UInt8; + typedef signed short Int16; + typedef unsigned short UInt16; + typedef signed int Int32; + typedef unsigned int UInt32; + typedef signed long IntPtr; + typedef unsigned long UIntPtr; + #if _MIPS_SZLONG == 64 + #define BEA_PTR_IS_64_BIT 1 + #define BEA_LONG_IS_64_BIT 1 + typedef signed long Int64; + typedef unsigned long UInt64; + #else + typedef signed long long Int64; + typedef unsigned long long UInt64; + #endif + #define BEA_HAVE_INT64 1 +#endif + +#if defined(_MSC_VER) || defined(__BORLANDC__) + #define W64LIT(x) x##ui64 +#else + #define W64LIT(x) x##ULL +#endif + + +#ifndef C_STATIC_ASSERT +#define C_STATIC_ASSERT(tag_name, x) \ + typedef int cache_static_assert_ ## tag_name[(x) * 2-1] +#endif + +C_STATIC_ASSERT(sizeof_Int8 , (sizeof(Int8) == 1)); +C_STATIC_ASSERT(sizeof_UInt8, (sizeof(UInt8) == 1)); + +C_STATIC_ASSERT(sizeof_Int16 , (sizeof(Int16) == 2)); +C_STATIC_ASSERT(sizeof_UInt16, (sizeof(UInt16) == 2)); + +C_STATIC_ASSERT(sizeof_Int32 , (sizeof(Int32) == 4)); +C_STATIC_ASSERT(sizeof_UInt32, (sizeof(UInt32) == 4)); + +C_STATIC_ASSERT(sizeof_Int64 , (sizeof(Int64) == 8)); +C_STATIC_ASSERT(sizeof_UInt64, (sizeof(UInt64) == 8)); + +#endif diff --git a/include/i86pc/config.h b/include/i86pc/config.h index 294979ee85d72df5b7c45c0dc72dd19157770cd0..2201420794ebea787a5ee6bf490f5888fcbe0e12 100644 --- a/include/i86pc/config.h +++ b/include/i86pc/config.h @@ -58,19 +58,17 @@ typedef s_uint64_t counter_t; #define NULL 0 #endif -namespace std { #include <elf.h> -} - -typedef std::Elf32_Ehdr IRDB_Elf_Ehdr; -typedef std::Elf32_Shdr IRDB_Elf_Shdr; -typedef std::Elf32_Off IRDB_Elf_Off; -typedef std::Elf32_Half IRDB_Elf_Half; -typedef std::Elf32_Word IRDB_Elf_Word; -typedef std::Elf32_Addr IRDB_Elf_Addr; -typedef std::Elf32_Sym IRDB_Elf_Sym; -typedef std::Elf32_Rel IRDB_Elf_Rel; -typedef std::Elf32_Rela IRDB_Elf_Rela; + +typedef Elf32_Ehdr IRDB_Elf_Ehdr; +typedef Elf32_Shdr IRDB_Elf_Shdr; +typedef Elf32_Off IRDB_Elf_Off; +typedef Elf32_Half IRDB_Elf_Half; +typedef Elf32_Word IRDB_Elf_Word; +typedef Elf32_Addr IRDB_Elf_Addr; +typedef Elf32_Sym IRDB_Elf_Sym; +typedef Elf32_Rel IRDB_Elf_Rel; +typedef Elf32_Rela IRDB_Elf_Rela; #define IRDB_ELF_ST_TYPE ELF32_ST_TYPE diff --git a/libEXEIO/src/SConscript b/libEXEIO/src/SConscript index 1cd34adcbdcd2dde4e256b3963f0a6615b6615c9..8e84e12f90eac54f1d76c848c63ffb094eedea34 100644 --- a/libEXEIO/src/SConscript +++ b/libEXEIO/src/SConscript @@ -16,7 +16,7 @@ cpppath=''' $SECURITY_TRANSFORMS_HOME/libEXEIO/include ''' -myenv.Append(CCFLAGS="-Wp,-w -Wall") +#myenv.Append(CCFLAGS="-Wp,-w -Wall") myenv=myenv.Clone(CPPPATH=Split(cpppath)) lib=myenv.Library(libname, Split(files)) diff --git a/libIRDB/src/cfg/SConscript b/libIRDB/src/cfg/SConscript index 8119b10ad7e3c8dffad7bf1cc149f2b13dae0d47..ad91f9943222a6955c43e3b83ad6d2d5dfb27d95 100644 --- a/libIRDB/src/cfg/SConscript +++ b/libIRDB/src/cfg/SConscript @@ -17,7 +17,7 @@ cpppath=''' $SECURITY_TRANSFORMS_HOME/beaengine/beaengineSources/Includes/ ''' -myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") +#myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") myenv=myenv.Clone(CPPPATH=Split(cpppath)) lib=myenv.Library(libname, Split(files)) diff --git a/libIRDB/src/cfg/callgraph.cpp b/libIRDB/src/cfg/callgraph.cpp index 858bc5df7d3ca47a3dd40380de39ad8bf249f3c0..4495e529e52a1f39b4eb3447b64810e8eb6aab7e 100644 --- a/libIRDB/src/cfg/callgraph.cpp +++ b/libIRDB/src/cfg/callgraph.cpp @@ -117,7 +117,7 @@ void Callgraph_t::CreateNodes(libIRDB::FileIR_t *firp) } } -void Callgraph_t::AddFile(libIRDB::FileIR_t *firp) +void Callgraph_t::AddFile(libIRDB::FileIR_t* const firp) { // Create CG Nodes from functions CreateNodes(firp); diff --git a/libIRDB/src/core/SConscript b/libIRDB/src/core/SConscript index 09ed0e2f0bae56a51f7abff224bb76c9a4252094..0090dbe1b28707cbc700df8b3f5e06e6c1ec6681 100644 --- a/libIRDB/src/core/SConscript +++ b/libIRDB/src/core/SConscript @@ -28,7 +28,7 @@ cpppath=''' $SECURITY_TRANSFORMS_HOME/beaengine/beaengineSources/Includes/ ''' -myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") +#myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") myenv=myenv.Clone(CPPPATH=Split(cpppath)) mylib=myenv.Library(libname, Split(files)) diff --git a/libIRDB/src/syscall/SConscript b/libIRDB/src/syscall/SConscript index 556175ade5ad8e38bddee8a79f16823d65f4a837..ebf16328edbcd500f055bcf7ea51829f67a77ced 100644 --- a/libIRDB/src/syscall/SConscript +++ b/libIRDB/src/syscall/SConscript @@ -16,7 +16,7 @@ cpppath=''' $SECURITY_TRANSFORMS_HOME/beaengine/beaengineSources/Includes/ ''' -myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") +#myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") myenv=myenv.Clone(CPPPATH=Split(cpppath)) lib=myenv.Library(libname, Split(files)) diff --git a/libIRDB/src/util/SConscript b/libIRDB/src/util/SConscript index b2b7580a70cffa00efa0a5993e3540fe978bb842..777fc63737a9adf02c849d0a066248475afb2ba5 100644 --- a/libIRDB/src/util/SConscript +++ b/libIRDB/src/util/SConscript @@ -16,7 +16,7 @@ cpppath=''' $SECURITY_TRANSFORMS_HOME/beaengine/beaengineSources/Includes/ ''' -myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") +#myenv.Append(CCFLAGS=" -Wall -W -Wextra -Wconversion ") myenv=myenv.Clone(CPPPATH=Split(cpppath)) lib=myenv.Library(libname, Split(files)) diff --git a/tools/memcover/General_Utility.cpp b/tools/memcover/General_Utility.cpp index d5ae5f7719bfb2213fe1fde29ef06aaf8bcf435a..d7b094293c344cbcbfc4c9d6617c910ac2156fb5 100644 --- a/tools/memcover/General_Utility.cpp +++ b/tools/memcover/General_Utility.cpp @@ -32,16 +32,16 @@ STR2NUM_ERROR str2int (int &i, char const *s, int base) errno = 0; l = strtol(s, &end, base); if ((errno == ERANGE && l == LONG_MAX) || l > INT_MAX) { - return OVERFLOW; + return s2n_OVERFLOW; } if ((errno == ERANGE && l == LONG_MIN) || l < INT_MIN) { - return UNDERFLOW; + return s2n_UNDERFLOW; } if (*s == '\0' || *end != '\0') { - return INCONVERTIBLE; + return s2n_INCONVERTIBLE; } i = l; - return SUCCESS; + return s2n_SUCCESS; } //TODO: what if the string represents a negative number? Currently @@ -54,13 +54,13 @@ STR2NUM_ERROR str2uint (unsigned int &i, char const *s, int base) errno = 0; l = strtol(s, &end, base); if ((errno == ERANGE && l == ULONG_MAX) || l > UINT_MAX) { - return OVERFLOW; + return s2n_OVERFLOW; } if (*s == '\0' || *end != '\0') { - return INCONVERTIBLE; + return s2n_INCONVERTIBLE; } i = l; - return SUCCESS; + return s2n_SUCCESS; } void trim(string& str) diff --git a/tools/memcover/General_Utility.hpp b/tools/memcover/General_Utility.hpp index b96732fb046da639f85ea32851e2ad1969210dfa..63a06a38c824ceb46eeca06cd782769939ea4c11 100644 --- a/tools/memcover/General_Utility.hpp +++ b/tools/memcover/General_Utility.hpp @@ -25,7 +25,7 @@ #include <vector> #include <map> -enum STR2NUM_ERROR { SUCCESS, OVERFLOW, UNDERFLOW, INCONVERTIBLE }; +typedef enum STR2NUM_ERROR_t { s2n_SUCCESS, s2n_OVERFLOW, s2n_UNDERFLOW, s2n_INCONVERTIBLE } STR2NUM_ERROR; STR2NUM_ERROR str2int (int &i, char const *s, int base = 0); STR2NUM_ERROR str2uint (unsigned int &i, char const *s, int base = 0); void trim(std::string &str); diff --git a/tools/memcover/memcover.cpp b/tools/memcover/memcover.cpp index eb3a72ad2661e492bba969488028b80c0cd9f66f..71f5247ee1d71e7ed44281002559f4ea2e46ca05 100644 --- a/tools/memcover/memcover.cpp +++ b/tools/memcover/memcover.cpp @@ -561,7 +561,7 @@ int main(int argc, char **argv) } int vid; - if(str2int(vid,argv[1]) != SUCCESS) + if(str2int(vid,argv[1]) != s2n_SUCCESS) { cerr<<"Variant ID ("<<argv[1]<<") could not be parsed as an integer."<<endl; exit(INPUT_ERR_NUM); diff --git a/tools/transforms/SConscript b/tools/transforms/SConscript index 6bf474ee0e0ccc1a94c41ef5a590517db99b6217..5b9a533a29f8c4b16013456c46ef9060868f5d7c 100644 --- a/tools/transforms/SConscript +++ b/tools/transforms/SConscript @@ -24,8 +24,9 @@ LIBPATH="$SECURITY_TRANSFORMS_HOME/lib" integer_files="transformutils.cpp integertransformdriver.cpp" -myenv.Append(CFLAGS="-Wall") -myenv.Append(CCFLAGS="-Wall") +# doesn't work on solaris. +#myenv.Append(CFLAGS="-Wall") +#myenv.Append(CCFLAGS="-Wall") all_files="PNTransformDriver.cpp PNStackLayout.cpp PNRange.cpp Range.cpp OffsetInference.cpp DirectOffsetInference.cpp ScaledOffsetInference.cpp P1Inference.cpp PNRegularExpressions.cpp PNMain.cpp StackLayout.cpp General_Utility.cpp AnnotationBoundaryGenerator.cpp PrecedenceBoundaryInference.cpp PNIrdbManager.cpp" diff --git a/xform/SConscript b/xform/SConscript index f6ac0cab6866294cb689c88c190e98d4af32b0a4..0bff1d5940d4b8314fa98f7077b1153054552432 100644 --- a/xform/SConscript +++ b/xform/SConscript @@ -27,7 +27,7 @@ cpppath=''' CFLAGS="-fPIC -DUBUNTU" -myenv=myenv.Clone(CC="g++", CPPPATH=Split(cpppath), CFLAGS=CFLAGS) +myenv=myenv.Clone(CC="$CXX", CPPPATH=Split(cpppath), CFLAGS=CFLAGS) lib=myenv.Library(lib, Split(files)) install=myenv.Install("$SECURITY_TRANSFORMS_HOME/lib/", lib)