modified Makefile

Give poor pefixup its own echo line

modified   ReactOS-amd64.rbuild
modified   ReactOS-arm.rbuild
modified   ReactOS-i386.rbuild
   Set global linker flags globally
   Goodbye NTOSKRNL_SHARED

modified   tools/rbuild/backend/codeblocks/codeblocks.cpp
modified   tools/rbuild/backend/msvc/vcprojmaker.cpp
   Build fixes. I really want to delete these dead backends

modified   tools/rbuild/backend/mingw/linkers/ld.mak
   Makefile rule for the linker. Also generates the .lib and .exp for DLLs, and obsoletes a whole lot of shitty rbuild code

modified   tools/rbuild/backend/mingw/mingw.cpp
modified   tools/rbuild/backend/mingw/mingw.h
   Specify module type-specific linker flags... in the specification of flags for module types, instead of wherever
   Fix generation of project-global linker and NASM flags
   Give better names to the variables that contain names of BE-provided libraries
   Don't put quotes around the names of BE-provided libraries, GNU make doesn't support quoting in any way, shape or form and quotes around filenames actually break shit on Windows (see <http://reactos-blog.blogspot.com/2009/11/gnu-make-fails-on-windows-with-multiple.html>). Just install the BE in a path without spaces in it
   Typo: LFLAGS is the flags for lex, flags for linker come from LDFLAGS

modified   tools/rbuild/backend/mingw/modulehandler.cpp
modified   tools/rbuild/backend/mingw/modulehandler.h
modified   tools/rbuild/module.cpp
modified   tools/rbuild/rbuild.h
   Moved generation of linker and import library generation rules out of rbuild and into sub-makefiles. A lot of code deleted, nothing of value was lost
   More LFLAGS -> LDFLAGS
   Goodbye mangledsymbols and underscoresymbols attributes, they don't do shit other than complicating my life
   If we have to add an underscore in front of the entry point name for some architectures, how about we do it in a single place?

modified   tools/rbuild/backend/mingw/rules.mak
   Minor cosmetic change

svn path=/trunk/; revision=44091
This commit is contained in:
KJK::Hyperion 2009-11-11 03:41:14 +00:00
parent 18d9f647bc
commit 7f4bf6c490
14 changed files with 227 additions and 581 deletions

View file

@ -242,6 +242,7 @@ ifeq ($(HALFVERBOSEECHO),yes)
ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP] $@$(QUOTE)
ECHO_RBUILD =@echo $(QUOTE)[RBUILD] $@$(QUOTE)
ECHO_RSYM =@echo $(QUOTE)[RSYM] $@$(QUOTE)
ECHO_PEFIXUP =@echo $(QUOTE)[PEFIXUP] $@$(QUOTE)
ECHO_WMC =@echo $(QUOTE)[WMC] $@$(QUOTE)
ECHO_NCI =@echo $(QUOTE)[NCI] $@$(QUOTE)
ECHO_CABMAN =@echo $(QUOTE)[CABMAN] $<$(QUOTE)

View file

@ -20,7 +20,6 @@
<property name="PLATFORM" value="PC"/>
<property name="usewrc" value="false"/>
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<property name="NTOSKRNL_SHARED" value="-shared"/>
<if property="OPTIMIZE" value="1">
<compilerflag>-Os</compilerflag>
@ -48,9 +47,14 @@
<compilerflag>-Wno-multichar</compilerflag>
<compilerflag>-Wno-format</compilerflag>
<!-- compilerflag>-H</compilerflag> enable this for header traces -->
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-static</linkerflag>
<linkerflag>--unique=.eh_frame</linkerflag>
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-static</linkerflag>
<linkerflag>--unique=.eh_frame</linkerflag>
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<!-- Here starts <xi:include href="ReactOS-generic.rbuild" /> -->
@ -191,7 +195,7 @@
<directory name="storage">
<xi:include href="drivers/storage/directory.rbuild" />
</directory>
<directory name="usb">
<directory name="usb">
<xi:include href="drivers/usb/directory.rbuild" />
</directory>
<directory name="video">

View file

@ -8,17 +8,16 @@
</xi:include>
<xi:include href="ReactOS-generic.rbuild" />
<!-- <define name="_M_ARM" /> Already defined by toolchain -->
<define name="_ARM_" />
<define name="__arm__" />
<define name="TARGET_arm" host="true" />
<define name="USE_COMPILER_EXCEPTIONS" />
<property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
<property name="WINEBUILD_FLAGS" value="--kill-at"/>
<include>include/reactos/arm</include>
<if property="SARCH" value="versatile">
@ -32,12 +31,14 @@
<compilerflag>-Wno-attributes</compilerflag>
</group>
<define name="__MSVCRT__"/> <!-- DUBIOUS -->
<group linkerset="ld">
<linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<directory name="media">

View file

@ -16,7 +16,6 @@
<define name="USE_COMPILER_EXCEPTIONS" />
<property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
<property name="PLATFORM" value="PC"/>
<group compilerset="gcc">
@ -30,6 +29,8 @@
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
<linkerflag>-file-alignment=0x1000</linkerflag>
<linkerflag>-section-alignment=0x1000</linkerflag>
</group>
<directory name="base">

View file

@ -598,7 +598,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( sys )
{
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint(false) == "" ? "DriverEntry@8" : module.GetEntryPoint(false).c_str ());
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint() == "" ? "DriverEntry@8" : module.GetEntryPoint().c_str ());
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--image-base,%s\" />\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str () );
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-nostartfiles -Wl,--nostdlib\" />\r\n" );
}
@ -623,7 +623,7 @@ CBBackend::_generate_cbproj ( const Module& module )
}
else if ( dll )
{
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint(false).c_str () );
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint().c_str () );
fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--image-base,%s\" />\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str () );
if ( module.type == Win32DLL)

View file

@ -1,32 +1,70 @@
#~ #(module, objs, deps, ldflags, output, libs, subsys, entry, base, falign, salign)
#~ define RBUILD_LINK
LDFLAG_DLL:=-shared
LDFLAG_DRIVER:=-shared --subsystem=native
LDFLAG_NOSTDLIB:=-nostartfiles -nostdlib
LDFLAG_CONSOLE:=--subsystem=console
LDFLAG_WINDOWS:=--subsystem=windows
LDFLAG_NATIVE:=--subsystem=native
#~ $(5) ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map: $(2) $(3) $(6) | ${call RBUILD_dir,$(5)}
#~ $$(ECHO_CC)
#~ $${ld} -subsystem=$(7) -entry=$(8) -base=$(9) -file-alignment=$(10) -section-alignment=$(11) $(2) $(6) ${call RBUILD_ldflags,$(1),$(4)} -o $(5)
#~ ifeq ($(ROS_BUILDMAP),full)
#~ $$(ECHO_OBJDUMP)
#~ $${objdump} -d -S $$@ > ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map
#~ else
#~ ifeq ($(ROS_BUILDMAP),yes)
#~ $$(ECHO_NM)
#~ $${nm} --numeric-sort $$@ > ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map
#~ endif
#~ endif
#~ ifeq ($(ROS_BUILDNOSTRIP),yes)
#~ $$(ECHO_CP)
#~ $${cp} $(5) $(basename $(5)).nostrip$(suffix $(5)) 1>$(NUL)
#~ endif
#~ ifneq ($(ROS_GENERATE_RSYM),no)
#~ $$(ECHO_RSYM)
#~ $$(Q)$$(rsym_TARGET) $$@ $$@
#~ endif
#~ ifeq ($(ROS_LEAN_AND_MEAN),yes)
#~ $$(ECHO_STRIP)
#~ $${strip} -s -x -X $$@
#~ endif
#(module, objs, deps, ldflags, output, def, libs, entry, base)
define RBUILD_LINK
#~ endef
ifneq ($(6),)
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO DLLTOOL)
$${dlltool} --def $(6) --kill-at --output-lib=$$@
#~ #(module, dependencies, ldflags, subsys, entry, base, falign, salign)
#~ RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(1)_OBJS,$(2),$(3),$(1)_TARGET,$(1)_LIBS,$(4),$(5),$(6),$(7),$(8)}
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.delayimp.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO DLLTOOL)
$${dlltool} --def $(6) --kill-at --output-delaylib=$$@
${call RBUILD_intermediate_path_noext,$(5)}.exp: $(6) | ${call RBUILD_intermediate_path,$(5)}
$$(ECHO DLLTOOL)
$${dlltool} --def $(6) --kill-at --output-exp=$$@
$(1)_CLEANFILES+=\
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).a \
${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).delayimp.a \
${call RBUILD_intermediate_path_noext,$(5)}.exp
endif
$(5): $(2) $$(if $(6),${call RBUILD_intermediate_path_noext,$(5)}.exp) $(7) $(3) $$(RSYM_TARGET) $$(PEFIXUP_TARGET) | ${call RBUILD_dir,$(5)}
$$(ECHO_LD)
$${ld} --entry=$(8) --image-base=$(9) $(2) $$(if $(6),${call RBUILD_intermediate_path_noext,$(5)}.exp) $(7) ${call RBUILD_ldflags,$(1),$(4)} -o $$@
ifneq ($(or $(6),$$(MODULETYPE$$($(1)_TYPE)_KMODE)),)
$$(ECHO_PEFIXUP)
$$(Q)$$(PEFIXUP_TARGET) $$@ $(if $(6),-exports) $$(if $$(MODULETYPE$($(1)_TYPE)_KMODE),-sections)
endif
ifeq ($(ROS_BUILDMAP),full)
$$(ECHO_OBJDUMP)
$${objdump} -d -S $$@ > ${call RBUILD_output_path_noext,$(5)}.map
else
ifeq ($(ROS_BUILDMAP),yes)
$$(ECHO_NM)
$${nm} --numeric-sort $$@ > ${call RBUILD_output_path_noext,$(5)}.map
endif
endif
ifeq ($(ROS_BUILDNOSTRIP),yes)
$$(ECHO_CP)
$${cp} $(5) $(basename $(5)).nostrip$(suffix $(5)) 1>$(NUL)
endif
ifneq ($(ROS_GENERATE_RSYM),no)
$$(ECHO_RSYM)
$$(Q)$$(RSYM_TARGET) $$@ $$@
endif
ifeq ($(ROS_LEAN_AND_MEAN),yes)
$$(ECHO_STRIP)
$${strip} -s -x -X $$@
endif
ifneq ($(ROS_BUILDMAP),)
$(1)_CLEANFILES+=${call RBUILD_output_path_noext,$(5)}.map
endif
ifeq ($(ROS_BUILDNOSTRIP),yes)
$(1)_CLEANFILES+=$(basename $(5)).nostrip$(suffix $(5))
endif
endef
#(module, def, deps, ldflags, libs, entry, base)
RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(5) $(value $(1)_LIBS) $(5),$(6),$(7)}

View file

@ -38,16 +38,16 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
{ HostTrue, "", "", "" }, // BuildTool
{ HostFalse, "", "", "" }, // StaticLibrary
{ HostFalse, "", "", "" }, // ObjectLibrary
{ HostFalse, "", "", "" }, // Kernel
{ HostFalse, "", "", "" }, // KernelModeDLL
{ HostFalse, "-D__NTDRIVER__", "", "" }, // KernelModeDriver
{ HostFalse, "", "", "" }, // NativeDLL
{ HostFalse, "-D__NTAPP__", "", "" }, // NativeCUI
{ HostFalse, "", "", "" }, // Win32DLL
{ HostFalse, "", "", "" }, // Win32OCX
{ HostFalse, "", "", "" }, // Win32CUI
{ HostFalse, "", "", "" }, // Win32GUI
{ HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootLoader
{ HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // Kernel
{ HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // KernelModeDLL
{ HostFalse, "-D__NTDRIVER__", "", "$(LDFLAG_DRIVER)" }, // KernelModeDriver
{ HostFalse, "", "", "$(LDFLAG_DLL)" }, // NativeDLL
{ HostFalse, "-D__NTAPP__", "", "$(LDFLAG_NATIVE)" }, // NativeCUI
{ HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32DLL
{ HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32OCX
{ HostFalse, "", "", "$(LDFLAG_CONSOLE)" }, // Win32CUI
{ HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32GUI
{ HostFalse, "", "", "" }, // BootLoader
{ HostFalse, "", "-f bin", "" }, // BootSector
{ HostFalse, "", "", "" }, // Iso
{ HostFalse, "", "", "" }, // LiveIso
@ -55,8 +55,8 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
{ HostFalse, "", "", "" }, // RpcServer
{ HostFalse, "", "", "" }, // RpcClient
{ HostFalse, "", "", "" }, // Alias
{ HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootProgram
{ HostFalse, "", "", "" }, // Win32SCR
{ HostFalse, "", "", "" }, // BootProgram
{ HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32SCR
{ HostFalse, "", "", "" }, // IdlHeader
{ HostFalse, "", "", "" }, // IdlInterface
{ HostFalse, "", "", "" }, // EmbeddedTypeLib
@ -64,7 +64,7 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
{ HostFalse, "", "", "" }, // RpcProxy
{ HostTrue, "", "", "" }, // HostStaticLibrary
{ HostFalse, "", "", "" }, // Cabinet
{ HostFalse, "", "", "" }, // KeyboardLayout
{ HostFalse, "", "", "$(LDFLAG_DLL)" }, // KeyboardLayout
{ HostFalse, "", "", "" }, // MessageHeader
};
@ -413,17 +413,17 @@ MingwBackend::GenerateGlobalProperties (
}
string
MingwBackend::GenerateProjectLFLAGS () const
MingwBackend::GenerateProjectLDFLAGS () const
{
string lflags;
string ldflags;
for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ )
{
LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i];
if ( lflags.length () > 0 )
lflags += " ";
lflags += linkerFlag.flag;
if ( ldflags.length () > 0 )
ldflags += " ";
ldflags += linkerFlag.flag;
}
return lflags;
return ldflags;
}
void
@ -478,24 +478,21 @@ MingwBackend::GenerateGlobalVariables () const
// Would be nice to have our own C++ runtime
fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
}
// Because RosBE gcc is built to suck
fputs ( "BUILTIN_HOST_CINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CPPINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CXXINCLUDES+= $(HOST_CPPFLAGS)\n", fMakefile );
fprintf ( fMakefile, "PROJECT_CCLIBS := $(shell ${TARGET_CC} -print-libgcc-file-name)\n" );
fprintf ( fMakefile, "PROJECT_CXXLIBS := $(shell ${TARGET_CPP} -print-file-name=libstdc++.a) $(shell ${TARGET_CPP} -print-file-name=libgcc.a) $(shell ${TARGET_CPP} -print-file-name=libmingw32.a) $(shell ${TARGET_CPP} -print-file-name=libmingwex.a) $(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\n" );
/* hack to get libgcc_eh.a, should check mingw version or something */
if (Environment::GetArch() == "amd64")
{
fprintf ( fMakefile, "PROJECT_LPPFLAGS += $(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\n" );
}
}
MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
// TODO: linker flags
fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () );
fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)' '$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)'\n" );
/* hack to get libgcc_eh.a, should check mingw version or something */
if (Environment::GetArch() == "amd64")
{
fprintf ( fMakefile, "PROJECT_LPPFLAGS += '$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)'\n" );
}
fprintf ( fMakefile, "PROJECT_LDFLAGS := %s\n", GenerateProjectLDFLAGS ().c_str () );
// TODO: use symbolic names for module types
for ( size_t i = 0; i < sizeof(ModuleHandlerInformations) / sizeof(ModuleHandlerInformations[0]); ++ i )
@ -509,15 +506,6 @@ MingwBackend::GenerateGlobalVariables () const
ModuleHandlerInformations[i].cflags );
}
if ( ModuleHandlerInformations[i].cflags && ModuleHandlerInformations[i].cflags[0] )
{
fprintf ( fMakefile,
"MODULETYPE%d_%sFLAGS:=%s\n",
(int)i,
"CXX",
ModuleHandlerInformations[i].cflags );
}
if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
{
fprintf ( fMakefile,
@ -526,8 +514,29 @@ MingwBackend::GenerateGlobalVariables () const
"NASM",
ModuleHandlerInformations[i].nasmflags );
}
if ( ModuleHandlerInformations[i].linkerflags && ModuleHandlerInformations[i].linkerflags[0] )
{
fprintf ( fMakefile,
"MODULETYPE%d_%sFLAGS:=%s\n",
(int)i,
"LD",
ModuleHandlerInformations[i].linkerflags );
}
}
fprintf ( fMakefile,
"MODULETYPE%d_KMODE:=yes\n",
(int)Kernel );
fprintf ( fMakefile,
"MODULETYPE%d_KMODE:=yes\n",
(int)KernelModeDLL );
fprintf ( fMakefile,
"MODULETYPE%d_KMODE:=yes\n",
(int)KernelModeDriver );
fprintf ( fMakefile, "\n" );
}

View file

@ -66,7 +66,7 @@ private:
void GenerateHeader () const;
void GenerateGlobalProperties ( const char* assignmentOperation,
const IfableData& data ) const;
std::string GenerateProjectLFLAGS () const;
std::string GenerateProjectLDFLAGS () const;
void GenerateDirectories ();
void GenerateGlobalVariables () const;
bool IncludeInAllTarget ( const Module& module ) const;

View file

@ -290,9 +290,7 @@ MingwModuleHandler::GetModuleArchiveFilename () const
{
if ( IsStaticLibrary ( module ) )
return GetTargetFilename ( module, NULL );
return new FileLocation ( IntermediateDirectory,
module.output->relative_path,
ReplaceExtension ( module.name, ".temp.a" ) );
return NULL;
}
/*static*/ bool
@ -1359,25 +1357,6 @@ MingwModuleHandler::GenerateBuildMapCode ( const FileLocation *mapTarget )
"endif\n" );
}
void
MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()
{
fprintf ( fMakefile, "# BUILD NO STRIP CODE\n" );
fprintf ( fMakefile,
"ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );
FileLocation nostripFilename ( OutputDirectory,
module.output->relative_path,
GetBasename ( module.output->name ) + ".nostrip" + GetExtension ( *module.output ) );
CLEAN_FILE ( nostripFilename );
OutputCopyCommand ( *module.output, nostripFilename );
fprintf ( fMakefile,
"endif\n" );
}
void
MergeStringVector ( const Backend* backend,
const vector<FileLocation>& input,
@ -1438,158 +1417,61 @@ MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
}
void
MingwModuleHandler::GenerateRunRsymCode () const
MingwModuleHandler::GenerateLinkerCommand () const
{
fprintf ( fMakefile, "# RUN RSYM CODE\n" );
fprintf ( fMakefile,
"ifneq ($(ROS_GENERATE_RSYM),no)\n" );
fprintf ( fMakefile,
"\t$(ECHO_RSYM)\n" );
fprintf ( fMakefile,
"\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
fprintf ( fMakefile,
"endif\n" );
}
string definitionFilename;
const FileLocation *DefinitionFilename = GetDefinitionFilename ();
void
MingwModuleHandler::GenerateRunStripCode () const
{
fprintf ( fMakefile, "# RUN STRIP CODE\n" );
fprintf ( fMakefile,
"ifeq ($(ROS_LEAN_AND_MEAN),yes)\n" );
fprintf ( fMakefile,
"\t$(ECHO_STRIP)\n" );
fprintf ( fMakefile,
"\t${strip} -s -x -X $@\n\n" );
fprintf ( fMakefile,
"endif\n" );
}
void
MingwModuleHandler::GenerateLinkerCommand (
const string& dependencies,
const string& linkerParameters,
const string& pefixupParameters )
{
const FileLocation *target_file = GetTargetFilename ( module, NULL );
const FileLocation *definitionFilename = GetDefinitionFilename ();
string linker = "${ld}";
string objectsMacro = GetObjectsMacro ( module );
string libsMacro = GetLibsMacro ();
fprintf ( fMakefile, "# LINKER COMMAND\n" );
string target_macro ( GetTargetMacro ( module ) );
string target_folder ( backend->GetFullPath ( *target_file ) );
if ( DefinitionFilename ) {
definitionFilename = backend->GetFullName (*DefinitionFilename);
delete DefinitionFilename;
}
string linkerScriptArgument;
if ( module.linkerScript != NULL )
if ( module.linkerScript != NULL ) {
if ( module.project.configuration.Linker == GnuLd )
linkerScriptArgument = ssprintf ( " -T %s", backend->GetFullName ( *module.linkerScript->file ).c_str () );
else
linkerScriptArgument = "";
/* check if we need to add default C++ libraries, ie if we have
* a C++ user-mode module without the -nostdlib linker flag
*/
bool link_defaultlibs = module.cplusplus &&
linkerParameters.find ("-nostdlib") == string::npos &&
!(module.type == KernelModeDLL || module.type == KernelModeDriver);
if ( !module.HasImportLibrary() )
{
fprintf ( fMakefile,
"%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
target_macro.c_str (),
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
dependencies.c_str (),
target_folder.c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
fprintf ( fMakefile,
"\t%s %s%s %s %s %s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
objectsMacro.c_str (),
link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
}
else
{
FileLocation temp_exp ( IntermediateDirectory,
module.output->relative_path,
module.name + ".exp" );
CLEAN_FILE ( temp_exp );
fprintf ( fMakefile,
"%s: %s | %s\n",
backend->GetFullName ( temp_exp ).c_str (),
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
backend->GetFullPath ( temp_exp ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-exp $@%s%s\n",
module.GetDllName ().c_str (),
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
fprintf ( fMakefile,
"%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
target_macro.c_str (),
backend->GetFullName ( temp_exp ).c_str (),
dependencies.c_str (),
target_folder.c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
fprintf ( fMakefile,
"\t%s %s%s %s %s %s %s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
backend->GetFullName ( temp_exp ).c_str (),
objectsMacro.c_str (),
link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
fprintf ( fMakefile,
"\t$(Q)$(PEFIXUP_TARGET) %s -exports%s\n",
target_macro.c_str (),
pefixupParameters.c_str() );
fprintf ( stderr,
"Linker doesn't support linker scripts: linker script %s ignored for module %s\n",
backend->GetFullName ( *module.linkerScript->file ).c_str (),
module.name.c_str() );
}
GenerateBuildMapCode ();
GenerateBuildNonSymbolStrippedCode ();
GenerateRunRsymCode ();
GenerateRunStripCode ();
GenerateCleanObjectsAsYouGoCode ();
string extraLibraries;
if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse ) {
if ( module.cplusplus ) {
switch ( module.type )
{
case Win32DLL:
case Win32OCX:
case Win32CUI:
case Win32GUI:
case Win32SCR:
extraLibraries = "$$(PROJECT_CXXLIBS)";
break;
if ( definitionFilename )
delete definitionFilename;
delete target_file;
}
default:
extraLibraries = "$$(PROJECT_CCLIBS)";
break;
}
} else
extraLibraries = "$$(PROJECT_CCLIBS)";
}
void
MingwModuleHandler::GeneratePhonyTarget() const
{
string targetMacro ( GetTargetMacro ( module ) );
const FileLocation *target_file = GetTargetFilename ( module, NULL );
delete PassThruCacheDirectory ( new FileLocation ( module.output->directory, module.output->relative_path, "" ) );
delete PassThruCacheDirectory ( new FileLocation ( IntermediateDirectory, module.output->relative_path, "" ) );
fprintf ( fMakefile, "# PHONY TARGET\n" );
fprintf ( fMakefile,
".PHONY: %s\n\n",
targetMacro.c_str ());
fprintf ( fMakefile, "%s: | %s\n",
targetMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
delete target_file;
"$(eval $(call RBUILD_LINK_RULE,%s,%s,%s,%s,%s,%s,%s))\n",
module.name.c_str(),
definitionFilename.c_str(),
module.xmlbuildFile.c_str(),
linkerScriptArgument.c_str(),
extraLibraries.c_str(),
module.GetEntryPoint().c_str(),
module.baseaddress.c_str() );
}
void
@ -1598,8 +1480,6 @@ MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data )
size_t i;
string moduleDependencies;
fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
const vector<CompilationUnit*>& compilationUnits = data.compilationUnits;
for ( i = 0; i < compilationUnits.size (); i++ )
{
@ -1642,8 +1522,6 @@ MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data )
void
MingwModuleHandler::GenerateObjectFileTargets ()
{
fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
if ( module.pch && use_pch )
{
@ -1660,12 +1538,9 @@ MingwModuleHandler::GenerateObjectFileTargets ()
pchCxxRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
else
pchRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
fprintf ( fMakefile, "\n" );
}
GenerateObjectFileTargets ( module.non_if_data );
fprintf ( fMakefile, "\n" );
}
/* caller needs to delete the returned object */
@ -1673,6 +1548,10 @@ const FileLocation*
MingwModuleHandler::GenerateArchiveTarget ()
{
const FileLocation *archiveFilename = GetModuleArchiveFilename ();
if ( archiveFilename == NULL )
return NULL;
const FileLocation *definitionFilename = GetDefinitionFilename ();
fprintf ( fMakefile, "# ARCHIVE TARGET\n" );
@ -1687,11 +1566,8 @@ MingwModuleHandler::GenerateArchiveTarget ()
backend->GetFullName ( *definitionFilename ).c_str () );
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
module.GetDllName ().c_str (),
backend->GetFullName ( *definitionFilename ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
"\t${dlltool} --def %s --kill-at --output-lib $@\n",
backend->GetFullName ( *definitionFilename ).c_str () );
}
else
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
@ -1727,7 +1603,7 @@ MingwModuleHandler::GetLibsMacro () const
string
MingwModuleHandler::GetLinkerMacro () const
{
return ssprintf ( "$(%s_LFLAGS)",
return ssprintf ( "$(%s_LDFLAGS)",
module.name.c_str () );
}
@ -1842,7 +1718,7 @@ MingwModuleHandler::GenerateOtherMacros ()
{
set<const Define *> used_defs;
linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
linkerflagsMacro = ssprintf ("%s_LDFLAGS", module.name.c_str ());
libsMacro = ssprintf("%s_LIBS", module.name.c_str ());
const FileLocation * pchPath = GetPrecompiledHeaderPath ();
@ -1897,28 +1773,6 @@ MingwModuleHandler::GenerateOtherMacros ()
GenerateParameters ( module.name.c_str(), "+=", module.non_if_data );
const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
if ( strlen( linkerflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
linkerflagsMacro.c_str (),
linkerflags );
}
// FIXME: make rules for linker, move standard flags there
if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
if ( module.cplusplus )
fprintf ( fMakefile,
"%s+= $(PROJECT_LPPFLAGS)\n\n",
linkerflagsMacro.c_str () );
else
fprintf ( fMakefile,
"%s+= $(PROJECT_LFLAGS)\n\n",
linkerflagsMacro.c_str () );
}
GenerateMacros (
"+=",
module.non_if_data,
@ -1957,7 +1811,9 @@ MingwModuleHandler::GenerateRules ()
if ( !ReferenceObjects ( module ) )
{
const FileLocation* ar_target = GenerateArchiveTarget ();
delete ar_target;
if ( ar_target )
delete ar_target;
}
@ -2158,61 +2014,6 @@ MingwModuleHandler::GetDefinitionFilename () const
}
}
void
MingwModuleHandler::GenerateImportLibraryTarget (
const FileLocation *defFilename,
const FileLocation *library_target,
bool delayimp)
{
string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
fprintf ( fMakefile, "# IMPORT LIBRARY RULE\n" );
fprintf ( fMakefile, "%s:",
backend->GetFullName ( *library_target ).c_str () );
if ( defFilename )
{
fprintf ( fMakefile, " %s",
backend->GetFullName ( *defFilename ).c_str () );
}
fprintf ( fMakefile, " | %s\n",
backend->GetFullPath ( *library_target ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s %s %s%s%s\n\n",
module.GetDllName ().c_str (),
defFilename ? backend->GetFullName ( *defFilename ).c_str ()
: empty.c_str (),
delayimp ? "--output-delaylib" : "--output-lib",
backend->GetFullName ( *library_target ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
}
void
MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
{
if ( module.importLibrary != NULL )
{
const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files, false );
const FileLocation *delayimp_target = GetImportLibraryFilename ( module, &clean_files, true );
const FileLocation *defFilename = GetDefinitionFilename ();
GenerateImportLibraryTarget(defFilename, library_target, false);
GenerateImportLibraryTarget(defFilename, delayimp_target, true);
if ( defFilename )
delete defFilename;
delete library_target;
delete delayimp_target;
}
}
void
MingwModuleHandler::GetSpecObjectDependencies (
vector<FileLocation>& dependencies,
@ -2402,30 +2203,8 @@ MingwKernelModuleHandler::Process ()
void
MingwKernelModuleHandler::GenerateKernelModuleTarget ()
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters + " $(NTOSKRNL_SHARED)",
" -sections" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2453,29 +2232,8 @@ MingwKernelModeDLLModuleHandler::Process ()
void
MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ();
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
" -sections" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2502,29 +2260,8 @@ MingwNativeDLLModuleHandler::Process ()
void
MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2551,29 +2288,8 @@ MingwNativeCUIModuleHandler::Process ()
void
MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2641,29 +2357,8 @@ MingwWin32DLLModuleHandler::Process ()
void
MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2682,29 +2377,8 @@ MingwWin32OCXModuleHandler::Process ()
void
MingwWin32OCXModuleHandler::GenerateWin32OCXModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2730,29 +2404,8 @@ MingwWin32CUIModuleHandler::Process ()
void
MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2778,29 +2431,8 @@ MingwWin32GUIModuleHandler::Process ()
void
MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ()
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=windows -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}
@ -2845,7 +2477,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
if (Environment::GetArch() == "arm")
{
fprintf ( fMakefile,
"\t${gcc} -Wl,--subsystem,native -o %s %s %s %s\n",
"\t${gcc} -Wl,--subsystem,native -o %s %s %s %s -nostartfiles -nostdlib\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
libsMacro.c_str (),
@ -2854,7 +2486,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
else
{
fprintf ( fMakefile,
"\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s\n",
"\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s -nostartfiles -nostdlib\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
libsMacro.c_str (),
@ -3400,29 +3032,8 @@ MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector<CompilationUn
void
MingwTestModuleHandler::GenerateTestModuleTarget ()
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
if ( module.non_if_data.compilationUnits.size () > 0 )
{
GenerateRules ();
string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
module.baseaddress.c_str () );
GenerateLinkerCommand ( dependencies,
linkerParameters,
"" );
}
else
{
GeneratePhonyTarget();
}
GenerateRules ();
GenerateLinkerCommand ();
}

View file

@ -113,15 +113,9 @@ protected:
std::string GetLinkerMacro () const;
static std::string GetDebugFormat ();
void GenerateCleanObjectsAsYouGoCode () const;
void GenerateRunRsymCode () const;
void GenerateRunStripCode () const;
void GenerateLinkerCommand ( const std::string& dependencies,
const std::string& linkerParameters,
const std::string& pefixupParameters );
void GeneratePhonyTarget() const;
void GenerateLinkerCommand () const;
void GenerateBuildMapCode ( const FileLocation *mapTarget = NULL );
void GenerateRules ();
void GenerateImportLibraryTarget (const FileLocation *defFilename, const FileLocation *library_target, bool delayimp);
void GenerateImportLibraryTargetIfNeeded ();
void GetDefinitionDependencies ( std::vector<FileLocation>& dependencies ) const;
std::string GetLinkingDependencies () const;

View file

@ -19,7 +19,7 @@ RBUILD_intermediate_dir=${call RBUILD_fullpath,$(value INTERMEDIATE)$(SEP)$(dir
RBUILD_output_dir=${call RBUILD_fullpath,$(value OUTPUT)$(SEP)$(dir ${call RBUILD_strip_prefixes,$(1)})}
#(source)
RBUILD_source_name=$(basename $(notdir $(1)))
RBUILD_name=$(basename $(notdir $(1)))
#(source)
RBUILD_dir=${call RBUILD_fullpath,$(dir ${call RBUILD_compress_prefixes,$(1)})}

View file

@ -467,7 +467,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
{
fprintf ( OUT, "\t\t\t<Tool\r\n" );
fprintf ( OUT, "\t\t\t\tName=\"VCLinkerTool\"\r\n" );
if (module.GetEntryPoint(false) == "0" && sys == false)
if (module.GetEntryPoint() == "0" && sys == false)
fprintf ( OUT, "AdditionalOptions=\"/noentry\"" );
if (configuration.VSProjectVersion == "9.00")
@ -540,7 +540,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
if ( sys )
{
if (module.GetEntryPoint(false) == "0")
if (module.GetEntryPoint() == "0")
fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /noentry /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );
else
fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );
@ -548,7 +548,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" );
fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 );
fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 );
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DriverEntry" : module.GetEntryPoint(false).c_str ());
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint() == "" ? "DriverEntry" : module.GetEntryPoint().c_str ());
fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ());
}
else if ( exe )
@ -583,16 +583,16 @@ MSVCBackend::_generate_vcproj ( const Module& module )
}
else if ( dll )
{
if (module.GetEntryPoint(false) == "0")
if (module.GetEntryPoint() == "0")
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" );
else
{
// get rid of DllMain@12 because MSVC needs to link to _DllMainCRTStartup@12
// when using CRT
if (module.GetEntryPoint(false) == "DllMain@12")
if (module.GetEntryPoint() == "DllMain@12")
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" );
else
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false).c_str ());
fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint().c_str ());
}
fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ());
if ( use_msvcrt_lib )

View file

@ -343,14 +343,6 @@ Module::Module ( const Project& project,
else
baseaddress = GetDefaultModuleBaseaddress ();
mangledSymbols = GetBooleanAttribute ( moduleNode, "mangledsymbols" );
att = moduleNode.GetAttribute ( "underscoresymbols", false );
if ( att != NULL )
underscoreSymbols = att->value == "true";
else
underscoreSymbols = false;
isStartupLib = GetBooleanAttribute ( moduleNode, "isstartuplib" );
isCRT = GetBooleanAttribute ( moduleNode, "iscrt", GetDefaultModuleIsCRT () );
@ -1359,12 +1351,13 @@ Module::GetInvocationTarget ( const int index ) const
}
string
Module::GetEntryPoint(bool leadingUnderscore) const
Module::GetEntryPoint() const
{
string result = "";
if (entrypoint == "0" || entrypoint == "0x0")
return "0";
if (leadingUnderscore)
if (Environment::GetArch() != "arm")
result = "_";
result += entrypoint;
@ -1874,10 +1867,6 @@ ImportLibrary::ImportLibrary ( const Project& project,
if ( dllname )
this->dllname = dllname->value;
else if ( module->type == StaticLibrary || module->type == HostStaticLibrary )
throw XMLInvalidBuildFileException (
node.location,
"<importlibrary> dllname attribute required." );
size_t index = definition->value.find_last_of ( "/\\" );
if ( index == string::npos )

View file

@ -378,8 +378,6 @@ public:
ImportLibrary* delayImportLibrary;
Metadata* metadata;
Bootsector* bootSector;
bool mangledSymbols;
bool underscoreSymbols;
bool isUnicode;
bool isDefaultEntryPoint;
Bootstrap* bootstrap;
@ -420,7 +418,7 @@ public:
bool IsDLL () const;
std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
std::string GetEntryPoint(bool leadingUnderscore) const;
std::string GetEntryPoint() const;
void GetTargets ( string_list& ) const;
std::string GetInvocationTarget ( const int index ) const;
bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;