mirror of
https://github.com/golang/go
synced 2024-11-12 10:20:27 -07:00
6l/8l: emit DWARF in macho.
R=rsc, r, ken2 CC=golang-dev https://golang.org/cl/2128041
This commit is contained in:
parent
49b19e1b39
commit
728003e340
@ -929,7 +929,7 @@ asmb(void)
|
||||
sh->size = elfstrsize;
|
||||
sh->addralign = 1;
|
||||
|
||||
dwarfaddheaders();
|
||||
dwarfaddelfheaders();
|
||||
}
|
||||
|
||||
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
|
||||
|
@ -1050,7 +1050,7 @@ asmb(void)
|
||||
sh->addralign = 1;
|
||||
sh->addr = symdatva + 8 + symsize;
|
||||
|
||||
dwarfaddheaders();
|
||||
dwarfaddelfheaders();
|
||||
}
|
||||
|
||||
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "../ld/dwarf.h"
|
||||
#include "../ld/dwarf_defs.h"
|
||||
#include "../ld/elf.h"
|
||||
#include "../ld/macho.h"
|
||||
|
||||
/*
|
||||
* Offsets and sizes of the .debug_* sections in the cout file.
|
||||
@ -835,7 +836,7 @@ dwarfemitdebugsections(void)
|
||||
}
|
||||
|
||||
void
|
||||
dwarfaddheaders(void)
|
||||
dwarfaddelfheaders(void)
|
||||
{
|
||||
ElfShdr *sh;
|
||||
|
||||
@ -857,3 +858,32 @@ dwarfaddheaders(void)
|
||||
sh->size = infosize;
|
||||
sh->addralign = 1;
|
||||
}
|
||||
|
||||
void
|
||||
dwarfaddmachoheaders(void)
|
||||
{
|
||||
MachoSect *msect;
|
||||
MachoSeg *ms;
|
||||
|
||||
vlong fakestart;
|
||||
|
||||
// Zero vsize segments won't be loaded in memory, even so they
|
||||
// have to be page aligned in the file.
|
||||
fakestart = abbrevo & ~0xfff;
|
||||
|
||||
ms = newMachoSeg("__DWARF", 3);
|
||||
ms->fileoffset = fakestart;
|
||||
ms->filesize = abbrevo-fakestart + abbrevsize+linesize+infosize;
|
||||
|
||||
msect = newMachoSect(ms, "__debug_abbrev");
|
||||
msect->off = abbrevo;
|
||||
msect->size = abbrevsize;
|
||||
|
||||
msect = newMachoSect(ms, "__debug_line");
|
||||
msect->off = lineo;
|
||||
msect->size = linesize;
|
||||
|
||||
msect = newMachoSect(ms, "__debug_info");
|
||||
msect->off = infoo;
|
||||
msect->size = infosize;
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ void dwarfaddshstrings(Sym *shstrtab);
|
||||
void dwarfemitdebugsections(void);
|
||||
|
||||
/*
|
||||
* Add ELF section headers pointing to the sections emitted in
|
||||
* Add section headers pointing to the sections emitted in
|
||||
* dwarfemitdebugsections.
|
||||
*/
|
||||
void dwarfaddheaders(void);
|
||||
void dwarfaddelfheaders(void);
|
||||
void dwarfaddmachoheaders(void);
|
||||
|
@ -6,6 +6,7 @@
|
||||
// http://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
|
||||
|
||||
#include "l.h"
|
||||
#include "../ld/dwarf.h"
|
||||
#include "../ld/lib.h"
|
||||
#include "../ld/macho.h"
|
||||
|
||||
@ -129,7 +130,7 @@ machowrite(void)
|
||||
MachoDebug *d;
|
||||
MachoLoad *l;
|
||||
|
||||
o1 = Boffset(&bso);
|
||||
o1 = cpos();
|
||||
|
||||
loadsize = 4*4*ndebug;
|
||||
for(i=0; i<nload; i++)
|
||||
@ -229,7 +230,7 @@ machowrite(void)
|
||||
LPUT(d->filesize);
|
||||
}
|
||||
|
||||
return Boffset(&bso) - o1;
|
||||
return cpos() - o1;
|
||||
}
|
||||
|
||||
static void*
|
||||
@ -617,6 +618,8 @@ asmbmacho(vlong symdatva, vlong symo)
|
||||
md = newMachoDebug();
|
||||
md->fileoffset = symo+8+symsize;
|
||||
md->filesize = lcsize;
|
||||
|
||||
dwarfaddmachoheaders();
|
||||
}
|
||||
|
||||
a = machowrite();
|
||||
|
Loading…
Reference in New Issue
Block a user