]> Cypherpunks repositories - gostls13.git/commitdiff
8l: do not emit empty dwarf pe sections
authorAlex Brainman <alex.brainman@gmail.com>
Tue, 26 Apr 2011 07:12:16 +0000 (17:12 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Tue, 26 Apr 2011 07:12:16 +0000 (17:12 +1000)
This change will allow to generate valid executable,
even if rsc disables dwarf generation, as it happend
at revision 9a64273f9d68.

R=rsc
CC=golang-dev, lvd, vcc
https://golang.org/cl/4425066

src/cmd/ld/dwarf.c
src/cmd/ld/pe.c

index ba735265c8281a7c35f31219ce09311899ccdbef..98b068008b6821c98daab8deaed77fa524f2402d 100644 (file)
@@ -2567,12 +2567,8 @@ dwarfaddpeheaders(void)
        newPEDWARFSection(".debug_line", linesize);
        newPEDWARFSection(".debug_frame", framesize);
        newPEDWARFSection(".debug_info", infosize);
-       if (pubnamessize > 0)
-               newPEDWARFSection(".debug_pubnames", pubnamessize);
-       if (pubtypessize > 0)
-               newPEDWARFSection(".debug_pubtypes", pubtypessize);
-       if (arangessize > 0)
-               newPEDWARFSection(".debug_aranges", arangessize);
-       if (gdbscriptsize > 0)
-               newPEDWARFSection(".debug_gdb_scripts", gdbscriptsize);
+       newPEDWARFSection(".debug_pubnames", pubnamessize);
+       newPEDWARFSection(".debug_pubtypes", pubtypessize);
+       newPEDWARFSection(".debug_aranges", arangessize);
+       newPEDWARFSection(".debug_gdb_scripts", gdbscriptsize);
 }
index 0d4240e36dcdcac4641120b66a2c47dd6a52206f..d523ca9c5ba864a6b826e1247f511d7b0676c0c5 100644 (file)
@@ -415,6 +415,9 @@ newPEDWARFSection(char *name, vlong size)
        IMAGE_SECTION_HEADER *h;
        char s[8];
 
+       if(size == 0)
+               return nil;
+
        if(nextsymoff+strlen(name)+1 > sizeof(symnames)) {
                diag("pe string table is full");
                errorexit();