Author: tkreuzer
Date: Mon Jun 6 09:58:58 2011
New Revision: 52110
URL:
http://svn.reactos.org/svn/reactos?rev=52110&view=rev
Log:
[SPEC2DEF]
- Fix build of importlibraries on MSVC / amd64
Modified:
trunk/reactos/msc.cmake
trunk/reactos/tools/spec2def/spec2def.c
Modified: trunk/reactos/msc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/msc.cmake?rev=52110&r1…
==============================================================================
--- trunk/reactos/msc.cmake [iso-8859-1] (original)
+++ trunk/reactos/msc.cmake [iso-8859-1] Mon Jun 6 09:58:58 2011
@@ -24,6 +24,9 @@
if(${ARCH} MATCHES amd64)
add_definitions(-D__x86_64)
+ set(SPEC2DEF_ARCH x86_64)
+else()
+ set(SPEC2DEF_ARCH i386)
endif()
link_directories("${REACTOS_BINARY_DIR}/importlibs"
${REACTOS_BINARY_DIR}/lib/sdk/crt)
@@ -130,7 +133,7 @@
# Generate the asm stub file and the export def file
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
- COMMAND native-spec2def --ms --kill-at -r -n=${_name}${_suffix}
-d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
-l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
+ COMMAND native-spec2def --ms --kill-at -a=${SPEC2DEF_ARCH} -r
-n=${_name}${_suffix} -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
-l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm
${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file})
# Assemble the stub file
@@ -149,7 +152,7 @@
# Build the importlib
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
- COMMAND LINK /LIB /NOLOGO /MACHINE:X86
/DEF:${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
/OUT:${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${_libraries}
+ COMMAND LINK /LIB /NOLOGO /DEF:${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def
/OUT:${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${_libraries}
DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj
${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def)
# Add the importlib target
@@ -174,7 +177,7 @@
get_filename_component(_file ${_spec_file} NAME_WE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
- COMMAND native-spec2def --ms --kill-at -n=${_dllname}
-d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
-s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
+ COMMAND native-spec2def --ms --kill-at -a=${SPEC2DEF_ARCH} -n=${_dllname}
-d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
-s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def
${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
PROPERTIES GENERATED TRUE)
Modified: trunk/reactos/tools/spec2def/spec2def.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
==============================================================================
--- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original)
+++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Mon Jun 6 09:58:58 2011
@@ -10,7 +10,7 @@
typedef struct
{
char *pcName;
- int nNameLength;
+ size_t nNameLength;
char *pcRedirection;
int nRedirectionLength;
int nCallingConvention;
@@ -21,11 +21,21 @@
unsigned int uFlags;
} EXPORT;
+enum _ARCH
+{
+ ARCH_X86,
+ ARCH_AMD64,
+ ARCH_IA64,
+ ARCH_ARM,
+ ARCH_PPC
+};
+
typedef int (*PFNOUTLINE)(FILE *, EXPORT *);
int gbKillAt = 0;
int gbUseDeco = 0;
int gbMSComp = 0;
int no_redirections = 0;
+int giArch = ARCH_X86;
char *pszArchString = "i386";
char *pszArchString2;
char *pszDllName = 0;
@@ -151,7 +161,7 @@
(pexp->uFlags & FL_STUB) == 0) return 0;
fprintf(file, "int ");
- if (strcmp(pszArchString, "i386") == 0 &&
+ if ((giArch == ARCH_X86) &&
pexp->nCallingConvention == CC_STDCALL)
{
fprintf(file, "__stdcall ");
@@ -218,8 +228,12 @@
void
OutputHeader_asmstub(FILE *file, char *libname)
{
- fprintf(file, "; File generated automatically, do not edit! \n\n"
- ".586\n.model flat\n.code\n");
+ fprintf(file, "; File generated automatically, do not edit! \n\n");
+
+ if (giArch == ARCH_X86)
+ fprintf(file, ".586\n.model flat\n");
+
+ fprintf(file, ".code\n");
}
int
@@ -230,6 +244,12 @@
{
fprintf(fileDest, "PUBLIC ordinal%d\nordinal%d: nop\n",
pexp->nOrdinal, pexp->nOrdinal);
+ }
+ else if (giArch == ARCH_AMD64)
+ {
+ fprintf(fileDest, "PUBLIC %.*s\n%.*s: nop\n",
+ pexp->nNameLength, pexp->pcName,
+ pexp->nNameLength, pexp->pcName);
}
else if (pexp->nCallingConvention == CC_STDCALL)
{
@@ -274,7 +294,7 @@
PrintName(FILE *fileDest, EXPORT *pexp, int fRedir, int fDeco)
{
char *pcName = fRedir ? pexp->pcRedirection : pexp->pcName;
- int nNameLength = fRedir ? pexp->nRedirectionLength : pexp->nNameLength;
+ size_t nNameLength = fRedir ? pexp->nRedirectionLength : pexp->nNameLength;
if (fDeco && pexp->nCallingConvention == CC_FASTCALL)
fprintf(fileDest, "@");
@@ -450,7 +470,7 @@
}
else if (CompareToken(pc, "-i386"))
{
- if (strcasecmp(pszArchString, "i386") != 0) included = 0;
+ if (giArch == ARCH_X86) included = 0;
}
else if (CompareToken(pc, "-private"))
{
@@ -572,7 +592,7 @@
{
/* Check for stdcall name */
char *p = strchr(pc, '@');
- if (p && (p - pc < exp.nNameLength))
+ if (p && ((size_t)(p - pc) < exp.nNameLength))
{
int i;
exp.nNameLength = p - pc;
@@ -694,15 +714,20 @@
}
}
- if ((strcasecmp(pszArchString, "x86_64") == 0) ||
- (strcasecmp(pszArchString, "ia64") == 0))
+ if (strcasecmp(pszArchString, "i386") == 0) giArch = ARCH_X86;
+ else if (strcasecmp(pszArchString, "x86_64") == 0) giArch = ARCH_AMD64;
+ else if (strcasecmp(pszArchString, "ia64") == 0) giArch = ARCH_IA64;
+ else if (strcasecmp(pszArchString, "arm") == 0) giArch = ARCH_ARM;
+ else if (strcasecmp(pszArchString, "ppc") == 0) giArch = ARCH_PPC;
+
+ if ((giArch == ARCH_AMD64) || (giArch = ARCH_IA64))
{
pszArchString2 = "win64";
}
else
pszArchString2 = "win32";
- if (strcasecmp(pszArchString, "i386") == 0)
+ if (giArch == ARCH_X86)
{
gbUseDeco = 1;
}
@@ -711,7 +736,7 @@
if (!pszDllName)
{
char *p1, *p2;
- int len;
+ size_t len;
p1 = strrchr(argv[i], '\\');
if (!p1) p1 = strrchr(argv[i], '/');