[ros-diffs] [hyperion] 37861: modified tools/rbuild/backend/mingw/modulehandler.cpp DWARF debugging information confuses rsym, and DWARF-2 information from internal libraries (like libgcc) results in huge executables that don't even run on Windows. Therefore, before the rsym phase, strip all DWARF-2 sections This is a HACK for gcc builds compiled with DWARF-2 symbols (e.g. 4.3.2-tdm-1). The real solution (to be implemented soon) is to parse DWARF-2 line numbers in rsym Amendment to r37851: use objcopy instead of strip because strip gets us more than we bargained for, and strips all debug information too modified tools/rsym.c Don't overrun a heap block when there are discarded relocations

hyperion at svn.reactos.org hyperion at svn.reactos.org
Thu Dec 4 22:13:44 CET 2008


Author: hyperion
Date: Thu Dec  4 15:13:43 2008
New Revision: 37861

URL: http://svn.reactos.org/svn/reactos?rev=37861&view=rev
Log:
modified   tools/rbuild/backend/mingw/modulehandler.cpp
   DWARF debugging information confuses rsym, and DWARF-2 information from internal libraries (like libgcc) results in huge executables that don't even run on Windows. Therefore, before the rsym phase, strip all DWARF-2 sections
   This is a HACK for gcc builds compiled with DWARF-2 symbols (e.g. 4.3.2-tdm-1). The real solution (to be implemented soon) is to parse DWARF-2 line numbers in rsym
   Amendment to r37851: use objcopy instead of strip because strip gets us more than we bargained for, and strips all debug information too

modified   tools/rsym.c
   Don't overrun a heap block when there are discarded relocations

Modified:
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rsym.c

Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp?rev=37861&r1=37860&r2=37861&view=diff
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp [iso-8859-1] Thu Dec  4 15:13:43 2008
@@ -1428,6 +1428,9 @@
              "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,

Modified: trunk/reactos/tools/rsym.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rsym.c?rev=37861&r1=37860&r2=37861&view=diff
==============================================================================
--- trunk/reactos/tools/rsym.c [iso-8859-1] (original)
+++ trunk/reactos/tools/rsym.c [iso-8859-1] Thu Dec  4 15:13:43 2008
@@ -697,19 +697,23 @@
   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);
-        }
-      for (i = 0; i < OutSectionHeaders[Section].SizeOfRawData / 2; i++)
+	  SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData;
+        }
+      for (i = 0; i < SizeOfRawData / 2; i++)
         {
           CheckSum += ((unsigned short*) Data)[i];
           CheckSum = 0xffff & (CheckSum + (CheckSum >> 16));
@@ -730,21 +734,24 @@
     {
       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);
-            }
-          if (fwrite(Data, 1, OutSectionHeaders[Section].SizeOfRawData, OutFile) !=
-              OutSectionHeaders[Section].SizeOfRawData)
+	      SizeOfRawData = OutSectionHeaders[Section].SizeOfRawData;
+            }
+          if (fwrite(Data, 1, SizeOfRawData, OutFile) != SizeOfRawData)
             {
               perror("Error writing section data\n");
               free(PaddedRosSym);



More information about the Ros-diffs mailing list