diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 6e367c75f46..fac212413d1 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -1428,6 +1428,9 @@ MingwModuleHandler::GenerateRunRsymCode () const "ifneq ($(ROS_GENERATE_RSYM),no)\n" ); fprintf ( fMakefile, "\t$(ECHO_RSYM)\n" ); + // FIXME! workaround until rsym can extract line numbers from DWARF + fprintf ( fMakefile, + "\t$(Q)${objcopy} -R .debug_abbrev -R .debug_aranges -R .debug_frame -R .debug_info -R .debug_line -R .debug_pubnames -R .debug_macinfo -R .debug_str -R .debug_loc -R .debug_pubtypes -R .debug_ranges -R .debug_static_func -R .debug_static_vars -R .debug_types -R .debug_weaknames $@\n\n" ); fprintf ( fMakefile, "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" ); fprintf ( fMakefile, diff --git a/reactos/tools/rsym.c b/reactos/tools/rsym.c index 0ae8fb8ea46..2b3940cdde5 100644 --- a/reactos/tools/rsym.c +++ b/reactos/tools/rsym.c @@ -697,19 +697,23 @@ CreateOutputFile(FILE *OutFile, void *InData, Length = StartOfRawData; for (Section = 0; Section < OutFileHeader->NumberOfSections; Section++) { + DWORD SizeOfRawData; if (OutRelocSection == OutSectionHeaders + Section) { Data = (void *) ProcessedRelocs; + SizeOfRawData = ProcessedRelocsLength; } else if (RosSymLength > 0 && Section + 1 == OutFileHeader->NumberOfSections) { Data = (void *) PaddedRosSym; + SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData; } else { Data = (void *) ((char *) InData + OutSectionHeaders[Section].PointerToRawData); + SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData; } - for (i = 0; i < OutSectionHeaders[Section].SizeOfRawData / 2; i++) + for (i = 0; i < SizeOfRawData / 2; i++) { CheckSum += ((unsigned short*) Data)[i]; CheckSum = 0xffff & (CheckSum + (CheckSum >> 16)); @@ -730,21 +734,24 @@ CreateOutputFile(FILE *OutFile, void *InData, { if (0 != OutSectionHeaders[Section].SizeOfRawData) { + DWORD SizeOfRawData; fseek(OutFile, OutSectionHeaders[Section].PointerToRawData, SEEK_SET); if (OutRelocSection == OutSectionHeaders + Section) { Data = (void *) ProcessedRelocs; + SizeOfRawData = ProcessedRelocsLength; } else if (RosSymLength > 0 && Section + 1 == OutFileHeader->NumberOfSections) { Data = (void *) PaddedRosSym; + SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData; } else { Data = (void *) ((char *) InData + OutSectionHeaders[Section].PointerToRawData); + SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData; } - if (fwrite(Data, 1, OutSectionHeaders[Section].SizeOfRawData, OutFile) != - OutSectionHeaders[Section].SizeOfRawData) + if (fwrite(Data, 1, SizeOfRawData, OutFile) != SizeOfRawData) { perror("Error writing section data\n"); free(PaddedRosSym);