Commit 34ac4ec3 authored by Alex Brainman's avatar Alex Brainman

6l, 8l: emit windows dwarf sections similar to other platforms

R=golang-dev, rsc
CC=golang-dev, vcc.163
https://golang.org/cl/4517056
parent 142008c3
...@@ -787,40 +787,50 @@ asmb(void) ...@@ -787,40 +787,50 @@ asmb(void)
symo = rnd(symo, PEFILEALIGN); symo = rnd(symo, PEFILEALIGN);
break; break;
} }
/* switch(HEADTYPE) {
* the symbol information is stored as default:
* 32-bit symbol table size if(iself) {
* 32-bit line number table size /*
* symbol table * the symbol information is stored as
* line number table * 32-bit symbol table size
*/ * 32-bit line number table size
seek(cout, symo+8, 0); * symbol table
if(debug['v']) * line number table
Bprint(&bso, "%5.2f sp\n", cputime()); */
Bflush(&bso); seek(cout, symo+8, 0);
if(debug['v']) if(debug['v'])
Bprint(&bso, "%5.2f pc\n", cputime()); Bprint(&bso, "%5.2f sp\n", cputime());
Bflush(&bso); Bflush(&bso);
if(!debug['s']) if(debug['v'])
strnput("", INITRND-(8+symsize+lcsize)%INITRND); Bprint(&bso, "%5.2f pc\n", cputime());
cflush(); Bflush(&bso);
seek(cout, symo, 0); if(!debug['s'])
lputl(symsize); strnput("", INITRND-(8+symsize+lcsize)%INITRND);
lputl(lcsize); cflush();
cflush(); seek(cout, symo, 0);
if(HEADTYPE != Hwindows && !debug['s']) { lputl(symsize);
elfsymo = symo+8+symsize+lcsize; lputl(lcsize);
seek(cout, elfsymo, 0); cflush();
asmelfsym64(); elfsymo = symo+8+symsize+lcsize;
cflush(); seek(cout, elfsymo, 0);
elfstro = seek(cout, 0, 1); asmelfsym64();
elfsymsize = elfstro - elfsymo; cflush();
ewrite(cout, elfstrdat, elfstrsize); elfstro = seek(cout, 0, 1);
elfsymsize = elfstro - elfsymo;
ewrite(cout, elfstrdat, elfstrsize);
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfemitdebugsections();
}
break;
case Hwindows:
if(debug['v']) if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime()); Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfemitdebugsections(); dwarfemitdebugsections();
break;
} }
} }
......
...@@ -742,12 +742,29 @@ asmb(void) ...@@ -742,12 +742,29 @@ asmb(void)
symo = rnd(symo, INITRND); symo = rnd(symo, INITRND);
break; break;
case Hwindows: case Hwindows:
// TODO(brainman): not sure what symo meant to be, but it is not used for Windows PE for now anyway
symo = rnd(HEADR+segtext.filelen, PEFILEALIGN)+segdata.filelen; symo = rnd(HEADR+segtext.filelen, PEFILEALIGN)+segdata.filelen;
symo = rnd(symo, PEFILEALIGN); symo = rnd(symo, PEFILEALIGN);
break; break;
} }
if(HEADTYPE == Hplan9x32) { switch(HEADTYPE) {
default:
if(iself) {
if(debug['v'])
Bprint(&bso, "%5.2f elfsym\n", cputime());
elfsymo = symo+8+symsize+lcsize;
seek(cout, elfsymo, 0);
asmelfsym32();
cflush();
elfstro = seek(cout, 0, 1);
elfsymsize = elfstro - elfsymo;
ewrite(cout, elfstrdat, elfstrsize);
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfemitdebugsections();
}
break;
case Hplan9x32:
seek(cout, symo, 0); seek(cout, symo, 0);
asmplan9sym(); asmplan9sym();
cflush(); cflush();
...@@ -760,20 +777,13 @@ asmb(void) ...@@ -760,20 +777,13 @@ asmb(void)
cflush(); cflush();
} }
} else if(iself) { break;
if(debug['v']) case Hwindows:
Bprint(&bso, "%5.2f elfsym\n", cputime()); seek(cout, symo, 0);
elfsymo = symo+8+symsize+lcsize;
seek(cout, elfsymo, 0);
asmelfsym32();
cflush();
elfstro = seek(cout, 0, 1);
elfsymsize = elfstro - elfsymo;
ewrite(cout, elfstrdat, elfstrsize);
if(debug['v']) if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime()); Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfemitdebugsections(); dwarfemitdebugsections();
break;
} }
} }
if(debug['v']) if(debug['v'])
......
...@@ -2562,7 +2562,6 @@ dwarfaddmachoheaders(void) ...@@ -2562,7 +2562,6 @@ dwarfaddmachoheaders(void)
void void
dwarfaddpeheaders(void) dwarfaddpeheaders(void)
{ {
dwarfemitdebugsections();
newPEDWARFSection(".debug_abbrev", abbrevsize); newPEDWARFSection(".debug_abbrev", abbrevsize);
newPEDWARFSection(".debug_line", linesize); newPEDWARFSection(".debug_line", linesize);
newPEDWARFSection(".debug_frame", framesize); newPEDWARFSection(".debug_frame", framesize);
......
...@@ -484,13 +484,13 @@ asmbpe(void) ...@@ -484,13 +484,13 @@ asmbpe(void)
d->Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA| d->Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA|
IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE; IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE;
if(!debug['s'])
dwarfaddpeheaders();
addimports(nextfileoff, d); addimports(nextfileoff, d);
addexports(nextfileoff); addexports(nextfileoff);
if(!debug['s'])
dwarfaddpeheaders();
addsymtable(); addsymtable();
fh.NumberOfSections = nsect; fh.NumberOfSections = nsect;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment