#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.
}
void
-dwarfaddheaders(void)
+dwarfaddelfheaders(void)
{
ElfShdr *sh;
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;
+}
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);
// 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"
MachoDebug *d;
MachoLoad *l;
- o1 = Boffset(&bso);
+ o1 = cpos();
loadsize = 4*4*ndebug;
for(i=0; i<nload; i++)
LPUT(d->filesize);
}
- return Boffset(&bso) - o1;
+ return cpos() - o1;
}
static void*
md = newMachoDebug();
md->fileoffset = symo+8+symsize;
md->filesize = lcsize;
+
+ dwarfaddmachoheaders();
}
a = machowrite();