typedef struct Segment Segment;
typedef struct Section Section;
struct Segment
{
uchar rwx;
uvlong vaddr;
uvlong len;
uvlong fileoff;
uvlong filelen;
Section* sect;
};
#pragma incomplete struct Elf64_Shdr
struct Section
{
uchar rwx;
int16 extnum;
int32 align;
char *name;
uvlong vaddr;
uvlong len;
Section *next;
Segment *seg;
struct Elf64_Shdr *elfsect;
uvlong reloff;
uvlong rellen;
};
extern char symname[];
EXTERN char* INITENTRY;
extern char* thestring;
extern LinkArch* thelinkarch;
EXTERN char* outfile;
EXTERN int ndynexp;
EXTERN LSym** dynexp;
EXTERN int nldflag;
EXTERN char** ldflag;
EXTERN int havedynamic;
EXTERN int funcalign;
EXTERN int iscgo;
EXTERN int elfglobalsymndx;
EXTERN char* flag_installsuffix;
EXTERN int flag_race;
EXTERN int flag_shared;
EXTERN char* tracksym;
EXTERN char* interpreter;
EXTERN char* tmpdir;
EXTERN char* extld;
EXTERN char* extldflags;
EXTERN int debug_s;
EXTERN Link* ctxt;
EXTERN int32 HEADR;
EXTERN int32 HEADTYPE;
EXTERN int32 INITRND;
EXTERN int64 INITTEXT;
EXTERN int64 INITDAT;
EXTERN char* INITENTRY;
EXTERN char* noname;
EXTERN char* paramspace;
EXTERN int nerrors;
EXTERN int linkmode;
EXTERN int64 liveness;
enum
{
CgoExportDynamic = 1<<0,
CgoExportStatic = 1<<1,
};
EXTERN Segment segtext;
EXTERN Segment segrodata;
EXTERN Segment segdata;
EXTERN Segment segdwarf;
typedef struct Endian Endian;
struct Endian
{
uint16 (*e16)(uchar*);
uint32 (*e32)(uchar*);
uint64 (*e64)(uchar*);
};
extern Endian be, le;
extern char* goroot;
extern char* goarch;
extern char* goos;
enum {
FileObj = 0,
ArchiveObj,
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*
#pragma varargck type "i" char*
EXTERN Biobuf bso;
EXTERN struct
{
char cbuf[MAXIO];
} buf;
EXTERN int cbc;
EXTERN char* cbp;
EXTERN char* cbpmax;
#define cput(c)\
{ *cbp++ = c;\
if(--cbc <= 0)\
cflush(); }
void Lflag(char *arg);
int Yconv(Fmt *fp);
int Zconv(Fmt *fp);
void addexport(void);
void address(void);
Section*addsection(Segment *seg, char *name, int rwx);
void addstrdata(char *name, char *value);
vlong addstring(LSym *s, char *str);
void asmelfsym(void);
void asmplan9sym(void);
uint16 be16(uchar *b);
uint32 be32(uchar *b);
uint64 be64(uchar *b);
void callgraph(void);
void cflush(void);
void codeblk(int32 addr, int32 size);
vlong cpos(void);
void cseek(vlong p);
void cwrite(void *buf, int n);
void datblk(int32 addr, int32 size);
int datcmp(LSym *s1, LSym *s2);
vlong datoff(vlong addr);
void deadcode(void);
LSym* decodetype_arrayelem(LSym *s);
vlong decodetype_arraylen(LSym *s);
LSym* decodetype_chanelem(LSym *s);
int decodetype_funcdotdotdot(LSym *s);
int decodetype_funcincount(LSym *s);
LSym* decodetype_funcintype(LSym *s, int i);
int decodetype_funcoutcount(LSym *s);
LSym* decodetype_funcouttype(LSym *s, int i);
LSym* decodetype_gc(LSym *s);
vlong decodetype_ifacemethodcount(LSym *s);
uint8 decodetype_kind(LSym *s);
LSym* decodetype_mapkey(LSym *s);
LSym* decodetype_mapvalue(LSym *s);
LSym* decodetype_ptrelem(LSym *s);
vlong decodetype_size(LSym *s);
int decodetype_structfieldcount(LSym *s);
char* decodetype_structfieldname(LSym *s, int i);
vlong decodetype_structfieldoffs(LSym *s, int i);
LSym* decodetype_structfieldtype(LSym *s, int i);
void dodata(void);
void dostkcheck(void);
void dostkoff(void);
void dosymtype(void);
void doversion(void);
void doweak(void);
void dynreloc(void);
void dynrelocsym(LSym *s);
vlong entryvalue(void);
void errorexit(void);
void follow(void);
void genasmsym(void (*put)(LSym*, char*, int, vlong, vlong, int, LSym*));
void growdatsize(vlong *datsizep, LSym *s);
char* headstr(int v);
int headtype(char *name);
void hostlink(void);
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);
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);
void loadinternal(char *name);
void loadlib(void);
void lputb(int32 l);
void lputl(int32 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);
void pcln(void);
void pclntab(void);
void putelfsectionsym(LSym* s, int shndx);
void putelfsymshndx(vlong sympos, int shndx);
void putsymb(LSym *s, char *name, int t, vlong v, vlong size, int ver, LSym *typ);
int rbyoff(const void *va, const void *vb);
void reloc(void);
void relocsym(LSym *s);
void setheadtype(char *s);
void setinterp(char *s);
void setlinkmode(char *arg);
void span(void);
void strnput(char *s, int n);
vlong symaddr(LSym *s);
void symtab(void);
void textaddress(void);
void undef(void);
void unmal(void *v, uint32 n);
void usage(void);
void vputb(uint64 v);
int valuecmp(LSym *a, LSym *b);
void vputl(uint64 v);
void wputb(ushort w);
void wputl(ushort w);
void xdefine(char *p, int t, vlong v);
void zerosig(char *sp);
void archinit(void);
void diag(char *fmt, ...);
#pragma varargck argpos diag 1