GCC assembler support. Modified: branches/xmlbuildsystem/reactos/iface/native/genntdll.c Modified: branches/xmlbuildsystem/reactos/iface/native/module.xml Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h _____
Modified: branches/xmlbuildsystem/reactos/iface/native/genntdll.c --- branches/xmlbuildsystem/reactos/iface/native/genntdll.c 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/iface/native/genntdll.c 2005-01-09 16:36:57 UTC (rev 12908) @@ -359,34 +359,34 @@
return(1); }
- in = fopen(argv[1],"rb"); - if (in == NULL) - { - perror("Failed to open input file (system calls database)"); - return(1); - } - - out1 = fopen(argv[2],"wb"); + out1 = fopen(argv[1],"wb"); if (out1 == NULL) { perror("Failed to open output file (NTDLL stubs)"); return(1); }
- out2 = fopen(argv[3],"wb"); + out2 = fopen(argv[2],"wb"); if (out2 == NULL) { perror("Failed to open output file (NTOSKRNL service table)"); return(1); }
- out3 = fopen(argv[4],"wb"); + out3 = fopen(argv[3],"wb"); if (out3 == NULL) { perror("Failed to open output file (NTOSKRNL Zw stubs)"); return(1); }
+ in = fopen(argv[4],"rb"); + if (in == NULL) + { + perror("Failed to open input file (system calls database)"); + return(1); + } + ret = process(in,out1,out2,out3); rewind(in); ret = makeSystemServiceTable(in, out2); _____
Modified: branches/xmlbuildsystem/reactos/iface/native/module.xml --- branches/xmlbuildsystem/reactos/iface/native/module.xml 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/iface/native/module.xml 2005-01-09 16:36:57 UTC (rev 12908) @@ -1,4 +1,14 @@
<module name="genntdll" type="buildtool"> <include base="genntdll">.</include> <file>genntdll.c</file> + <invoke> + <input> + <inputfile>sysfuncs.lst</inputfile> + </input> + <output> + <outputfile>../../lib/ntdll/napi.c</outputfile> + <outputfile>../../include/ntdll/napi.h</outputfile> + <outputfile>../../ntoskrnl/nt/zw.c</outputfile> + </output> + </invoke> </module> _____
Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml --- branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml 2005-01-09 16:36:57 UTC (rev 12908) @@ -1,11 +1,13 @@
<module name="ntoskrnl" type="kernelmodedll" extension=".exe"> <dependency>buildno</dependency> + <dependency>genntdll</dependency> <dependency>wmc</dependency> <define name="_SEH_NO_NATIVE_NLG" /> <define name="_DISABLE_TIDENTS" /> <define name="__NTOSKRNL__" /> <define name="__3GB__" /> - <include base="kjs">./include</include> + <define name="__ELF_WORD_SIZE">32</define> + <include base="kjs">include</include> <include base="ntoskrnl">include</include> <library>kjs</library> <invoke module="wmc"> @@ -34,6 +36,7 @@ <file>rtlfunc.c</file> </directory> <directory name="dbg"> + <!-- <if property="arch" value="i386"> <directory name="i386"> <if property="kdbg" value="true"> @@ -44,6 +47,8 @@ </if> </directory> </if> + --> + <!-- <if property="kdbg" value="true"> <group> <file>kdb.c</file> @@ -53,6 +58,7 @@ <file>profile.c</file> </group> </if> + --> <or> <!-- <if property="kdbg" value="true"> @@ -62,12 +68,14 @@ </group> </if> --> + <!-- <if property="dbg" value="true"> <group> <file>kdb_stabs.c</file> <file>kdb_symbols.c</file> </group> </if> + --> </or> <file>dbgctrl.c</file> <file>errinfo.c</file> @@ -75,11 +83,13 @@ <file>user.c</file> </directory> <directory name="ex"> + <!-- <if property="arch" value="i386"> <directory name="i386"> <file>interlck.c</file> </directory> </if> + --> <file>btree.c</file> <file>callback.c</file> <file>fmutex.c</file> _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-09 16:36:57 UTC (rev 12908) @@ -51,6 +51,15 @@
}
string +MingwModuleHandler::GetExtension ( const string& filename ) const +{ + size_t index = filename.find_last_of ( '.' ); + if (index != string::npos) + return filename.substr ( index ); + return ""; +} + +string MingwModuleHandler::ReplaceExtension ( const string& filename, const string& newExtension ) const { @@ -245,6 +254,54 @@ return parameters; }
+string +MingwModuleHandler::GenerateGccCommand ( const Module& module, + const string& sourceFilename, + const string& cc ) const +{ + string objectFilename = GetObjectFilename ( sourceFilename ); + return ssprintf ( "%s -c %s -o %s %s\n", + cc.c_str (), + sourceFilename.c_str (), + objectFilename.c_str (), + GenerateGccParameters ( module ).c_str () ); +} + +string +MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module, + const string& sourceFilename, + const string& cc ) const +{ + string objectFilename = GetObjectFilename ( sourceFilename ); + return ssprintf ( "%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n", + cc.c_str (), + sourceFilename.c_str (), + objectFilename.c_str (), + GenerateGccParameters ( module ).c_str () ); +} + +string +MingwModuleHandler::GenerateCommand ( const Module& module, + const string& sourceFilename, + const string& cc ) const +{ + string extension = GetExtension ( sourceFilename ); + if ( extension == ".c" || extension == ".C" ) + return GenerateGccCommand ( module, + sourceFilename, + cc ); + else if ( extension == ".s" || extension == ".S" ) + return GenerateGccAssemblerCommand ( module, + sourceFilename, + cc ); + + throw InvalidOperationException ( __FILE__, + __LINE__, + "Unsupported filename extension '%s' in file '%s'", + extension.c_str (), + sourceFilename.c_str () ); +} + void MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, const string& cc) const @@ -263,11 +320,10 @@ objectFilename.c_str (), sourceFilename.c_str () ); fprintf ( fMakefile, - "\t%s -c %s -o %s %s\n", - cc.c_str (), - sourceFilename.c_str (), - objectFilename.c_str (), - GenerateGccParameters ( module ).c_str () ); + "\t%s\n", + GenerateCommand ( module, + sourceFilename, + cc ).c_str () ); } fprintf ( fMakefile, "\n" ); @@ -502,7 +558,8 @@ archiveFilename.c_str (), importLibraryDependencies.c_str () ); fprintf ( fMakefile, - "\t${gcc} -Wl,--base-file,%s -o %s %s %s\n", + "\t${gcc} -Wl,--entry,_NtProcessStartup -Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--image-base,0xC0000000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -Wl,--base-file,%s -nostartfiles -o %s %s %s\n", + module.GetBasePath ().c_str (), base_tmp.c_str (), junk_tmp.c_str (), archiveFilename.c_str (), _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-09 16:36:57 UTC (rev 12908) @@ -17,7 +17,8 @@
virtual void Process ( const Module& module ) = 0;
protected: - std::string MingwModuleHandler::GetWorkingDirectory () const; + std::string GetWorkingDirectory () const; + std::string GetExtension ( const std::string& filename ) const; std::string ReplaceExtension ( const std::string& filename, const std::string& newExtension ) const; std::string GetModuleArchiveFilename ( const Module& module ) const; @@ -46,6 +47,15 @@ void GenerateGccModuleIncludeVariable ( const Module& module ) const; std::string GenerateGccIncludeParameters ( const Module& module ) const; std::string GenerateGccParameters ( const Module& module ) const; + std::string GenerateGccCommand ( const Module& module, + const std::string& sourceFilename, + const std::string& cc ) const; + std::string GenerateGccAssemblerCommand ( const Module& module, + const std::string& sourceFilename, + const std::string& cc ) const; + std::string GenerateCommand ( const Module& module, + const std::string& sourceFilename, + const std::string& cc ) const; void GenerateObjectFileTargets ( const Module& module, const std::string& cc ) const; void GenerateArchiveTarget ( const Module& module, _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-09 16:36:57 UTC (rev 12908) @@ -34,14 +34,32 @@
InvalidOperationException::InvalidOperationException ( const char* filename, - const int linenumber) + const int linenumber ) { Message = ssprintf ( "%s:%d", filename, linenumber ); }
+InvalidOperationException::InvalidOperationException ( const char* filename, + const int linenumber, + const char* message, + ... ) +{ + string errorMessage; + va_list args; + va_start ( args, + message ); + errorMessage = ssvprintf ( message, + args ); + va_end ( args ); + Message = ssprintf ( "%s:%d %s", + filename, + linenumber, + errorMessage.c_str () ); +}
+ FileNotFoundException::FileNotFoundException ( const string& filename ) : Exception ( "File '%s' not found.", filename.c_str() ) _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-09 14:16:36 UTC (rev 12907) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-09 16:36:57 UTC (rev 12908) @@ -22,6 +22,10 @@
public: InvalidOperationException ( const char* filename, const int linenumber); + InvalidOperationException ( const char* filename, + const int linenumber, + const char* message, + ... ); };