mirror of
https://github.com/golang/go
synced 2024-11-23 07:20:06 -07:00
cmd/5l: fix invalid executable header on Plan 9
R=minux.ma, lucio.dere CC=golang-dev https://golang.org/cl/7094048
This commit is contained in:
parent
c13866db7f
commit
1a9a63961b
@ -490,6 +490,8 @@ asmb(void)
|
|||||||
int32 t;
|
int32 t;
|
||||||
uint32 symo;
|
uint32 symo;
|
||||||
Section *sect;
|
Section *sect;
|
||||||
|
Sym *sym;
|
||||||
|
int i;
|
||||||
|
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f asmb\n", cputime());
|
Bprint(&bso, "%5.2f asmb\n", cputime());
|
||||||
@ -546,18 +548,34 @@ asmb(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cseek(symo);
|
cseek(symo);
|
||||||
if(iself) {
|
switch(HEADTYPE) {
|
||||||
if(debug['v'])
|
default:
|
||||||
Bprint(&bso, "%5.2f elfsym\n", cputime());
|
if(iself) {
|
||||||
asmelfsym();
|
if(debug['v'])
|
||||||
cflush();
|
Bprint(&bso, "%5.2f elfsym\n", cputime());
|
||||||
cwrite(elfstrdat, elfstrsize);
|
asmelfsym();
|
||||||
|
cflush();
|
||||||
|
cwrite(elfstrdat, elfstrsize);
|
||||||
|
|
||||||
if(debug['v'])
|
if(debug['v'])
|
||||||
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
Bprint(&bso, "%5.2f dwarf\n", cputime());
|
||||||
dwarfemitdebugsections();
|
dwarfemitdebugsections();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Hplan9x32:
|
||||||
|
asmplan9sym();
|
||||||
|
cflush();
|
||||||
|
|
||||||
|
sym = lookup("pclntab", 0);
|
||||||
|
if(sym != nil) {
|
||||||
|
lcsize = sym->np;
|
||||||
|
for(i=0; i < lcsize; i++)
|
||||||
|
cput(sym->p[i]);
|
||||||
|
|
||||||
|
cflush();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cflush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cursym = nil;
|
cursym = nil;
|
||||||
@ -581,7 +599,7 @@ asmb(void)
|
|||||||
- 8) / 4); /* BL - entry code */
|
- 8) / 4); /* BL - entry code */
|
||||||
|
|
||||||
lputl(0xef000011); /* SWI - exit code */
|
lputl(0xef000011); /* SWI - exit code */
|
||||||
lputl(textsize+HEADR); /* text size */
|
lputl(segtext.filelen+HEADR); /* text size */
|
||||||
lputl(segdata.filelen); /* data size */
|
lputl(segdata.filelen); /* data size */
|
||||||
lputl(0); /* sym size */
|
lputl(0); /* sym size */
|
||||||
|
|
||||||
@ -601,7 +619,7 @@ asmb(void)
|
|||||||
break;
|
break;
|
||||||
case Hplan9x32: /* plan 9 */
|
case Hplan9x32: /* plan 9 */
|
||||||
lput(0x647); /* magic */
|
lput(0x647); /* magic */
|
||||||
lput(textsize); /* sizes */
|
lput(segtext.filelen); /* sizes */
|
||||||
lput(segdata.filelen);
|
lput(segdata.filelen);
|
||||||
lput(segdata.len - segdata.filelen);
|
lput(segdata.len - segdata.filelen);
|
||||||
lput(symsize); /* nsyms */
|
lput(symsize); /* nsyms */
|
||||||
@ -626,12 +644,12 @@ asmb(void)
|
|||||||
}
|
}
|
||||||
cflush();
|
cflush();
|
||||||
if(debug['c']){
|
if(debug['c']){
|
||||||
print("textsize=%d\n", textsize);
|
print("textsize=%d\n", segtext.filelen);
|
||||||
print("datsize=%ulld\n", segdata.filelen);
|
print("datsize=%ulld\n", segdata.filelen);
|
||||||
print("bsssize=%ulld\n", segdata.len - segdata.filelen);
|
print("bsssize=%ulld\n", segdata.len - segdata.filelen);
|
||||||
print("symsize=%d\n", symsize);
|
print("symsize=%d\n", symsize);
|
||||||
print("lcsize=%d\n", lcsize);
|
print("lcsize=%d\n", lcsize);
|
||||||
print("total=%lld\n", textsize+segdata.len+symsize+lcsize);
|
print("total=%lld\n", segtext.filelen+segdata.len+symsize+lcsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,6 @@ EXTERN char* rpath;
|
|||||||
EXTERN uint32 stroffset;
|
EXTERN uint32 stroffset;
|
||||||
EXTERN int32 symsize;
|
EXTERN int32 symsize;
|
||||||
EXTERN Sym* textp;
|
EXTERN Sym* textp;
|
||||||
EXTERN int32 textsize;
|
|
||||||
EXTERN int version;
|
EXTERN int version;
|
||||||
EXTERN char xcmp[C_GOK+1][C_GOK+1];
|
EXTERN char xcmp[C_GOK+1][C_GOK+1];
|
||||||
EXTERN Prog zprg;
|
EXTERN Prog zprg;
|
||||||
|
Loading…
Reference in New Issue
Block a user