diff options
author | Alex Brainman <alex.brainman@gmail.com> | 2011-04-26 17:12:16 +1000 |
---|---|---|
committer | Alex Brainman <alex.brainman@gmail.com> | 2011-04-26 17:12:16 +1000 |
commit | 2d99974ec580423241a67d43aacab93a8cda2978 (patch) | |
tree | 163c4fd310973feaba60adecc8f40e2e9cdf8092 | |
parent | 1038e7c853502d29e6bafd5003bec6ba26e00da5 (diff) | |
download | go-2d99974ec580423241a67d43aacab93a8cda2978.tar.gz go-2d99974ec580423241a67d43aacab93a8cda2978.zip |
8l: do not emit empty dwarf pe sections
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
-rw-r--r-- | src/cmd/ld/dwarf.c | 12 | ||||
-rw-r--r-- | src/cmd/ld/pe.c | 3 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index ba735265c8..98b068008b 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -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); } diff --git a/src/cmd/ld/pe.c b/src/cmd/ld/pe.c index 0d4240e36d..d523ca9c5b 100644 --- a/src/cmd/ld/pe.c +++ b/src/cmd/ld/pe.c @@ -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(); |