1
0
mirror of https://github.com/golang/go synced 2024-11-25 11:17:56 -07:00

8l: emit DWARF in ELF.

R=rsc, r, ken2
CC=golang-dev
https://golang.org/cl/2004046
This commit is contained in:
Luuk van Dijk 2010-08-30 22:20:38 +02:00
parent 5c603dbb75
commit b433552ebc
7 changed files with 481 additions and 416 deletions

View File

@ -641,8 +641,7 @@ asmb(void)
dwarfemitdebugsections(); dwarfemitdebugsections();
} }
} else } else if(dlm){
if(dlm){
seek(cout, HEADR+textsize+datsize, 0); seek(cout, HEADR+textsize+datsize, 0);
asmdyn(); asmdyn();
cflush(); cflush();

View File

@ -394,9 +394,9 @@ Prog* brchain(Prog*);
Prog* brloop(Prog*); Prog* brloop(Prog*);
void buildop(void); void buildop(void);
void cflush(void); void cflush(void);
vlong cpos(void);
void ckoff(Sym*, int32); void ckoff(Sym*, int32);
Prog* copyp(Prog*); Prog* copyp(Prog*);
vlong cpos(void);
double cputime(void); double cputime(void);
void datblk(int32, int32); void datblk(int32, int32);
void deadcode(void); void deadcode(void);

View File

@ -9,8 +9,10 @@ TARG=8l
OFILES=\ OFILES=\
asm.$O\ asm.$O\
dwarf.$O\
elf.$O\ elf.$O\
enam.$O\ enam.$O\
go.$O\
lib.$O\ lib.$O\
list.$O\ list.$O\
macho.$O\ macho.$O\
@ -19,11 +21,12 @@ OFILES=\
pass.$O\ pass.$O\
pe.$O\ pe.$O\
span.$O\ span.$O\
go.$O\
HFILES=\ HFILES=\
l.h\ l.h\
../8l/8.out.h\ ../8l/8.out.h\
../ld/dwarf.h\
../ld/elf.h\ ../ld/elf.h\
../ld/macho.h\ ../ld/macho.h\
../ld/pe.h\ ../ld/pe.h\

View File

@ -31,6 +31,7 @@
#include "l.h" #include "l.h"
#include "../ld/lib.h" #include "../ld/lib.h"
#include "../ld/elf.h" #include "../ld/elf.h"
#include "../ld/dwarf.h"
#include "../ld/macho.h" #include "../ld/macho.h"
#include "../ld/pe.h" #include "../ld/pe.h"
@ -293,6 +294,7 @@ doelf(void)
elfstr[ElfStrGosymcounts] = addstring(shstrtab, ".gosymcounts"); elfstr[ElfStrGosymcounts] = addstring(shstrtab, ".gosymcounts");
elfstr[ElfStrGosymtab] = addstring(shstrtab, ".gosymtab"); elfstr[ElfStrGosymtab] = addstring(shstrtab, ".gosymtab");
elfstr[ElfStrGopclntab] = addstring(shstrtab, ".gopclntab"); elfstr[ElfStrGopclntab] = addstring(shstrtab, ".gopclntab");
dwarfaddshstrings(shstrtab);
} }
elfstr[ElfStrShstrtab] = addstring(shstrtab, ".shstrtab"); elfstr[ElfStrShstrtab] = addstring(shstrtab, ".shstrtab");
@ -649,8 +651,13 @@ asmb(void)
lputl(symsize); lputl(symsize);
lputl(lcsize); lputl(lcsize);
cflush(); cflush();
} if(!debug['s']) {
else if(dlm){ 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); seek(cout, HEADR+textsize+datsize, 0);
asmdyn(); asmdyn();
cflush(); cflush();
@ -1042,6 +1049,8 @@ asmb(void)
sh->size = w; sh->size = w;
sh->addralign = 1; sh->addralign = 1;
sh->addr = symdatva + 8 + symsize; sh->addr = symdatva + 8 + symsize;
dwarfaddheaders();
} }
sh = newElfShstrtab(elfstr[ElfStrShstrtab]); sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
@ -1118,6 +1127,13 @@ cflush(void)
cbc = sizeof(buf.cbuf); cbc = sizeof(buf.cbuf);
} }
/* Current position in file */
vlong
cpos(void)
{
return seek(cout, 0, 1) + sizeof(buf.cbuf) - cbc;
}
void void
datblk(int32 s, int32 n) datblk(int32 s, int32 n)
{ {

View File

@ -345,6 +345,7 @@ Prog* brloop(Prog*);
void cflush(void); void cflush(void);
void ckoff(Sym*, int32); void ckoff(Sym*, int32);
Prog* copyp(Prog*); Prog* copyp(Prog*);
vlong cpos(void);
double cputime(void); double cputime(void);
void datblk(int32, int32); void datblk(int32, int32);
void diag(char*, ...); void diag(char*, ...);

View File

@ -33,6 +33,7 @@
#include "../ld/lib.h" #include "../ld/lib.h"
#include "../ld/elf.h" #include "../ld/elf.h"
#include "../ld/macho.h" #include "../ld/macho.h"
#include "../ld/dwarf.h"
#include "../ld/pe.h" #include "../ld/pe.h"
#include <ar.h> #include <ar.h>
@ -604,6 +605,7 @@ loop:
histfrogp++; histfrogp++;
} else } else
collapsefrog(s); collapsefrog(s);
dwarfaddfrag(s->value, s->name);
} }
goto loop; goto loop;
} }

File diff suppressed because it is too large Load Diff