From: <ped...@us...> - 2007-11-18 16:33:16
|
Revision: 1075 http://cegcc.svn.sourceforge.net/cegcc/?rev=1075&view=rev Author: pedroalves Date: 2007-11-18 08:33:11 -0800 (Sun, 18 Nov 2007) Log Message: ----------- Initial release. * Makefile, README, common.h, driver.cpp, makemsvc.sh, msvc.cpp, msvc.h, msvc.obj: New files. Added Paths: ----------- trunk/cegcc/tools/abicheck/ trunk/cegcc/tools/abicheck/ChangeLog trunk/cegcc/tools/abicheck/Makefile trunk/cegcc/tools/abicheck/README trunk/cegcc/tools/abicheck/common.h trunk/cegcc/tools/abicheck/driver.cpp trunk/cegcc/tools/abicheck/makemsvc.sh trunk/cegcc/tools/abicheck/msvc.cpp trunk/cegcc/tools/abicheck/msvc.h trunk/cegcc/tools/abicheck/msvc.obj Added: trunk/cegcc/tools/abicheck/ChangeLog =================================================================== --- trunk/cegcc/tools/abicheck/ChangeLog (rev 0) +++ trunk/cegcc/tools/abicheck/ChangeLog 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,5 @@ +2007-11-18 Pedro Alves <ped...@po...> + + Initial release. + * Makefile, README, common.h, driver.cpp, makemsvc.sh, msvc.cpp, + msvc.h, msvc.obj: New files. Property changes on: trunk/cegcc/tools/abicheck/ChangeLog ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/Makefile =================================================================== --- trunk/cegcc/tools/abicheck/Makefile (rev 0) +++ trunk/cegcc/tools/abicheck/Makefile 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,32 @@ +TARGET=arm-wince-mingw32ce +CXX=$(TARGET)-g++ +STRIP=$(TARGET)-strip +CXXFLAGS=-O3 + +OBJECTS=driver.o + +all: driver_gcc.exe + +msvc: + makemsvc.sh + +all-msvc: msvc all + +msvc.obj: + +.cpp.o: + $(CXX) $< -o $@ $(CXXFLAGS) -c + +driver_gcc_unstripped.exe: $(OBJECTS) msvc.obj + $(CXX) $(OBJECTS) msvc.obj -o $@ $(CXXFLAGS) + +driver_gcc.exe: driver_gcc_unstripped.exe + $(STRIP) $< -o $@ + +clean: + rm -f $(OBJECTS) driver_gcc.exe driver_gcc_unstripped.exe *~ + +clean-msvc: clean + rm -f msvc.obj + +.PHONY: all clean Property changes on: trunk/cegcc/tools/abicheck/Makefile ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/README =================================================================== --- trunk/cegcc/tools/abicheck/README (rev 0) +++ trunk/cegcc/tools/abicheck/README 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,13 @@ +A simple ABI checker. It isn't very smart, or automatic, but +serves the immediate purpose. + +The idea is to have gcc built code interfacing with MSVC +built code, and ensuring the the arguments are passed +correctly to both sides. + +msvc.obj is built with MSVC. Since access to a MSVC is limited, +the object file is kept in the repository. + +To build, type `make'. If you're changing the msvc.cpp file, be sure +to have access to an MSVC that can output ARM WinCE code, and type +`make all-msvc'. Property changes on: trunk/cegcc/tools/abicheck/README ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/common.h =================================================================== --- trunk/cegcc/tools/abicheck/common.h (rev 0) +++ trunk/cegcc/tools/abicheck/common.h 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,39 @@ +#ifndef COMMON_H +#define COMMON_H + +#include <windows.h> +struct struct64 +{ + __int64 value; +}; + +struct struct32 +{ + int value; +}; + +struct T1 +{ + unsigned short f1; + int f2; + char f3; + char f4; +}; + +struct T2 +{ + unsigned short f1; + __int64 f2; + char f3; + char f4; +}; + +struct T3 +{ + unsigned short f1; + double f2; + char f3; + char f4; +}; + +#endif Property changes on: trunk/cegcc/tools/abicheck/common.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/driver.cpp =================================================================== --- trunk/cegcc/tools/abicheck/driver.cpp (rev 0) +++ trunk/cegcc/tools/abicheck/driver.cpp 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,37 @@ +#ifdef __GNUC__ +# define _tmain main +# define LL(X) X ## LL +#else +# define LL(X) X ## i64 +#endif + +#include "common.h" +#include "msvc.h" + +struct struct64 dd64 = { LL(0x1122334455667788) }; +struct struct32 dd32 = { 0x11223344 }; + +int +_tmain (void) +{ + print_offsets (); + + test_struct64 ("", dd64); + test_struct32 ("", dd32); + + struct struct64 ldd64 = test_ret_struct64 (); + struct struct32 ldd32 = test_ret_struct32 (); + + long double ldouble = test_ret_ldouble(); + double doubl = test_ret_double(); + + printf("test_ret_ldouble, ldouble = %lf\n", ldouble); + printf("test_ret_double, doubl = %f\n", doubl); + + test_ldouble("", 0.12345678); + test_uint64("", LL(0x1122334455667788)); + + test_odd_regs64(0, LL(0x1111111122222222), + 3, LL(0x4444444455555555), + 6, LL(0x7777777788888888)); +} Property changes on: trunk/cegcc/tools/abicheck/driver.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/makemsvc.sh =================================================================== --- trunk/cegcc/tools/abicheck/makemsvc.sh (rev 0) +++ trunk/cegcc/tools/abicheck/makemsvc.sh 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,19 @@ +#!/bin/bash + +MSVC_PATH=d:\\Programas\\Microsoft\ Visual\ Studio\ 8 +PATH=${MSVC_PATH}/Common7/IDE:${PATH} +PATH=${MSVC_PATH}/VC/ce/bin/x86_arm:${PATH} + +export PATH + +INCLUDE="${MSVC_PATH}\\VC\\ce\\include" +INCLUDE="${MSVC_PATH}\\SmartDevices\\SDK\\PocketPC2003\\Include;${INCLUDE}" + +export INCLUDE + +cl.exe /nologo /W3 /O2 \ + /D "ARM" /D "_M_ARM" \ + /D "WIN32" /D "NDEBUG" /D "_WINDOWS" \ + /D "STRICT" /D "_WIN32_WCE=0x300" \ + /D "UNICODE" /D "_UNICODE" \ + /c msvc.cpp Property changes on: trunk/cegcc/tools/abicheck/makemsvc.sh ___________________________________________________________________ Name: svn:executable + * Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/msvc.cpp =================================================================== --- trunk/cegcc/tools/abicheck/msvc.cpp (rev 0) +++ trunk/cegcc/tools/abicheck/msvc.cpp 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,93 @@ +#include <windows.h> +#include <stdio.h> + +#include "common.h" +#include "msvc.h" + +void +print_offsets (void) +{ +#define poffset(T, F) \ + printf("offsetof (%s::%s) = %i\n", #T, #F, offsetof (T, F)) + + printf("sizeof (struct T1) = %i\n", sizeof (struct T1)); + poffset(struct T1, f1); + poffset(struct T1, f2); + poffset(struct T1, f3); + poffset(struct T1, f4); + + printf("sizeof (struct T2) = %i\n", sizeof (struct T2)); + poffset(struct T2, f1); + poffset(struct T2, f2); + poffset(struct T2, f3); + poffset(struct T2, f4); + + printf("sizeof (struct T3) = %i\n", sizeof (struct T3)); + poffset(struct T3, f1); + poffset(struct T3, f2); + poffset(struct T3, f3); + poffset(struct T3, f4); +} + +void +test_struct64 (const char *s, struct struct64 dd) +{ + printf("test_struct64, dd = %I64x\n", dd); +} + +void +test_struct32 (const char *s, struct struct32 dd) +{ + printf("test_struct32, dd = %x\n", dd); +} + +void +test_ldouble(const char *s, long double ld) +{ + printf("test_uint64, ld = %lf\n", ld); +} + +void +test_uint64(const char *s, unsigned __int64 ll) +{ + printf("test_uint64, ll = %I64x\n", ll); +} + +struct struct64 +test_ret_struct64 (void) +{ + struct struct64 ddd = { 0x1122334455667788i64 }; + return ddd; +} + +struct struct32 +test_ret_struct32 (void) +{ + struct struct32 ddd = { 0x11223344 }; + return ddd; +} + +long double +test_ret_ldouble (void) +{ + return 1.2345678; +} + +double +test_ret_double (void) +{ + return 2.3456789; +} + +void +test_odd_regs64 (char a, __int64 b, char c, __int64 d, char e, __int64 f) +{ + printf("test_odd_regs64\n" + "\ta = %d\n" + "\tb = %I64x\n" + "\tc = %d\n" + "\td = %I64x\n" + "\te = %d\n" + "\tf = %I64x\n", + (int)a, b, (int)c, d, (int)e, f); +} Property changes on: trunk/cegcc/tools/abicheck/msvc.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/msvc.h =================================================================== --- trunk/cegcc/tools/abicheck/msvc.h (rev 0) +++ trunk/cegcc/tools/abicheck/msvc.h 2007-11-18 16:33:11 UTC (rev 1075) @@ -0,0 +1,30 @@ +#ifndef MSVC_H +#define MSVC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "common.h" + +void print_offsets (void); + +void test_struct64 (const char *s, struct struct64 dd); +void test_struct32 (const char *s, struct struct32 dd); + +struct struct64 test_ret_struct64 (void); +struct struct32 test_ret_struct32 (void); + +long double test_ret_ldouble(void); +double test_ret_double(void); + +void test_ldouble(const char *s, long double ld); +void test_uint64(const char *s, unsigned __int64 ll); + +void test_odd_regs64(char a, __int64 b, char c, __int64 d, char e, __int64 f); + +#ifdef __cplusplus +} +#endif + +#endif Property changes on: trunk/cegcc/tools/abicheck/msvc.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/cegcc/tools/abicheck/msvc.obj =================================================================== (Binary files differ) Property changes on: trunk/cegcc/tools/abicheck/msvc.obj ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |