mirror of
https://github.com/golang/go
synced 2024-11-21 22:14:41 -07:00
6l, 8l: emit macho dwarf info before linkedit section
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5272050
This commit is contained in:
parent
c7cf56bec9
commit
4566868b41
@ -703,7 +703,7 @@ asmb(void)
|
|||||||
{
|
{
|
||||||
int32 magic;
|
int32 magic;
|
||||||
int a, dynsym;
|
int a, dynsym;
|
||||||
vlong vl, startva, symo, machlink;
|
vlong vl, startva, symo, dwarfoff, machlink;
|
||||||
ElfEhdr *eh;
|
ElfEhdr *eh;
|
||||||
ElfPhdr *ph, *pph;
|
ElfPhdr *ph, *pph;
|
||||||
ElfShdr *sh;
|
ElfShdr *sh;
|
||||||
@ -738,8 +738,19 @@ asmb(void)
|
|||||||
datblk(segdata.vaddr, segdata.filelen);
|
datblk(segdata.vaddr, segdata.filelen);
|
||||||
|
|
||||||
machlink = 0;
|
machlink = 0;
|
||||||
if(HEADTYPE == Hdarwin)
|
if(HEADTYPE == Hdarwin) {
|
||||||
|
if(debug['v'])
|
||||||
|
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
||||||
|
|
||||||
|
dwarfoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
|
||||||
|
cseek(dwarfoff);
|
||||||
|
|
||||||
|
segdwarf.fileoff = cpos();
|
||||||
|
dwarfemitdebugsections();
|
||||||
|
segdwarf.filelen = cpos() - segdwarf.fileoff;
|
||||||
|
|
||||||
machlink = domacholink();
|
machlink = domacholink();
|
||||||
|
}
|
||||||
|
|
||||||
switch(HEADTYPE) {
|
switch(HEADTYPE) {
|
||||||
default:
|
default:
|
||||||
@ -811,7 +822,6 @@ asmb(void)
|
|||||||
dwarfemitdebugsections();
|
dwarfemitdebugsections();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Hdarwin:
|
|
||||||
case Hwindows:
|
case Hwindows:
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
||||||
|
@ -660,7 +660,7 @@ asmb(void)
|
|||||||
{
|
{
|
||||||
int32 v, magic;
|
int32 v, magic;
|
||||||
int a, dynsym;
|
int a, dynsym;
|
||||||
uint32 symo, startva, machlink;
|
uint32 symo, startva, dwarfoff, machlink;
|
||||||
ElfEhdr *eh;
|
ElfEhdr *eh;
|
||||||
ElfPhdr *ph, *pph;
|
ElfPhdr *ph, *pph;
|
||||||
ElfShdr *sh;
|
ElfShdr *sh;
|
||||||
@ -691,8 +691,19 @@ asmb(void)
|
|||||||
datblk(segdata.vaddr, segdata.filelen);
|
datblk(segdata.vaddr, segdata.filelen);
|
||||||
|
|
||||||
machlink = 0;
|
machlink = 0;
|
||||||
if(HEADTYPE == Hdarwin)
|
if(HEADTYPE == Hdarwin) {
|
||||||
|
if(debug['v'])
|
||||||
|
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
||||||
|
|
||||||
|
dwarfoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
|
||||||
|
cseek(dwarfoff);
|
||||||
|
|
||||||
|
segdwarf.fileoff = cpos();
|
||||||
|
dwarfemitdebugsections();
|
||||||
|
segdwarf.filelen = cpos() - segdwarf.fileoff;
|
||||||
|
|
||||||
machlink = domacholink();
|
machlink = domacholink();
|
||||||
|
}
|
||||||
|
|
||||||
if(iself) {
|
if(iself) {
|
||||||
/* index of elf text section; needed by asmelfsym, double-checked below */
|
/* index of elf text section; needed by asmelfsym, double-checked below */
|
||||||
@ -772,7 +783,6 @@ asmb(void)
|
|||||||
cflush();
|
cflush();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Hdarwin:
|
|
||||||
case Hwindows:
|
case Hwindows:
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
||||||
|
@ -129,6 +129,7 @@ EXTERN int havedynamic;
|
|||||||
EXTERN Segment segtext;
|
EXTERN Segment segtext;
|
||||||
EXTERN Segment segdata;
|
EXTERN Segment segdata;
|
||||||
EXTERN Segment segsym;
|
EXTERN Segment segsym;
|
||||||
|
EXTERN Segment segdwarf;
|
||||||
|
|
||||||
void addlib(char *src, char *obj);
|
void addlib(char *src, char *obj);
|
||||||
void addlibpath(char *srcref, char *objref, char *file, char *pkg);
|
void addlibpath(char *srcref, char *objref, char *file, char *pkg);
|
||||||
|
@ -505,7 +505,7 @@ domacholink(void)
|
|||||||
size = s1->size + s2->size + s3->size + s4->size;
|
size = s1->size + s2->size + s3->size + s4->size;
|
||||||
|
|
||||||
if(size > 0) {
|
if(size > 0) {
|
||||||
linkoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
|
linkoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND) + rnd(segdwarf.filelen, INITRND);
|
||||||
cseek(linkoff);
|
cseek(linkoff);
|
||||||
|
|
||||||
cwrite(s1->p, s1->size);
|
cwrite(s1->p, s1->size);
|
||||||
|
Loading…
Reference in New Issue
Block a user