2009-03-13 16:03:07 -06:00
|
|
|
// Inferno utils/5l/l.h
|
|
|
|
// http://code.google.com/p/inferno-os/source/browse/utils/5l/l.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.
|
|
|
|
|
2009-08-17 16:14:59 -06:00
|
|
|
#include <u.h>
|
|
|
|
#include <libc.h>
|
2009-03-13 16:03:07 -06:00
|
|
|
#include <bio.h>
|
2009-03-25 17:31:38 -06:00
|
|
|
#include "../5l/5.out.h"
|
2009-03-13 16:03:07 -06:00
|
|
|
|
2009-10-07 01:11:59 -06:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PtrSize = 4
|
|
|
|
};
|
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
#ifndef EXTERN
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* do not undefine this - code will be removed eventually */
|
|
|
|
#define CALLEEBX
|
|
|
|
|
2010-10-19 11:08:17 -06:00
|
|
|
#define dynptrsize 0
|
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
typedef struct Adr Adr;
|
|
|
|
typedef struct Sym Sym;
|
|
|
|
typedef struct Autom Auto;
|
|
|
|
typedef struct Prog Prog;
|
2010-10-14 21:48:40 -06:00
|
|
|
typedef struct Reloc Reloc;
|
2009-03-13 16:03:07 -06:00
|
|
|
typedef struct Optab Optab;
|
|
|
|
typedef struct Oprang Oprang;
|
|
|
|
typedef uchar Opcross[32][2][32];
|
|
|
|
typedef struct Count Count;
|
|
|
|
|
|
|
|
#define P ((Prog*)0)
|
|
|
|
#define S ((Sym*)0)
|
2010-10-13 13:51:21 -06:00
|
|
|
#define TNAME (cursym?cursym->name:noname)
|
2009-03-13 16:03:07 -06:00
|
|
|
|
|
|
|
struct Adr
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 u0offset;
|
2009-03-13 16:03:07 -06:00
|
|
|
char* u0sval;
|
2010-10-14 21:48:40 -06:00
|
|
|
Ieee u0ieee;
|
2009-06-09 21:51:53 -06:00
|
|
|
char* u0sbig;
|
2009-03-13 16:03:07 -06:00
|
|
|
} u0;
|
2010-10-13 13:51:21 -06:00
|
|
|
Sym* sym;
|
2009-03-13 16:03:07 -06:00
|
|
|
char type;
|
2009-06-09 21:51:53 -06:00
|
|
|
uchar index; // not used on arm, required by ld/go.c
|
2009-03-13 16:03:07 -06:00
|
|
|
char reg;
|
|
|
|
char name;
|
2009-06-16 12:25:58 -06:00
|
|
|
int32 offset2; // argsize
|
2009-03-13 16:03:07 -06:00
|
|
|
char class;
|
2009-08-17 16:14:59 -06:00
|
|
|
Sym* gotype;
|
2009-03-13 16:03:07 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#define offset u0.u0offset
|
|
|
|
#define sval u0.u0sval
|
2010-10-14 21:48:40 -06:00
|
|
|
#define scon sval
|
2009-03-13 16:03:07 -06:00
|
|
|
#define ieee u0.u0ieee
|
2009-06-09 21:51:53 -06:00
|
|
|
#define sbig u0.u0sbig
|
2009-03-13 16:03:07 -06:00
|
|
|
|
2010-10-14 21:48:40 -06:00
|
|
|
struct Reloc
|
|
|
|
{
|
|
|
|
int32 off;
|
|
|
|
uchar siz;
|
2010-12-08 13:37:51 -07:00
|
|
|
int16 type;
|
2010-10-14 21:48:40 -06:00
|
|
|
int32 add;
|
|
|
|
Sym* sym;
|
|
|
|
};
|
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
struct Prog
|
|
|
|
{
|
|
|
|
Adr from;
|
|
|
|
Adr to;
|
|
|
|
union
|
|
|
|
{
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 u0regused;
|
2009-03-13 16:03:07 -06:00
|
|
|
Prog* u0forwd;
|
|
|
|
} u0;
|
|
|
|
Prog* cond;
|
|
|
|
Prog* link;
|
2009-06-09 21:51:53 -06:00
|
|
|
Prog* dlink;
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 pc;
|
|
|
|
int32 line;
|
2009-03-13 16:03:07 -06:00
|
|
|
uchar mark;
|
|
|
|
uchar optab;
|
|
|
|
uchar as;
|
|
|
|
uchar scond;
|
|
|
|
uchar reg;
|
|
|
|
uchar align;
|
|
|
|
};
|
2010-10-14 21:48:40 -06:00
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
#define regused u0.u0regused
|
|
|
|
#define forwd u0.u0forwd
|
2010-10-14 21:48:40 -06:00
|
|
|
#define datasize reg
|
2010-12-08 13:37:51 -07:00
|
|
|
#define textflag reg
|
2009-03-13 16:03:07 -06:00
|
|
|
|
|
|
|
struct Sym
|
|
|
|
{
|
2010-10-13 13:51:21 -06:00
|
|
|
char* name;
|
2009-03-13 16:03:07 -06:00
|
|
|
short type;
|
|
|
|
short version;
|
2009-10-08 23:16:08 -06:00
|
|
|
uchar dupok;
|
2009-06-09 21:51:53 -06:00
|
|
|
uchar reachable;
|
2010-03-23 07:46:30 -06:00
|
|
|
uchar dynexport;
|
2010-10-14 21:48:40 -06:00
|
|
|
uchar leaf;
|
2010-12-08 13:37:51 -07:00
|
|
|
int32 dynid;
|
|
|
|
int32 plt;
|
|
|
|
int32 got;
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 value;
|
|
|
|
int32 sig;
|
2010-02-10 16:01:02 -07:00
|
|
|
int32 size;
|
2010-10-19 16:07:19 -06:00
|
|
|
uchar special;
|
2009-03-13 16:03:07 -06:00
|
|
|
uchar thumb; // thumb code
|
|
|
|
uchar foreign; // called by arm if thumb, by thumb if arm
|
|
|
|
uchar fnptr; // used as fn ptr
|
2010-10-13 13:51:21 -06:00
|
|
|
Sym* hash; // in hash table
|
|
|
|
Sym* next; // in text or data list
|
2010-12-08 13:37:51 -07:00
|
|
|
Sym* sub; // in SSUB list
|
|
|
|
Sym* outer; // container of sub
|
2009-08-17 16:14:59 -06:00
|
|
|
Sym* gotype;
|
2009-10-07 01:11:59 -06:00
|
|
|
char* file;
|
2010-03-22 20:58:55 -06:00
|
|
|
char* dynimpname;
|
|
|
|
char* dynimplib;
|
2010-10-13 13:51:21 -06:00
|
|
|
|
|
|
|
// STEXT
|
|
|
|
Auto* autom;
|
|
|
|
Prog* text;
|
|
|
|
|
|
|
|
// SDATA, SBSS
|
2010-10-14 21:48:40 -06:00
|
|
|
uchar* p;
|
|
|
|
int32 np;
|
|
|
|
int32 maxp;
|
|
|
|
Reloc* r;
|
|
|
|
int32 nr;
|
|
|
|
int32 maxr;
|
2009-03-13 16:03:07 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SIGNINTERN (1729*325*1729)
|
|
|
|
|
|
|
|
struct Autom
|
|
|
|
{
|
|
|
|
Sym* asym;
|
|
|
|
Auto* link;
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 aoffset;
|
2009-03-13 16:03:07 -06:00
|
|
|
short type;
|
2009-08-17 16:14:59 -06:00
|
|
|
Sym* gotype;
|
2009-03-13 16:03:07 -06:00
|
|
|
};
|
|
|
|
struct Optab
|
|
|
|
{
|
|
|
|
char as;
|
2009-06-24 12:44:06 -06:00
|
|
|
uchar a1;
|
2009-03-13 16:03:07 -06:00
|
|
|
char a2;
|
2009-06-24 12:44:06 -06:00
|
|
|
uchar a3;
|
|
|
|
uchar type;
|
2009-03-13 16:03:07 -06:00
|
|
|
char size;
|
|
|
|
char param;
|
|
|
|
char flag;
|
|
|
|
};
|
|
|
|
struct Oprang
|
|
|
|
{
|
|
|
|
Optab* start;
|
|
|
|
Optab* stop;
|
|
|
|
};
|
|
|
|
struct Count
|
|
|
|
{
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 count;
|
|
|
|
int32 outof;
|
2009-03-13 16:03:07 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2009-06-08 21:20:35 -06:00
|
|
|
Sxxx,
|
2010-10-14 21:48:40 -06:00
|
|
|
|
|
|
|
/* order here is order in output file */
|
2009-03-13 16:03:07 -06:00
|
|
|
STEXT = 1,
|
2010-10-14 21:48:40 -06:00
|
|
|
SRODATA,
|
|
|
|
SELFDATA,
|
2009-03-13 16:03:07 -06:00
|
|
|
SDATA,
|
|
|
|
SBSS,
|
2010-10-14 21:48:40 -06:00
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
SXREF,
|
|
|
|
SFILE,
|
|
|
|
SCONST,
|
2010-12-08 13:37:51 -07:00
|
|
|
SDYNIMPORT,
|
2009-03-13 16:03:07 -06:00
|
|
|
|
2010-10-22 13:27:50 -06:00
|
|
|
SSUB = 1<<8,
|
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
LFROM = 1<<0,
|
|
|
|
LTO = 1<<1,
|
|
|
|
LPOOL = 1<<2,
|
|
|
|
V4 = 1<<3, /* arm v4 arch */
|
|
|
|
|
|
|
|
C_NONE = 0,
|
|
|
|
C_REG,
|
|
|
|
C_REGREG,
|
|
|
|
C_SHIFT,
|
|
|
|
C_FREG,
|
|
|
|
C_PSR,
|
|
|
|
C_FCR,
|
|
|
|
|
|
|
|
C_RCON, /* 0xff rotated */
|
|
|
|
C_NCON, /* ~RCON */
|
|
|
|
C_SCON, /* 0xffff */
|
|
|
|
C_BCON, /* thumb */
|
|
|
|
C_LCON,
|
2010-11-03 18:31:07 -06:00
|
|
|
C_ZFCON,
|
|
|
|
C_SFCON,
|
|
|
|
C_LFCON,
|
2009-03-13 16:03:07 -06:00
|
|
|
C_GCON, /* thumb */
|
|
|
|
|
|
|
|
C_RACON,
|
|
|
|
C_SACON, /* thumb */
|
|
|
|
C_LACON,
|
|
|
|
C_GACON, /* thumb */
|
|
|
|
|
|
|
|
C_SBRA,
|
|
|
|
C_LBRA,
|
|
|
|
C_GBRA, /* thumb */
|
|
|
|
|
|
|
|
C_HAUTO, /* halfword insn offset (-0xff to 0xff) */
|
|
|
|
C_FAUTO, /* float insn offset (0 to 0x3fc, word aligned) */
|
|
|
|
C_HFAUTO, /* both H and F */
|
|
|
|
C_SAUTO, /* -0xfff to 0xfff */
|
|
|
|
C_LAUTO,
|
|
|
|
|
|
|
|
C_HOREG,
|
|
|
|
C_FOREG,
|
|
|
|
C_HFOREG,
|
|
|
|
C_SOREG,
|
|
|
|
C_ROREG,
|
|
|
|
C_SROREG, /* both S and R */
|
|
|
|
C_LOREG,
|
|
|
|
C_GOREG, /* thumb */
|
|
|
|
|
|
|
|
C_PC,
|
|
|
|
C_SP,
|
|
|
|
C_HREG,
|
|
|
|
C_OFFPC, /* thumb */
|
|
|
|
|
2010-10-19 11:08:17 -06:00
|
|
|
C_ADDR, /* reference to relocatable address */
|
2009-03-13 16:03:07 -06:00
|
|
|
|
|
|
|
C_GOK,
|
|
|
|
|
|
|
|
/* mark flags */
|
|
|
|
FOLL = 1<<0,
|
|
|
|
LABEL = 1<<1,
|
|
|
|
LEAF = 1<<2,
|
|
|
|
|
|
|
|
STRINGSZ = 200,
|
|
|
|
NHASH = 10007,
|
|
|
|
MINSIZ = 64,
|
|
|
|
NENT = 100,
|
|
|
|
MAXIO = 8192,
|
|
|
|
MAXHIST = 20, /* limit of path elements for history symbols */
|
2010-10-06 07:52:54 -06:00
|
|
|
MINLC = 4,
|
2009-03-13 16:03:07 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
EXTERN union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
uchar obuf[MAXIO]; /* output buffer */
|
|
|
|
uchar ibuf[MAXIO]; /* input buffer */
|
|
|
|
} u;
|
|
|
|
char dbuf[1];
|
|
|
|
} buf;
|
|
|
|
|
|
|
|
#define cbuf u.obuf
|
|
|
|
#define xbuf u.ibuf
|
|
|
|
|
|
|
|
#define setarch(p) if((p)->as==ATEXT) thumb=(p)->reg&ALLTHUMBS
|
|
|
|
#define setthumb(p) if((p)->as==ATEXT) seenthumb|=(p)->reg&ALLTHUMBS
|
|
|
|
|
|
|
|
#ifndef COFFCVT
|
|
|
|
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 HEADR; /* length of header */
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN int HEADTYPE; /* type of header */
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 INITDAT; /* data location */
|
|
|
|
EXTERN int32 INITRND; /* data round above text location */
|
|
|
|
EXTERN int32 INITTEXT; /* text location */
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN char* INITENTRY; /* entry point */
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 autosize;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN Biobuf bso;
|
|
|
|
EXTERN int cbc;
|
|
|
|
EXTERN uchar* cbp;
|
|
|
|
EXTERN int cout;
|
|
|
|
EXTERN Auto* curauto;
|
|
|
|
EXTERN Auto* curhist;
|
|
|
|
EXTERN Prog* curp;
|
2010-10-13 13:51:21 -06:00
|
|
|
EXTERN Sym* cursym;
|
2010-10-14 21:48:40 -06:00
|
|
|
EXTERN Sym* datap;
|
2010-04-27 23:40:26 -06:00
|
|
|
EXTERN int32 elfdatsize;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN char debug[128];
|
2010-10-13 13:51:21 -06:00
|
|
|
EXTERN Sym* etextp;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN char* noname;
|
|
|
|
EXTERN Prog* lastp;
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 lcsize;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN char literal[32];
|
|
|
|
EXTERN int nerrors;
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 instoffset;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN Opcross opcross[8];
|
|
|
|
EXTERN Oprang oprange[ALAST];
|
|
|
|
EXTERN Oprang thumboprange[ALAST];
|
|
|
|
EXTERN char* outfile;
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 pc;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN uchar repop[ALAST];
|
2011-02-01 13:49:56 -07:00
|
|
|
EXTERN char* interpreter;
|
2010-02-26 15:03:52 -07:00
|
|
|
EXTERN char* rpath;
|
2009-04-10 17:35:36 -06:00
|
|
|
EXTERN uint32 stroffset;
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 symsize;
|
2010-10-13 13:51:21 -06:00
|
|
|
EXTERN Sym* textp;
|
2009-03-25 17:31:38 -06:00
|
|
|
EXTERN int32 textsize;
|
2009-03-13 16:03:07 -06:00
|
|
|
EXTERN int version;
|
|
|
|
EXTERN char xcmp[C_GOK+1][C_GOK+1];
|
|
|
|
EXTERN Prog zprg;
|
|
|
|
EXTERN int dtype;
|
|
|
|
EXTERN int armv4;
|
|
|
|
EXTERN int thumb;
|
|
|
|
EXTERN int seenthumb;
|
|
|
|
EXTERN int armsize;
|
|
|
|
|
|
|
|
extern char* anames[];
|
|
|
|
extern Optab optab[];
|
|
|
|
extern Optab thumboptab[];
|
|
|
|
|
|
|
|
void addpool(Prog*, Adr*);
|
|
|
|
EXTERN Prog* blitrl;
|
|
|
|
EXTERN Prog* elitrl;
|
|
|
|
|
|
|
|
void initdiv(void);
|
|
|
|
EXTERN Prog* prog_div;
|
|
|
|
EXTERN Prog* prog_divu;
|
|
|
|
EXTERN Prog* prog_mod;
|
|
|
|
EXTERN Prog* prog_modu;
|
|
|
|
|
|
|
|
#pragma varargck type "A" int
|
|
|
|
#pragma varargck type "C" int
|
|
|
|
#pragma varargck type "D" Adr*
|
|
|
|
#pragma varargck type "N" Adr*
|
|
|
|
#pragma varargck type "P" Prog*
|
|
|
|
#pragma varargck type "S" char*
|
|
|
|
|
|
|
|
int Aconv(Fmt*);
|
|
|
|
int Cconv(Fmt*);
|
|
|
|
int Dconv(Fmt*);
|
2010-10-19 11:08:17 -06:00
|
|
|
int Iconv(Fmt*);
|
2009-03-13 16:03:07 -06:00
|
|
|
int Nconv(Fmt*);
|
2009-06-26 14:44:25 -06:00
|
|
|
int Oconv(Fmt*);
|
2009-03-13 16:03:07 -06:00
|
|
|
int Pconv(Fmt*);
|
|
|
|
int Sconv(Fmt*);
|
|
|
|
int aclass(Adr*);
|
|
|
|
int thumbaclass(Adr*, Prog*);
|
2009-03-25 17:31:38 -06:00
|
|
|
void addhist(int32, int);
|
2009-06-08 21:20:35 -06:00
|
|
|
Prog* appendp(Prog*);
|
2009-03-13 16:03:07 -06:00
|
|
|
void asmb(void);
|
|
|
|
void asmthumbmap(void);
|
2010-10-18 09:09:59 -06:00
|
|
|
void asmout(Prog*, Optab*, int32*);
|
2009-03-13 16:03:07 -06:00
|
|
|
void thumbasmout(Prog*, Optab*);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 atolwhex(char*);
|
2009-03-13 16:03:07 -06:00
|
|
|
Prog* brloop(Prog*);
|
|
|
|
void buildop(void);
|
|
|
|
void thumbbuildop(void);
|
|
|
|
void buildrep(int, int);
|
|
|
|
void cflush(void);
|
2010-11-03 18:31:07 -06:00
|
|
|
int chipzero(Ieee*);
|
2009-03-13 16:03:07 -06:00
|
|
|
int chipfloat(Ieee*);
|
|
|
|
int cmp(int, int);
|
|
|
|
int compound(Prog*);
|
|
|
|
double cputime(void);
|
|
|
|
void diag(char*, ...);
|
|
|
|
void divsig(void);
|
|
|
|
void dodata(void);
|
|
|
|
void doprof1(void);
|
|
|
|
void doprof2(void);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 entryvalue(void);
|
2009-03-13 16:03:07 -06:00
|
|
|
void exchange(Prog*);
|
|
|
|
void follow(void);
|
|
|
|
void hputl(int);
|
|
|
|
int isnop(Prog*);
|
|
|
|
void listinit(void);
|
|
|
|
Sym* lookup(char*, int);
|
|
|
|
void cput(int);
|
2009-03-25 17:31:38 -06:00
|
|
|
void hput(int32);
|
|
|
|
void lput(int32);
|
2011-02-07 15:34:21 -07:00
|
|
|
void lputb(int32);
|
2009-03-25 17:31:38 -06:00
|
|
|
void lputl(int32);
|
|
|
|
void* mysbrk(uint32);
|
2009-03-13 16:03:07 -06:00
|
|
|
void names(void);
|
|
|
|
void nocache(Prog*);
|
|
|
|
int ocmp(const void*, const void*);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 opirr(int);
|
2009-03-13 16:03:07 -06:00
|
|
|
Optab* oplook(Prog*);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 oprrr(int, int);
|
|
|
|
int32 olr(int32, int, int, int);
|
|
|
|
int32 olhr(int32, int, int, int);
|
|
|
|
int32 olrr(int, int, int, int);
|
|
|
|
int32 olhrr(int, int, int, int);
|
|
|
|
int32 osr(int, int, int32, int, int);
|
|
|
|
int32 oshr(int, int32, int, int);
|
|
|
|
int32 ofsr(int, int, int32, int, int, Prog*);
|
|
|
|
int32 osrr(int, int, int, int);
|
|
|
|
int32 oshrr(int, int, int, int);
|
|
|
|
int32 omvl(Prog*, Adr*, int);
|
2009-03-13 16:03:07 -06:00
|
|
|
void patch(void);
|
|
|
|
void prasm(Prog*);
|
|
|
|
void prepend(Prog*, Prog*);
|
|
|
|
Prog* prg(void);
|
|
|
|
int pseudo(Prog*);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 regoff(Adr*);
|
2009-03-13 16:03:07 -06:00
|
|
|
int relinv(int);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 rnd(int32, int32);
|
2009-12-17 17:08:42 -07:00
|
|
|
void softfloat(void);
|
2009-03-13 16:03:07 -06:00
|
|
|
void span(void);
|
|
|
|
void strnput(char*, int);
|
2010-10-14 21:48:40 -06:00
|
|
|
int32 symaddr(Sym*);
|
2009-03-13 16:03:07 -06:00
|
|
|
void undef(void);
|
2009-03-25 17:31:38 -06:00
|
|
|
void wput(int32);
|
2009-04-10 17:35:36 -06:00
|
|
|
void wputl(ushort w);
|
2009-03-25 17:31:38 -06:00
|
|
|
void xdefine(char*, int, int32);
|
2009-03-13 16:03:07 -06:00
|
|
|
void noops(void);
|
2009-03-25 17:31:38 -06:00
|
|
|
int32 immrot(uint32);
|
|
|
|
int32 immaddr(int32);
|
|
|
|
int32 opbra(int, int);
|
2009-03-13 16:03:07 -06:00
|
|
|
int brextra(Prog*);
|
|
|
|
int isbranch(Prog*);
|
|
|
|
int fnpinc(Sym *);
|
|
|
|
int fninc(Sym *);
|
|
|
|
void thumbcount(void);
|
|
|
|
void fnptrs(void);
|
2010-02-10 16:01:02 -07:00
|
|
|
void doelf(void);
|
|
|
|
|
|
|
|
vlong addaddr(Sym *s, Sym *t);
|
|
|
|
vlong addsize(Sym *s, Sym *t);
|
|
|
|
vlong addstring(Sym *s, char *str);
|
|
|
|
vlong adduint16(Sym *s, uint16 v);
|
|
|
|
vlong adduint32(Sym *s, uint32 v);
|
|
|
|
vlong adduint64(Sym *s, uint64 v);
|
|
|
|
vlong adduint8(Sym *s, uint8 v);
|
|
|
|
vlong adduintxx(Sym *s, uint64 v, int wid);
|
|
|
|
|
|
|
|
/* Native is little-endian */
|
|
|
|
#define LPUT(a) lputl(a)
|
|
|
|
#define WPUT(a) wputl(a)
|
|
|
|
#define VPUT(a) abort()
|
2009-04-10 17:35:36 -06:00
|
|
|
|
2009-03-13 16:03:07 -06:00
|
|
|
#endif
|