diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 2f7d1f4215f..b69789eb166 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -545,9 +545,10 @@ MingwBackend::GenerateGlobalVariables () const 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 */ - fprintf ( fMakefile, "ifeq ($(ARCH),amd64)\n" ); - fprintf ( fMakefile, "PROJECT_LPPFLAGS += '$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)'\n" ); - fprintf ( fMakefile, "endif\n" ); + if (Environment::GetArch() == "amd64") + { + fprintf ( fMakefile, "PROJECT_LPPFLAGS += '$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)'\n" ); + } fprintf ( fMakefile, "PROJECT_GCCOPTIONS += -Wall\n" ); fprintf ( fMakefile, "ifneq ($(OARCH),)\n" ); fprintf ( fMakefile, "PROJECT_GCCOPTIONS += -march=$(OARCH)\n" ); diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index cc607e9ca1a..f533471a22d 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -1874,6 +1874,16 @@ MingwModuleHandler::GetLinkerMacro () const module.name.c_str () ); } +string +MingwModuleHandler::GetDebugFormat () const +{ + if (Environment::GetArch() == "amd64") + { + return "dwarf-2"; + } + return "stabs+"; +} + string MingwModuleHandler::GetModuleTargets ( const Module& module ) { @@ -2031,7 +2041,7 @@ MingwModuleHandler::GenerateOtherMacros () } else globalCflags += " -Wall -Wpointer-arith"; - globalCflags += " -gstabs+"; + globalCflags += " -g" + MingwModuleHandler::GetDebugFormat (); if ( backend->usePipe ) globalCflags += " -pipe"; if ( !module.allowWarnings ) @@ -3681,6 +3691,7 @@ MingwElfExecutableModuleHandler::Process () string objectsMacro = GetObjectsMacro ( module ); string linkDepsMacro = GetLinkingDependenciesMacro (); string libsMacro = GetLibsMacro (); + string debugFormat = GetDebugFormat (); GenerateRules (); @@ -3694,10 +3705,11 @@ MingwElfExecutableModuleHandler::Process () fprintf ( fMakefile, "\t$(ECHO_BOOTPROG)\n" ); - fprintf ( fMakefile, "\t${gcc} $(%s_LINKFORMAT) %s %s -gstabs+ -o %s\n", + fprintf ( fMakefile, "\t${gcc} $(%s_LINKFORMAT) %s %s -g%s -o %s\n", module.buildtype.c_str(), objectsMacro.c_str(), libsMacro.c_str(), + debugFormat.c_str(), targetMacro.c_str () ); delete target_file; diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h index a06205616e4..d6a529d016c 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@ -102,6 +102,7 @@ protected: std::string GetLinkingDependenciesMacro () const; std::string GetLibsMacro () const; std::string GetLinkerMacro () const; + std::string GetDebugFormat () const; void GenerateCleanObjectsAsYouGoCode () const; void GenerateRunRsymCode () const; void GenerateRunStripCode () const;