Handle indirect calls to functions in external modules Modified: trunk/reactos/tools/rbuild/testsupportcode.cpp _____
Modified: trunk/reactos/tools/rbuild/testsupportcode.cpp --- trunk/reactos/tools/rbuild/testsupportcode.cpp 2005-11-20 09:09:19 UTC (rev 19358) +++ trunk/reactos/tools/rbuild/testsupportcode.cpp 2005-11-20 13:12:33 UTC (rev 19359) @@ -139,34 +139,57 @@
}
string -GetImportSymbol ( const StubbedSymbol& symbol ) +GetLinkerSymbol ( const StubbedSymbol& symbol ) { if (symbol.symbol[0] == '@') + return symbol.symbol; + else + return "_" + symbol.symbol; +} + +string +GetLinkerImportSymbol ( const StubbedSymbol& symbol ) +{ + if (symbol.symbol[0] == '@') return "__imp_" + symbol.symbol; else return "__imp__" + symbol.symbol; }
+string +GetIndirectCallTargetSymbol ( const StubbedSymbol& symbol ) +{ + return GetLinkerSymbol ( symbol ) + "_"; +} + char* TestSupportCode::WriteStubbedSymbolToStubsFile ( char* buffer, const StubbedComponent& component, const StubbedSymbol& symbol, int stubIndex ) { - string importSymbol = GetImportSymbol( symbol ); + string linkerSymbol = GetLinkerSymbol ( symbol ); + string linkerImportSymbol = GetLinkerImportSymbol ( symbol ); + string indirectCallTargetSymbol = GetIndirectCallTargetSymbol ( symbol ); buffer = buffer + sprintf ( buffer, - ".globl _%s\n", - symbol.symbol.c_str () ); + ".globl %s\n", + linkerSymbol.c_str () ); buffer = buffer + sprintf ( buffer, ".globl %s\n", - importSymbol.c_str () ); + linkerImportSymbol.c_str () ); buffer = buffer + sprintf ( buffer, - "_%s:\n", - symbol.symbol.c_str () ); + "%s:\n", + linkerSymbol.c_str () ); buffer = buffer + sprintf ( buffer, "%s:\n", - importSymbol.c_str () ); + linkerImportSymbol.c_str () ); buffer = buffer + sprintf ( buffer, + " .long %s\n", + indirectCallTargetSymbol.c_str () ); + buffer = buffer + sprintf ( buffer, + "%s:\n", + indirectCallTargetSymbol.c_str () ); + buffer = buffer + sprintf ( buffer, " pushl $%d\n", stubIndex ); buffer = buffer + sprintf ( buffer, @@ -194,7 +217,7 @@ char* buf; char* s;
- buf = (char*) malloc ( 50*1024 ); + buf = (char*) malloc ( 512*1024 ); if ( buf == NULL ) throw OutOfMemoryException ();