Commit d7b10060 authored by Russ Cox's avatar Russ Cox

cmd/ld: clean for c2go

Change-Id: Iaab2be9a1919f2fa9dbc61a5b7fbf99bcd0712a9
Reviewed-on: https://go-review.googlesource.com/6332Reviewed-by: default avatarRob Pike <r@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
parent 0aac9bb8
......@@ -28,13 +28,21 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define ARMAG "!<arch>\n"
#define SARMAG 8
enum {
SARMAG = 8,
SARNAME = 16,
SAR_HDR = 16+44,
};
#define ARMAG "!<arch>\n"
#define ARFMAG "`\n"
#define SARNAME 16
/*c2go
char ARMAG[] = "!<arch>\n";
char ARFMAG[] = "`\n";
*/
struct ar_hdr
typedef struct ArHdr ArHdr;
struct ArHdr
{
char name[SARNAME];
char date[12];
......@@ -44,4 +52,3 @@ struct ar_hdr
char size[10];
char fmag[2];
};
#define SAR_HDR (SARNAME+44)
......@@ -52,9 +52,6 @@ struct Reloc
LSym* xsym;
};
// prevent incompatible type signatures between liblink and 8l on Plan 9
#pragma incomplete struct Section
struct LSym
{
char* name;
......@@ -94,7 +91,7 @@ struct LSym
char* file;
char* dynimplib;
char* dynimpvers;
struct Section* sect;
void* sect;
// STEXT
Auto* autom;
......
// Inferno utils/include/ar.h
// http://code.google.com/p/inferno-os/source/browse/utils/include/ar.h
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
// Portions Copyright © 1997-1999 Vita Nuova Limited
// Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
// Portions Copyright © 2004,2006 Bruce Ellis
// Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
// Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
// Portions Copyright © 2009 The Go Authors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
enum {
SARMAG = 8,
SARNAME = 16,
SAR_HDR = 16+44,
};
#define ARMAG "!<arch>\n"
#define ARFMAG "`\n"
/*c2go
char ARMAG[] = "!<arch>\n";
char ARFMAG[] = "`\n";
*/
typedef struct ArHdr ArHdr;
struct ArHdr
{
char name[SARNAME];
char date[12];
char uid[6];
char gid[6];
char mode[8];
char size[10];
char fmag[2];
};
......@@ -305,9 +305,9 @@ machoreloc1(Reloc *r, vlong sectoff)
v = rs->dynid;
v |= 1<<27; // external relocation
} else {
v = rs->sect->extnum;
v = ((Section*)rs->sect)->extnum;
if(v == 0) {
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, rs->sect->name, rs->type);
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, ((Section*)rs->sect)->name, rs->type);
return -1;
}
}
......@@ -610,10 +610,10 @@ asmb(void)
sect = segtext.sect;
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
codeblk(sect->vaddr, sect->len);
codeblk(sect->vaddr, sect->length);
for(sect = sect->next; sect != nil; sect = sect->next) {
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
datblk(sect->vaddr, sect->len);
datblk(sect->vaddr, sect->length);
}
if(segrodata.filelen > 0) {
......@@ -638,7 +638,7 @@ asmb(void)
Bprint(&bso, "%5.2f dwarf\n", cputime());
if(!debug['w']) { // TODO(minux): enable DWARF Support
dwarfoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
dwarfoff = rnd(HEADR+segtext.length, INITRND) + rnd(segdata.filelen, INITRND);
cseek(dwarfoff);
segdwarf.fileoff = cpos();
......@@ -659,18 +659,17 @@ asmb(void)
Bflush(&bso);
switch(HEADTYPE) {
default:
if(iself)
goto ElfSym;
if(iself) {
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
}
break;
case Hplan9:
symo = segdata.fileoff+segdata.filelen;
break;
case Hdarwin:
symo = rnd(HEADR+segtext.filelen, INITRND)+rnd(segdata.filelen, INITRND)+machlink;
break;
ElfSym:
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
break;
}
cseek(symo);
switch(HEADTYPE) {
......@@ -721,7 +720,7 @@ asmb(void)
thearch.lput(0x647); /* magic */
thearch.lput(segtext.filelen); /* sizes */
thearch.lput(segdata.filelen);
thearch.lput(segdata.len - segdata.filelen);
thearch.lput(segdata.length - segdata.filelen);
thearch.lput(symsize); /* nsyms */
thearch.lput(entryvalue()); /* va of entry */
thearch.lput(0L);
......@@ -742,9 +741,9 @@ asmb(void)
if(debug['c']){
print("textsize=%ulld\n", segtext.filelen);
print("datsize=%ulld\n", segdata.filelen);
print("bsssize=%ulld\n", segdata.len - segdata.filelen);
print("bsssize=%ulld\n", segdata.length - segdata.filelen);
print("symsize=%d\n", symsize);
print("lcsize=%d\n", lcsize);
print("total=%lld\n", segtext.filelen+segdata.len+symsize+lcsize);
print("total=%lld\n", segtext.filelen+segdata.length+symsize+lcsize);
}
}
......@@ -37,7 +37,11 @@
#include "../ld/macho.h"
#include "../ld/pe.h"
#define PADDR(a) ((uint32)(a) & ~0x80000000)
uint32
PADDR(uint32 x)
{
return x & ~0x80000000;
}
char zeroes[32];
......@@ -333,9 +337,9 @@ machoreloc1(Reloc *r, vlong sectoff)
v = rs->dynid;
v |= 1<<27; // external relocation
} else {
v = rs->sect->extnum;
v = ((Section*)rs->sect)->extnum;
if(v == 0) {
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, rs->sect->name, rs->type);
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, ((Section*)rs->sect)->name, rs->type);
return -1;
}
}
......@@ -615,10 +619,10 @@ asmb(void)
sect = segtext.sect;
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
codeblk(sect->vaddr, sect->len);
codeblk(sect->vaddr, sect->length);
for(sect = sect->next; sect != nil; sect = sect->next) {
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
datblk(sect->vaddr, sect->len);
datblk(sect->vaddr, sect->length);
}
if(segrodata.filelen > 0) {
......@@ -642,7 +646,7 @@ asmb(void)
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
dwarfoff = rnd(HEADR+segtext.length, INITRND) + rnd(segdata.filelen, INITRND);
cseek(dwarfoff);
segdwarf.fileoff = cpos();
......@@ -763,7 +767,7 @@ asmb(void)
lputb(magic); /* magic */
lputb(segtext.filelen); /* sizes */
lputb(segdata.filelen);
lputb(segdata.len - segdata.filelen);
lputb(segdata.length - segdata.filelen);
lputb(symsize); /* nsyms */
vl = entryvalue();
lputb(PADDR(vl)); /* va of entry */
......
......@@ -296,9 +296,9 @@ machoreloc1(Reloc *r, vlong sectoff)
v = rs->dynid;
v |= 1<<27; // external relocation
} else {
v = rs->sect->extnum;
v = ((Section*)rs->sect)->extnum;
if(v == 0) {
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, rs->sect->name, rs->type);
diag("reloc %d to symbol %s in non-macho section %s type=%d", r->type, rs->name, ((Section*)rs->sect)->name, rs->type);
return -1;
}
}
......@@ -565,10 +565,10 @@ asmb(void)
sect = segtext.sect;
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
codeblk(sect->vaddr, sect->len);
codeblk(sect->vaddr, sect->length);
for(sect = sect->next; sect != nil; sect = sect->next) {
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
datblk(sect->vaddr, sect->len);
datblk(sect->vaddr, sect->length);
}
if(segrodata.filelen > 0) {
......@@ -592,7 +592,7 @@ asmb(void)
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
dwarfoff = rnd(HEADR+segtext.len, INITRND) + rnd(segdata.filelen, INITRND);
dwarfoff = rnd(HEADR+segtext.length, INITRND) + rnd(segdata.filelen, INITRND);
cseek(dwarfoff);
segdwarf.fileoff = cpos();
......@@ -613,18 +613,17 @@ asmb(void)
Bflush(&bso);
switch(HEADTYPE) {
default:
if(iself)
goto Elfsym;
if(iself) {
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
}
break;
case Hplan9:
symo = segdata.fileoff+segdata.filelen;
break;
case Hdarwin:
symo = segdata.fileoff+rnd(segdata.filelen, INITRND)+machlink;
break;
Elfsym:
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
break;
case Hwindows:
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, PEFILEALIGN);
......@@ -683,7 +682,7 @@ asmb(void)
lputb(magic); /* magic */
lputb(segtext.filelen); /* sizes */
lputb(segdata.filelen);
lputb(segdata.len - segdata.filelen);
lputb(segdata.length - segdata.filelen);
lputb(symsize); /* nsyms */
lputb(entryvalue()); /* va of entry */
lputb(spsize); /* sp offsets */
......
......@@ -701,10 +701,10 @@ asmb(void)
sect = segtext.sect;
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
codeblk(sect->vaddr, sect->len);
codeblk(sect->vaddr, sect->length);
for(sect = sect->next; sect != nil; sect = sect->next) {
cseek(sect->vaddr - segtext.vaddr + segtext.fileoff);
datblk(sect->vaddr, sect->len);
datblk(sect->vaddr, sect->length);
}
if(segrodata.filelen > 0) {
......@@ -734,14 +734,13 @@ asmb(void)
Bflush(&bso);
switch(HEADTYPE) {
default:
if(iself)
goto ElfSym;
case Hplan9:
symo = segdata.fileoff+segdata.filelen;
if(iself) {
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
}
break;
ElfSym:
case Hplan9:
symo = segdata.fileoff+segdata.filelen;
symo = rnd(symo, INITRND);
break;
}
cseek(symo);
......@@ -789,7 +788,7 @@ asmb(void)
thearch.lput(0x647); /* magic */
thearch.lput(segtext.filelen); /* sizes */
thearch.lput(segdata.filelen);
thearch.lput(segdata.len - segdata.filelen);
thearch.lput(segdata.length - segdata.filelen);
thearch.lput(symsize); /* nsyms */
thearch.lput(entryvalue()); /* va of entry */
thearch.lput(0L);
......@@ -807,9 +806,9 @@ asmb(void)
if(debug['c']){
print("textsize=%ulld\n", segtext.filelen);
print("datsize=%ulld\n", segdata.filelen);
print("bsssize=%ulld\n", segdata.len - segdata.filelen);
print("bsssize=%ulld\n", segdata.length - segdata.filelen);
print("symsize=%d\n", symsize);
print("lcsize=%d\n", lcsize);
print("total=%lld\n", segtext.filelen+segdata.len+symsize+lcsize);
print("total=%lld\n", segtext.filelen+segdata.length+symsize+lcsize);
}
}
This diff is collapsed.
......@@ -167,7 +167,7 @@ decodetype_funcdotdotdot(LSym *s)
return s->p[commonsize()];
}
// Type.FuncType.in.len
// Type.FuncType.in.length
int
decodetype_funcincount(LSym *s)
{
......@@ -202,7 +202,7 @@ decodetype_funcouttype(LSym *s, int i)
return decode_reloc_sym(r->sym, r->add + i * thearch.ptrsize);
}
// Type.StructType.fields.Slice::len
// Type.StructType.fields.Slice::length
int
decodetype_structfieldcount(LSym *s)
{
......@@ -243,7 +243,7 @@ decodetype_structfieldoffs(LSym *s, int i)
return decode_inuxi(s->p + commonsize() + thearch.ptrsize + 2*thearch.intsize + i*structfieldsize() + 4*thearch.ptrsize, thearch.intsize);
}
// InterfaceTYpe.methods.len
// InterfaceTYpe.methods.length
vlong
decodetype_ifacemethodcount(LSym *s)
{
......
This diff is collapsed.
......@@ -22,3 +22,4 @@ void dwarfaddshstrings(LSym *shstrtab);
void dwarfaddelfheaders(void);
void dwarfaddmachoheaders(void);
void dwarfaddpeheaders(void);
void dwarfaddelfsectionsyms(void);
This diff is collapsed.
This diff is collapsed.
......@@ -74,27 +74,27 @@ static int parsemethod(char**, char*, char**);
static int parsepkgdata(char*, char*, char**, char*, char**, char**, char**);
void
ldpkg(Biobuf *f, char *pkg, int64 len, char *filename, int whence)
ldpkg(Biobuf *f, char *pkg, int64 length, char *filename, int whence)
{
char *data, *p0, *p1, *name;
if(debug['g'])
return;
if((int)len != len) {
if((int)length != length) {
fprint(2, "%s: too much pkg data in %s\n", argv0, filename);
if(debug['u'])
errorexit();
return;
}
data = mal(len+1);
if(Bread(f, data, len) != len) {
data = mal(length+1);
if(Bread(f, data, length) != length) {
fprint(2, "%s: short pkg read %s\n", argv0, filename);
if(debug['u'])
errorexit();
return;
}
data[len] = '\0';
data[length] = '\x00';
// first \n$$ marks beginning of exports - skip rest of line
p0 = strstr(data, "\n$$");
......@@ -106,7 +106,7 @@ ldpkg(Biobuf *f, char *pkg, int64 len, char *filename, int whence)
return;
}
p0 += 3;
while(*p0 != '\n' && *p0 != '\0')
while(*p0 != '\n' && *p0 != '\x00')
p0++;
// second marks end of exports / beginning of local data
......@@ -140,11 +140,11 @@ ldpkg(Biobuf *f, char *pkg, int64 len, char *filename, int whence)
}
if(p0 < p1) {
if(*p0 == '\n')
*p0++ = '\0';
*p0++ = '\x00';
else {
*p0++ = '\0';
while(p0 < p1 && *p0++ != '\n')
;
*p0++ = '\x00';
while(p0 < p1 && *p0 != '\n')
p0++;
}
}
if(strcmp(pkg, "main") == 0 && strcmp(name, "main") != 0) {
......@@ -183,14 +183,14 @@ ldpkg(Biobuf *f, char *pkg, int64 len, char *filename, int whence)
}
static void
loadpkgdata(char *file, char *pkg, char *data, int len)
loadpkgdata(char *file, char *pkg, char *data, int length)
{
char *p, *ep, *prefix, *name, *def;
Import *x;
file = estrdup(file);
p = data;
ep = data + len;
ep = data + length;
while(parsepkgdata(file, pkg, &p, ep, &prefix, &name, &def) > 0) {
x = ilookup(name);
if(x->prefix == nil) {
......@@ -253,7 +253,7 @@ loop:
nerrors++;
return -1;
}
*p++ = '\0';
*p++ = '\x00';
imported(pkg, name);
goto loop;
}
......@@ -262,7 +262,7 @@ loop:
nerrors++;
return -1;
}
p[-1] = '\0';
p[-1] = '\x00';
// name: a.b followed by space
name = p;
......@@ -281,7 +281,7 @@ loop:
if(p >= ep)
return -1;
*p++ = '\0';
*p++ = '\x00';
// def: free form to new line
def = p;
......@@ -290,11 +290,11 @@ loop:
if(p >= ep)
return -1;
edef = p;
*p++ = '\0';
*p++ = '\x00';
// include methods on successive lines in def of named type
while(parsemethod(&p, ep, &meth) > 0) {
*edef++ = '\n'; // overwrites '\0'
*edef++ = '\n'; // overwrites '\x00'
if(edef+1 > meth) {
// We want to indent methods with a single \t.
// 6g puts at least one char of indent before all method defs,
......@@ -355,7 +355,7 @@ useline:
*pp = ep;
return -1;
}
*p++ = '\0';
*p++ = '\x00';
*pp = p;
return 1;
}
......@@ -376,7 +376,7 @@ loadcgo(char *file, char *pkg, char *p, int n)
if(next == nil)
next = "";
else
*next++ = '\0';
*next++ = '\x00';
free(p0);
p0 = estrdup(p); // save for error message
......@@ -411,7 +411,7 @@ loadcgo(char *file, char *pkg, char *p, int n)
local = expandpkg(local, pkg);
q = strchr(remote, '#');
if(q)
*q++ = '\0';
*q++ = '\x00';
s = linklookup(ctxt, local, 0);
if(local != f[1])
free(local);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -96,14 +96,12 @@ struct Segment
{
uchar rwx; // permission as usual unix bits (5 = r-x etc)
uvlong vaddr; // virtual address
uvlong len; // length in memory
uvlong length; // length in memory
uvlong fileoff; // file offset
uvlong filelen; // length on disk
Section* sect;
};
#pragma incomplete struct Elf64_Shdr
struct Section
{
uchar rwx;
......@@ -111,10 +109,10 @@ struct Section
int32 align;
char *name;
uvlong vaddr;
uvlong len;
uvlong length;
Section *next; // in segment list
Segment *seg;
struct Elf64_Shdr *elfsect;
void *elfsect;
uvlong reloff;
uvlong rellen;
};
......@@ -191,14 +189,7 @@ enum {
Pkgdef
};
typedef struct Header Header;
struct Header {
char *name;
int val;
};
EXTERN char* headstring;
extern Header headers[];
#pragma varargck type "Y" LSym*
#pragma varargck type "Z" char*
......@@ -208,19 +199,8 @@ extern Header headers[];
EXTERN Biobuf bso;
EXTERN struct
{
char cbuf[MAXIO]; /* output buffer */
} buf;
EXTERN int cbc;
EXTERN char* cbp;
EXTERN char* cbpmax;
#define cput(c)\
{ *cbp++ = c;\
if(--cbc <= 0)\
cflush(); }
EXTERN Biobuf coutbuf;
void cput(uint8);
void Lflag(char *arg);
int Yconv(Fmt *fp);
......@@ -289,17 +269,19 @@ void hostobjs(void);
int iconv(Fmt *fp);
void importcycles(void);
void linkarchinit(void);
void ldelf(Biobuf *f, char *pkg, int64 len, char *pn);
void ldhostobj(void (*ld)(Biobuf*, char*, int64, char*), Biobuf *f, char *pkg, int64 len, char *pn, char *file);
void ldmacho(Biobuf *f, char *pkg, int64 len, char *pn);
void ldobj(Biobuf *f, char *pkg, int64 len, char *pn, char *file, int whence);
void ldpe(Biobuf *f, char *pkg, int64 len, char *pn);
void ldpkg(Biobuf *f, char *pkg, int64 len, char *filename, int whence);
void ldelf(Biobuf *f, char *pkg, int64 length, char *pn);
void ldhostobj(void (*ld)(Biobuf*, char*, int64, char*), Biobuf *f, char *pkg, int64 length, char *pn, char *file);
void ldmacho(Biobuf *f, char *pkg, int64 length, char *pn);
void ldobj(Biobuf *f, char *pkg, int64 length, char *pn, char *file, int whence);
void ldpe(Biobuf *f, char *pkg, int64 length, char *pn);
void ldpkg(Biobuf *f, char *pkg, int64 length, char *filename, int whence);
uint16 le16(uchar *b);
uint32 le32(uchar *b);
uint64 le64(uchar *b);
void libinit(void);
LSym* listsort(LSym *l, int (*cmp)(LSym*, LSym*), int off);
LSym* listsort(LSym *l, int (*cmp)(LSym*, LSym*), LSym** (*nextp)(LSym*));
LSym** listnextp(LSym*);
LSym** listsubp(LSym*);
void loadinternal(char *name);
void loadlib(void);
void lputb(uint32 l);
......@@ -307,7 +289,6 @@ void lputl(uint32 l);
void* mal(uint32 n);
void mark(LSym *s);
void mywhatsys(void);
struct ar_hdr;
void objfile(char *file, char *pkg);
void patch(void);
int pathchar(void);
......@@ -345,4 +326,3 @@ void ldmain(int, char**);
#pragma varargck argpos diag 1
#define SYMDEF "__.GOSYMDEF"
This diff is collapsed.
......@@ -53,14 +53,15 @@ int machowrite(void);
void machoinit(void);
void machosymorder(void);
void machoemitreloc(void);
int machoreloc1(Reloc*, vlong);
/*
* Total amount of space to reserve at the start of the file
* for Header, PHeaders, and SHeaders.
* May waste some.
*/
#define INITIAL_MACHO_HEADR 4*1024
enum {
INITIAL_MACHO_HEADR = 4*1024,
};
enum {
MACHO_CPU_AMD64 = (1<<24)|7,
......
This diff is collapsed.
This diff is collapsed.
......@@ -153,9 +153,6 @@ ldmain(int argc, char **argv)
HEADTYPE, INITTEXT, INITDAT, INITRND);
Bflush(&bso);
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
addlibpath(ctxt, "command line", "command line", argv[0], "main");
loadlib();
......
This diff is collapsed.
......@@ -111,13 +111,11 @@ static char *rdstring(Biobuf*);
static void rddata(Biobuf*, uchar**, int*);
static LSym *rdsym(Link*, Biobuf*, char*);
extern char *outfile;
static char startmagic[] = "\x00\x00go13ld";
static char endmagic[] = "\xff\xffgo13ld";
void
ldobjfile(Link *ctxt, Biobuf *f, char *pkg, int64 len, char *pn)
ldobjfile(Link *ctxt, Biobuf *f, char *pkg, int64 length, char *pn)
{
int c;
uchar buf[8];
......@@ -153,8 +151,8 @@ ldobjfile(Link *ctxt, Biobuf *f, char *pkg, int64 len, char *pn)
if(memcmp(buf, endmagic, sizeof buf) != 0)
sysfatal("%s: invalid file end", pn);
if(Boffset(f) != start+len)
sysfatal("%s: unexpected end at %lld, want %lld", pn, (vlong)Boffset(f), (vlong)(start+len));
if(Boffset(f) != start+length)
sysfatal("%s: unexpected end at %lld, want %lld", pn, (vlong)Boffset(f), (vlong)(start+length));
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment