Commit b433552e authored by Luuk van Dijk's avatar Luuk van Dijk

8l: emit DWARF in ELF.

R=rsc, r, ken2
CC=golang-dev
https://golang.org/cl/2004046
parent 5c603dbb
......@@ -641,8 +641,7 @@ asmb(void)
dwarfemitdebugsections();
}
} else
if(dlm){
} else if(dlm){
seek(cout, HEADR+textsize+datsize, 0);
asmdyn();
cflush();
......
......@@ -394,9 +394,9 @@ Prog* brchain(Prog*);
Prog* brloop(Prog*);
void buildop(void);
void cflush(void);
vlong cpos(void);
void ckoff(Sym*, int32);
Prog* copyp(Prog*);
vlong cpos(void);
double cputime(void);
void datblk(int32, int32);
void deadcode(void);
......
......@@ -9,8 +9,10 @@ TARG=8l
OFILES=\
asm.$O\
dwarf.$O\
elf.$O\
enam.$O\
go.$O\
lib.$O\
list.$O\
macho.$O\
......@@ -19,11 +21,12 @@ OFILES=\
pass.$O\
pe.$O\
span.$O\
go.$O\
HFILES=\
l.h\
../8l/8.out.h\
../ld/dwarf.h\
../ld/elf.h\
../ld/macho.h\
../ld/pe.h\
......
......@@ -31,6 +31,7 @@
#include "l.h"
#include "../ld/lib.h"
#include "../ld/elf.h"
#include "../ld/dwarf.h"
#include "../ld/macho.h"
#include "../ld/pe.h"
......@@ -293,6 +294,7 @@ doelf(void)
elfstr[ElfStrGosymcounts] = addstring(shstrtab, ".gosymcounts");
elfstr[ElfStrGosymtab] = addstring(shstrtab, ".gosymtab");
elfstr[ElfStrGopclntab] = addstring(shstrtab, ".gopclntab");
dwarfaddshstrings(shstrtab);
}
elfstr[ElfStrShstrtab] = addstring(shstrtab, ".shstrtab");
......@@ -649,8 +651,13 @@ asmb(void)
lputl(symsize);
lputl(lcsize);
cflush();
}
else if(dlm){
if(!debug['s']) {
seek(cout, symo+8+symsize+lcsize, 0);
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfemitdebugsections();
}
} else if(dlm){
seek(cout, HEADR+textsize+datsize, 0);
asmdyn();
cflush();
......@@ -1042,6 +1049,8 @@ asmb(void)
sh->size = w;
sh->addralign = 1;
sh->addr = symdatva + 8 + symsize;
dwarfaddheaders();
}
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
......@@ -1118,6 +1127,13 @@ cflush(void)
cbc = sizeof(buf.cbuf);
}
/* Current position in file */
vlong
cpos(void)
{
return seek(cout, 0, 1) + sizeof(buf.cbuf) - cbc;
}
void
datblk(int32 s, int32 n)
{
......
......@@ -345,6 +345,7 @@ Prog* brloop(Prog*);
void cflush(void);
void ckoff(Sym*, int32);
Prog* copyp(Prog*);
vlong cpos(void);
double cputime(void);
void datblk(int32, int32);
void diag(char*, ...);
......
......@@ -33,6 +33,7 @@
#include "../ld/lib.h"
#include "../ld/elf.h"
#include "../ld/macho.h"
#include "../ld/dwarf.h"
#include "../ld/pe.h"
#include <ar.h>
......@@ -604,6 +605,7 @@ loop:
histfrogp++;
} else
collapsefrog(s);
dwarfaddfrag(s->value, s->name);
}
goto loop;
}
......
This diff is collapsed.
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