mirror of
https://github.com/golang/go
synced 2024-11-23 04:40:09 -07:00
cmd/ld: portability fixes
fix code that implicitly assumes little-endian machines. R=golang-dev, bradfitz, rsc, alex.brainman CC=golang-dev https://golang.org/cl/6792043
This commit is contained in:
parent
a891b916bd
commit
d04ac4b0b7
@ -135,7 +135,8 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
int32 base;
|
int32 base;
|
||||||
int i, j, l, numaux;
|
uint32 l;
|
||||||
|
int i, j, numaux;
|
||||||
PeObj *obj;
|
PeObj *obj;
|
||||||
PeSect *sect, *rsect;
|
PeSect *sect, *rsect;
|
||||||
IMAGE_SECTION_HEADER sh;
|
IMAGE_SECTION_HEADER sh;
|
||||||
@ -170,11 +171,12 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
|||||||
// TODO return error if found .cormeta
|
// TODO return error if found .cormeta
|
||||||
}
|
}
|
||||||
// load string table
|
// load string table
|
||||||
Bseek(f, base+obj->fh.PointerToSymbolTable+18*obj->fh.NumberOfSymbols, 0);
|
Bseek(f, base+obj->fh.PointerToSymbolTable+sizeof(symbuf)*obj->fh.NumberOfSymbols, 0);
|
||||||
if(Bread(f, &l, sizeof l) != sizeof l)
|
if(Bread(f, symbuf, 4) != 4)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
l = le32(symbuf);
|
||||||
obj->snames = mal(l);
|
obj->snames = mal(l);
|
||||||
Bseek(f, base+obj->fh.PointerToSymbolTable+18*obj->fh.NumberOfSymbols, 0);
|
Bseek(f, base+obj->fh.PointerToSymbolTable+sizeof(symbuf)*obj->fh.NumberOfSymbols, 0);
|
||||||
if(Bread(f, obj->snames, l) != l)
|
if(Bread(f, obj->snames, l) != l)
|
||||||
goto bad;
|
goto bad;
|
||||||
// read symbols
|
// read symbols
|
||||||
|
Loading…
Reference in New Issue
Block a user