mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 04:13:37 +00:00
GCC assembler support.
svn path=/branches/xmlbuildsystem/; revision=12908
This commit is contained in:
@@ -359,34 +359,34 @@ int main(int argc, char* argv[])
|
||||
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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -50,6 +50,15 @@ MingwModuleHandler::GetWorkingDirectory () const
|
||||
return ".";
|
||||
}
|
||||
|
||||
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 @@ MingwModuleHandler::GenerateGccParameters ( const Module& module ) const
|
||||
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 @@ MingwModuleHandler::GenerateObjectFileTargets ( const Module& module,
|
||||
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 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module )
|
||||
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 (),
|
||||
|
||||
@@ -17,7 +17,8 @@ public:
|
||||
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 @@ private:
|
||||
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,
|
||||
|
||||
@@ -34,13 +34,31 @@ void Exception::SetMessage ( const char* message,
|
||||
|
||||
|
||||
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.",
|
||||
|
||||
@@ -22,6 +22,10 @@ class InvalidOperationException : public Exception
|
||||
public:
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber);
|
||||
InvalidOperationException ( const char* filename,
|
||||
const int linenumber,
|
||||
const char* message,
|
||||
... );
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user