Commit 26438d4d authored by Russ Cox's avatar Russ Cox

liblink: delete unused code

Liblink is still needed for the linker (for a bit longer) but mostly not.
Delete the unused parts.

Change-Id: Ie63a7c1520dee52b17425b384943cd16262d36e3
Reviewed-on: https://go-review.googlesource.com/6110Reviewed-by: default avatarRob Pike <r@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent a5eda13d
This diff is collapsed.
// Inferno utils/5c/5.out.h
// http://code.google.com/p/inferno-os/source/browse/utils/5c/5.out.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
{
NSNAME = 8,
NSYM = 50,
NREG = 16,
};
#include "../ld/textflag.h"
/* -1 disables use of REGARG */
#define REGARG -1
/*c2go enum { REGARG = -1 }; */
enum
{
REG_R0 = 32, // must be 16-aligned
REG_R1,
REG_R2,
REG_R3,
REG_R4,
REG_R5,
REG_R6,
REG_R7,
REG_R8,
REG_R9,
REG_R10,
REG_R11,
REG_R12,
REG_R13,
REG_R14,
REG_R15,
REG_F0, // must be 16-aligned
REG_F1,
REG_F2,
REG_F3,
REG_F4,
REG_F5,
REG_F6,
REG_F7,
REG_F8,
REG_F9,
REG_F10,
REG_F11,
REG_F12,
REG_F13,
REG_F14,
REG_F15,
REG_FPSR, // must be 2-aligned
REG_FPCR,
REG_CPSR, // must be 2-aligned
REG_SPSR,
REGRET = REG_R0,
/* compiler allocates R1 up as temps */
/* compiler allocates register variables R3 up */
/* compiler allocates external registers R10 down */
REGEXT = REG_R10,
/* these two registers are declared in runtime.h */
REGG = REGEXT-0,
REGM = REGEXT-1,
REGCTXT = REG_R7,
REGTMP = REG_R11,
REGSP = REG_R13,
REGLINK = REG_R14,
REGPC = REG_R15,
NFREG = 16,
FREGRET = REG_F0,
FREGEXT = REG_F7,
FREGTMP = REG_F15,
};
/* compiler allocates register variables F0 up */
/* compiler allocates external registers F7 down */
enum
{
C_NONE,
C_REG,
C_REGREG,
C_REGREG2,
C_SHIFT,
C_FREG,
C_PSR,
C_FCR,
C_RCON, /* 0xff rotated */
C_NCON, /* ~RCON */
C_SCON, /* 0xffff */
C_LCON,
C_LCONADDR,
C_ZFCON,
C_SFCON,
C_LFCON,
C_RACON,
C_LACON,
C_SBRA,
C_LBRA,
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 nil and R */
C_LOREG,
C_PC,
C_SP,
C_HREG,
C_ADDR, /* reference to relocatable address */
C_TEXTSIZE,
C_GOK,
C_NCLASS, /* must be the last */
};
enum
{
AAND = A_ARCHSPECIFIC,
AEOR,
ASUB,
ARSB,
AADD,
AADC,
ASBC,
ARSC,
ATST,
ATEQ,
ACMP,
ACMN,
AORR,
ABIC,
AMVN,
/*
* Do not reorder or fragment the conditional branch
* opcodes, or the predication code will break
*/
ABEQ,
ABNE,
ABCS,
ABHS,
ABCC,
ABLO,
ABMI,
ABPL,
ABVS,
ABVC,
ABHI,
ABLS,
ABGE,
ABLT,
ABGT,
ABLE,
AMOVWD,
AMOVWF,
AMOVDW,
AMOVFW,
AMOVFD,
AMOVDF,
AMOVF,
AMOVD,
ACMPF,
ACMPD,
AADDF,
AADDD,
ASUBF,
ASUBD,
AMULF,
AMULD,
ADIVF,
ADIVD,
ASQRTF,
ASQRTD,
AABSF,
AABSD,
ASRL,
ASRA,
ASLL,
AMULU,
ADIVU,
AMUL,
ADIV,
AMOD,
AMODU,
AMOVB,
AMOVBS,
AMOVBU,
AMOVH,
AMOVHS,
AMOVHU,
AMOVW,
AMOVM,
ASWPBU,
ASWPW,
ARFE,
ASWI,
AMULA,
AWORD,
ABCASE,
ACASE,
AMULL,
AMULAL,
AMULLU,
AMULALU,
ABX,
ABXRET,
ADWORD,
ALDREX,
ASTREX,
ALDREXD,
ASTREXD,
APLD,
ACLZ,
AMULWT,
AMULWB,
AMULAWT,
AMULAWB,
ADATABUNDLE,
ADATABUNDLEEND,
AMRC, // MRC/MCR
ALAST,
// aliases
AB = AJMP,
ABL = ACALL,
};
/* scond byte */
enum
{
C_SCOND = (1<<4)-1,
C_SBIT = 1<<4,
C_PBIT = 1<<5,
C_WBIT = 1<<6,
C_FBIT = 1<<7, /* psr flags-only */
C_UBIT = 1<<7, /* up bit, unsigned bit */
// These constants are the ARM condition codes encodings,
// XORed with 14 so that C_SCOND_NONE has value 0,
// so that a zeroed Prog.scond means "always execute".
C_SCOND_XOR = 14,
C_SCOND_EQ = 0 ^ C_SCOND_XOR,
C_SCOND_NE = 1 ^ C_SCOND_XOR,
C_SCOND_HS = 2 ^ C_SCOND_XOR,
C_SCOND_LO = 3 ^ C_SCOND_XOR,
C_SCOND_MI = 4 ^ C_SCOND_XOR,
C_SCOND_PL = 5 ^ C_SCOND_XOR,
C_SCOND_VS = 6 ^ C_SCOND_XOR,
C_SCOND_VC = 7 ^ C_SCOND_XOR,
C_SCOND_HI = 8 ^ C_SCOND_XOR,
C_SCOND_LS = 9 ^ C_SCOND_XOR,
C_SCOND_GE = 10 ^ C_SCOND_XOR,
C_SCOND_LT = 11 ^ C_SCOND_XOR,
C_SCOND_GT = 12 ^ C_SCOND_XOR,
C_SCOND_LE = 13 ^ C_SCOND_XOR,
C_SCOND_NONE = 14 ^ C_SCOND_XOR,
C_SCOND_NV = 15 ^ C_SCOND_XOR,
/* D_SHIFT type */
SHIFT_LL = 0<<5,
SHIFT_LR = 1<<5,
SHIFT_AR = 2<<5,
SHIFT_RR = 3<<5,
};
/*
* this is the ranlib header
*/
#define SYMDEF "__.GOSYMDEF"
/*c2go extern char SYMDEF[]; */
...@@ -57,7 +57,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t); ...@@ -57,7 +57,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t);
void asmb(void); void asmb(void);
int elfreloc1(Reloc *r, vlong sectoff); int elfreloc1(Reloc *r, vlong sectoff);
void elfsetupplt(void); void elfsetupplt(void);
void listinit(void);
int machoreloc1(Reloc *r, vlong sectoff); int machoreloc1(Reloc *r, vlong sectoff);
/* Used by ../ld/dwarf.c */ /* Used by ../ld/dwarf.c */
......
// Inferno utils/5l/list.h
// http://code.google.com/p/inferno-os/source/browse/utils/5l/list.c
//
// 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.
// Printing.
#include "l.h"
#include "../ld/lib.h"
void
listinit(void)
{
listinit5();
}
...@@ -70,7 +70,6 @@ linkarchinit(void) ...@@ -70,7 +70,6 @@ linkarchinit(void)
thearch.elfreloc1 = elfreloc1; thearch.elfreloc1 = elfreloc1;
thearch.elfsetupplt = elfsetupplt; thearch.elfsetupplt = elfsetupplt;
thearch.gentext = gentext; thearch.gentext = gentext;
thearch.listinit = listinit;
thearch.machoreloc1 = machoreloc1; thearch.machoreloc1 = machoreloc1;
thearch.lput = lputl; thearch.lput = lputl;
thearch.wput = wputl; thearch.wput = wputl;
......
This diff is collapsed.
...@@ -58,7 +58,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t); ...@@ -58,7 +58,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t);
void asmb(void); void asmb(void);
int elfreloc1(Reloc *r, vlong sectoff); int elfreloc1(Reloc *r, vlong sectoff);
void elfsetupplt(void); void elfsetupplt(void);
void listinit(void);
int machoreloc1(Reloc *r, vlong sectoff); int machoreloc1(Reloc *r, vlong sectoff);
/* Used by ../ld/dwarf.c */ /* Used by ../ld/dwarf.c */
......
// Inferno utils/6l/list.c
// http://code.google.com/p/inferno-os/source/browse/utils/6l/list.c
//
// 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.
// Printing.
#include "l.h"
#include "../ld/lib.h"
void
listinit(void)
{
listinit6();
}
...@@ -72,7 +72,6 @@ linkarchinit(void) ...@@ -72,7 +72,6 @@ linkarchinit(void)
thearch.elfreloc1 = elfreloc1; thearch.elfreloc1 = elfreloc1;
thearch.elfsetupplt = elfsetupplt; thearch.elfsetupplt = elfsetupplt;
thearch.gentext = gentext; thearch.gentext = gentext;
thearch.listinit = listinit;
thearch.machoreloc1 = machoreloc1; thearch.machoreloc1 = machoreloc1;
thearch.lput = lputl; thearch.lput = lputl;
thearch.wput = wputl; thearch.wput = wputl;
......
// Inferno utils/8c/8.out.h
// http://code.google.com/p/inferno-os/source/browse/utils/8c/8.out.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.
#define NSYM 50
#define NSNAME 8
#include "../ld/textflag.h"
enum
{
AAAA = A_ARCHSPECIFIC,
AAAD,
AAAM,
AAAS,
AADCB,
AADCL,
AADCW,
AADDB,
AADDL,
AADDW,
AADJSP,
AANDB,
AANDL,
AANDW,
AARPL,
ABOUNDL,
ABOUNDW,
ABSFL,
ABSFW,
ABSRL,
ABSRW,
ABTL,
ABTW,
ABTCL,
ABTCW,
ABTRL,
ABTRW,
ABTSL,
ABTSW,
ABYTE,
ACLC,
ACLD,
ACLI,
ACLTS,
ACMC,
ACMPB,
ACMPL,
ACMPW,
ACMPSB,
ACMPSL,
ACMPSW,
ADAA,
ADAS,
ADECB,
ADECL,
ADECW,
ADIVB,
ADIVL,
ADIVW,
AENTER,
AHLT,
AIDIVB,
AIDIVL,
AIDIVW,
AIMULB,
AIMULL,
AIMULW,
AINB,
AINL,
AINW,
AINCB,
AINCL,
AINCW,
AINSB,
AINSL,
AINSW,
AINT,
AINTO,
AIRETL,
AIRETW,
AJCC,
AJCS,
AJCXZL,
AJCXZW,
AJEQ,
AJGE,
AJGT,
AJHI,
AJLE,
AJLS,
AJLT,
AJMI,
AJNE,
AJOC,
AJOS,
AJPC,
AJPL,
AJPS,
ALAHF,
ALARL,
ALARW,
ALEAL,
ALEAW,
ALEAVEL,
ALEAVEW,
ALOCK,
ALODSB,
ALODSL,
ALODSW,
ALONG,
ALOOP,
ALOOPEQ,
ALOOPNE,
ALSLL,
ALSLW,
AMOVB,
AMOVL,
AMOVW,
AMOVQ,
AMOVBLSX,
AMOVBLZX,
AMOVBWSX,
AMOVBWZX,
AMOVWLSX,
AMOVWLZX,
AMOVSB,
AMOVSL,
AMOVSW,
AMULB,
AMULL,
AMULW,
ANEGB,
ANEGL,
ANEGW,
ANOTB,
ANOTL,
ANOTW,
AORB,
AORL,
AORW,
AOUTB,
AOUTL,
AOUTW,
AOUTSB,
AOUTSL,
AOUTSW,
APAUSE,
APOPAL,
APOPAW,
APOPFL,
APOPFW,
APOPL,
APOPW,
APUSHAL,
APUSHAW,
APUSHFL,
APUSHFW,
APUSHL,
APUSHW,
ARCLB,
ARCLL,
ARCLW,
ARCRB,
ARCRL,
ARCRW,
AREP,
AREPN,
AROLB,
AROLL,
AROLW,
ARORB,
ARORL,
ARORW,
ASAHF,
ASALB,
ASALL,
ASALW,
ASARB,
ASARL,
ASARW,
ASBBB,
ASBBL,
ASBBW,
ASCASB,
ASCASL,
ASCASW,
ASETCC,
ASETCS,
ASETEQ,
ASETGE,
ASETGT,
ASETHI,
ASETLE,
ASETLS,
ASETLT,
ASETMI,
ASETNE,
ASETOC,
ASETOS,
ASETPC,
ASETPL,
ASETPS,
ACDQ,
ACWD,
ASHLB,
ASHLL,
ASHLW,
ASHRB,
ASHRL,
ASHRW,
ASTC,
ASTD,
ASTI,
ASTOSB,
ASTOSL,
ASTOSW,
ASUBB,
ASUBL,
ASUBW,
ASYSCALL,
ATESTB,
ATESTL,
ATESTW,
AVERR,
AVERW,
AWAIT,
AWORD,
AXCHGB,
AXCHGL,
AXCHGW,
AXLAT,
AXORB,
AXORL,
AXORW,
AFMOVB,
AFMOVBP,
AFMOVD,
AFMOVDP,
AFMOVF,
AFMOVFP,
AFMOVL,
AFMOVLP,
AFMOVV,
AFMOVVP,
AFMOVW,
AFMOVWP,
AFMOVX,
AFMOVXP,
AFCOMB,
AFCOMBP,
AFCOMD,
AFCOMDP,
AFCOMDPP,
AFCOMF,
AFCOMFP,
AFCOMI,
AFCOMIP,
AFCOML,
AFCOMLP,
AFCOMW,
AFCOMWP,
AFUCOM,
AFUCOMI,
AFUCOMIP,
AFUCOMP,
AFUCOMPP,
AFADDDP,
AFADDW,
AFADDL,
AFADDF,
AFADDD,
AFMULDP,
AFMULW,
AFMULL,
AFMULF,
AFMULD,
AFSUBDP,
AFSUBW,
AFSUBL,
AFSUBF,
AFSUBD,
AFSUBRDP,
AFSUBRW,
AFSUBRL,
AFSUBRF,
AFSUBRD,
AFDIVDP,
AFDIVW,
AFDIVL,
AFDIVF,
AFDIVD,
AFDIVRDP,
AFDIVRW,
AFDIVRL,
AFDIVRF,
AFDIVRD,
AFXCHD,
AFFREE,
AFLDCW,
AFLDENV,
AFRSTOR,
AFSAVE,
AFSTCW,
AFSTENV,
AFSTSW,
AF2XM1,
AFABS,
AFCHS,
AFCLEX,
AFCOS,
AFDECSTP,
AFINCSTP,
AFINIT,
AFLD1,
AFLDL2E,
AFLDL2T,
AFLDLG2,
AFLDLN2,
AFLDPI,
AFLDZ,
AFNOP,
AFPATAN,
AFPREM,
AFPREM1,
AFPTAN,
AFRNDINT,
AFSCALE,
AFSIN,
AFSINCOS,
AFSQRT,
AFTST,
AFXAM,
AFXTRACT,
AFYL2X,
AFYL2XP1,
ACMPXCHGB,
ACMPXCHGL,
ACMPXCHGW,
ACMPXCHG8B,
ACPUID,
ARDTSC,
AXADDB,
AXADDL,
AXADDW,
/* conditional move */
ACMOVLCC,
ACMOVLCS,
ACMOVLEQ,
ACMOVLGE,
ACMOVLGT,
ACMOVLHI,
ACMOVLLE,
ACMOVLLS,
ACMOVLLT,
ACMOVLMI,
ACMOVLNE,
ACMOVLOC,
ACMOVLOS,
ACMOVLPC,
ACMOVLPL,
ACMOVLPS,
ACMOVWCC,
ACMOVWCS,
ACMOVWEQ,
ACMOVWGE,
ACMOVWGT,
ACMOVWHI,
ACMOVWLE,
ACMOVWLS,
ACMOVWLT,
ACMOVWMI,
ACMOVWNE,
ACMOVWOC,
ACMOVWOS,
ACMOVWPC,
ACMOVWPL,
ACMOVWPS,
AFCMOVCC,
AFCMOVCS,
AFCMOVEQ,
AFCMOVHI,
AFCMOVLS,
AFCMOVNE,
AFCMOVNU,
AFCMOVUN,
ALFENCE,
AMFENCE,
ASFENCE,
AEMMS,
APREFETCHT0,
APREFETCHT1,
APREFETCHT2,
APREFETCHNTA,
ABSWAPL,
// SSE2
AADDPD,
AADDPS,
AADDSD,
AADDSS,
AANDNPD,
AANDNPS,
AANDPD,
AANDPS,
ACMPPD,
ACMPPS,
ACMPSD,
ACMPSS,
ACOMISD,
ACOMISS,
ACVTPL2PD,
ACVTPL2PS,
ACVTPD2PL,
ACVTPD2PS,
ACVTPS2PL,
ACVTPS2PD,
ACVTSD2SL,
ACVTSD2SS,
ACVTSL2SD,
ACVTSL2SS,
ACVTSS2SD,
ACVTSS2SL,
ACVTTPD2PL,
ACVTTPS2PL,
ACVTTSD2SL,
ACVTTSS2SL,
ADIVPD,
ADIVPS,
ADIVSD,
ADIVSS,
AMASKMOVOU,
AMAXPD,
AMAXPS,
AMAXSD,
AMAXSS,
AMINPD,
AMINPS,
AMINSD,
AMINSS,
AMOVAPD,
AMOVAPS,
AMOVO,
AMOVOU,
AMOVHLPS,
AMOVHPD,
AMOVHPS,
AMOVLHPS,
AMOVLPD,
AMOVLPS,
AMOVMSKPD,
AMOVMSKPS,
AMOVNTO,
AMOVNTPD,
AMOVNTPS,
AMOVSD,
AMOVSS,
AMOVUPD,
AMOVUPS,
AMULPD,
AMULPS,
AMULSD,
AMULSS,
AORPD,
AORPS,
APADDQ,
APAND,
APCMPEQB,
APMAXSW,
APMAXUB,
APMINSW,
APMINUB,
APMOVMSKB,
APSADBW,
APSUBB,
APSUBL,
APSUBQ,
APSUBSB,
APSUBSW,
APSUBUSB,
APSUBUSW,
APSUBW,
APUNPCKHQDQ,
APUNPCKLQDQ,
APXOR,
ARCPPS,
ARCPSS,
ARSQRTPS,
ARSQRTSS,
ASQRTPD,
ASQRTPS,
ASQRTSD,
ASQRTSS,
ASUBPD,
ASUBPS,
ASUBSD,
ASUBSS,
AUCOMISD,
AUCOMISS,
AUNPCKHPD,
AUNPCKHPS,
AUNPCKLPD,
AUNPCKLPS,
AXORPD,
AXORPS,
APSHUFHW,
APSHUFL,
APSHUFLW,
/* SSE 3+ */
AAESENC,
APINSRD,
APSHUFB,
ALAST
};
enum
{
REG_NONE = 0,
REG_AL = 0+16,
REG_CL,
REG_DL,
REG_BL,
REG_AH = 4+16,
REG_CH,
REG_DH,
REG_BH,
REG_AX = 8+16,
REG_CX,
REG_DX,
REG_BX,
REG_SP,
REG_BP,
REG_SI,
REG_DI,
REG_F0 = 16+16,
REG_F7 = REG_F0 + 7+16,
REG_CS = 24+16,
REG_SS,
REG_DS,
REG_ES,
REG_FS,
REG_GS,
REG_GDTR, /* global descriptor table register */
REG_IDTR, /* interrupt descriptor table register */
REG_LDTR, /* local descriptor table register */
REG_MSW, /* machine status word */
REG_TASK, /* task register */
REG_CR = 35+16,
REG_DR = 43+16,
REG_TR = 51+16,
REG_X0 = 59+16,
REG_X1,
REG_X2,
REG_X3,
REG_X4,
REG_X5,
REG_X6,
REG_X7,
REG_TLS = 67+16,
MAXREG = 68+16,
T_TYPE = 1<<0,
T_INDEX = 1<<1,
T_OFFSET = 1<<2,
T_FCONST = 1<<3,
T_SYM = 1<<4,
T_SCONST = 1<<5,
T_OFFSET2 = 1<<6,
T_GOTYPE = 1<<7,
REGARG = -1,
REGRET = REG_AX,
FREGRET = REG_F0,
REGSP = REG_SP,
REGTMP = REG_DI,
REGCTXT = REG_DX,
};
/*
* this is the ranlib header
*/
#define SYMDEF "__.GOSYMDEF"
...@@ -57,7 +57,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t); ...@@ -57,7 +57,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t);
void asmb(void); void asmb(void);
int elfreloc1(Reloc *r, vlong sectoff); int elfreloc1(Reloc *r, vlong sectoff);
void elfsetupplt(void); void elfsetupplt(void);
void listinit(void);
int machoreloc1(Reloc *r, vlong sectoff); int machoreloc1(Reloc *r, vlong sectoff);
/* Used by ../ld/dwarf.c */ /* Used by ../ld/dwarf.c */
......
// Inferno utils/8l/list.c
// http://code.google.com/p/inferno-os/source/browse/utils/8l/list.c
//
// 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.
// Printing.
#include "l.h"
#include "../ld/lib.h"
void
listinit(void)
{
listinit8();
}
...@@ -70,7 +70,6 @@ linkarchinit(void) ...@@ -70,7 +70,6 @@ linkarchinit(void)
thearch.elfreloc1 = elfreloc1; thearch.elfreloc1 = elfreloc1;
thearch.elfsetupplt = elfsetupplt; thearch.elfsetupplt = elfsetupplt;
thearch.gentext = gentext; thearch.gentext = gentext;
thearch.listinit = listinit;
thearch.machoreloc1 = machoreloc1; thearch.machoreloc1 = machoreloc1;
thearch.lput = lputl; thearch.lput = lputl;
thearch.wput = wputl; thearch.wput = wputl;
......
// cmd/9c/9.out.h from Vita Nuova.
//
// 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-2008 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-2008 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.
/*
* powerpc 64
*/
enum
{
NSNAME = 8,
NSYM = 50,
NREG = 32, /* number of general registers */
NFREG = 32, /* number of floating point registers */
};
#include "../ld/textflag.h"
// avoid conflict with ucontext.h. sigh.
#undef REG_R0
#undef REG_R1
#undef REG_R2
#undef REG_R3
#undef REG_R4
#undef REG_R5
#undef REG_R6
#undef REG_R7
#undef REG_R8
#undef REG_R9
#undef REG_R10
#undef REG_R11
#undef REG_R12
#undef REG_R13
#undef REG_R14
#undef REG_R15
#undef REG_R16
#undef REG_R17
#undef REG_R18
#undef REG_R19
#undef REG_R20
#undef REG_R21
#undef REG_R22
#undef REG_R23
#undef REG_R24
#undef REG_R25
#undef REG_R26
#undef REG_R27
#undef REG_R28
#undef REG_R29
#undef REG_R30
#undef REG_R31
#define REG_R0 GO_REG_R0
#define REG_R1 GO_REG_R1
#define REG_R2 GO_REG_R2
#define REG_R3 GO_REG_R3
#define REG_R4 GO_REG_R4
#define REG_R5 GO_REG_R5
#define REG_R6 GO_REG_R6
#define REG_R7 GO_REG_R7
#define REG_R8 GO_REG_R8
#define REG_R9 GO_REG_R9
#define REG_R10 GO_REG_R10
#define REG_R11 GO_REG_R11
#define REG_R12 GO_REG_R12
#define REG_R13 GO_REG_R13
#define REG_R14 GO_REG_R14
#define REG_R15 GO_REG_R15
#define REG_R16 GO_REG_R16
#define REG_R17 GO_REG_R17
#define REG_R18 GO_REG_R18
#define REG_R19 GO_REG_R19
#define REG_R20 GO_REG_R20
#define REG_R21 GO_REG_R21
#define REG_R22 GO_REG_R22
#define REG_R23 GO_REG_R23
#define REG_R24 GO_REG_R24
#define REG_R25 GO_REG_R25
#define REG_R26 GO_REG_R26
#define REG_R27 GO_REG_R27
#define REG_R28 GO_REG_R28
#define REG_R29 GO_REG_R29
#define REG_R30 GO_REG_R30
#define REG_R31 GO_REG_R31
enum
{
REG_R0 = 32,
REG_R1,
REG_R2,
REG_R3,
REG_R4,
REG_R5,
REG_R6,
REG_R7,
REG_R8,
REG_R9,
REG_R10,
REG_R11,
REG_R12,
REG_R13,
REG_R14,
REG_R15,
REG_R16,
REG_R17,
REG_R18,
REG_R19,
REG_R20,
REG_R21,
REG_R22,
REG_R23,
REG_R24,
REG_R25,
REG_R26,
REG_R27,
REG_R28,
REG_R29,
REG_R30,
REG_R31,
REG_F0 = 64,
REG_F1,
REG_F2,
REG_F3,
REG_F4,
REG_F5,
REG_F6,
REG_F7,
REG_F8,
REG_F9,
REG_F10,
REG_F11,
REG_F12,
REG_F13,
REG_F14,
REG_F15,
REG_F16,
REG_F17,
REG_F18,
REG_F19,
REG_F20,
REG_F21,
REG_F22,
REG_F23,
REG_F24,
REG_F25,
REG_F26,
REG_F27,
REG_F28,
REG_F29,
REG_F30,
REG_F31,
REG_SPECIAL = 96,
REG_C0 = 96,
REG_C1,
REG_C2,
REG_C3,
REG_C4,
REG_C5,
REG_C6,
REG_C7,
REG_MSR = 104,
REG_FPSCR,
REG_CR,
REG_SPR0 = 1024, // first of 1024 registers
REG_DCR0 = 2048, // first of 1024 registers
REG_XER = REG_SPR0 + 1,
REG_LR = REG_SPR0 + 8,
REG_CTR = REG_SPR0 + 9,
REGZERO = REG_R0, /* set to zero */
REGSP = REG_R1,
REGSB = REG_R2,
REGRET = REG_R3,
REGARG = -1, /* -1 disables passing the first argument in register */
REGRT1 = REG_R3, /* reserved for runtime, duffzero and duffcopy */
REGRT2 = REG_R4, /* reserved for runtime, duffcopy */
REGMIN = REG_R7, /* register variables allocated from here to REGMAX */
REGCTXT = REG_R11, /* context for closures */
REGTLS = REG_R13, /* C ABI TLS base pointer */
REGMAX = REG_R27,
REGEXT = REG_R30, /* external registers allocated from here down */
REGG = REG_R30, /* G */
REGTMP = REG_R31, /* used by the linker */
FREGRET = REG_F0,
FREGMIN = REG_F17, /* first register variable */
FREGMAX = REG_F26, /* last register variable for 9g only */
FREGEXT = REG_F26, /* first external register */
FREGCVI = REG_F27, /* floating conversion constant */
FREGZERO = REG_F28, /* both float and double */
FREGHALF = REG_F29, /* double */
FREGONE = REG_F30, /* double */
FREGTWO = REG_F31 /* double */
/*
* GENERAL:
*
* compiler allocates R3 up as temps
* compiler allocates register variables R7-R27
* compiler allocates external registers R30 down
*
* compiler allocates register variables F17-F26
* compiler allocates external registers F26 down
*/
};
enum {
BIG = 32768-8,
};
enum {
/* mark flags */
LABEL = 1<<0,
LEAF = 1<<1,
FLOAT = 1<<2,
BRANCH = 1<<3,
LOAD = 1<<4,
FCMP = 1<<5,
SYNC = 1<<6,
LIST = 1<<7,
FOLL = 1<<8,
NOSCHED = 1<<9,
};
enum
{
C_NONE,
C_REG,
C_FREG,
C_CREG,
C_SPR, /* special processor register */
C_ZCON,
C_SCON, /* 16 bit signed */
C_UCON, /* 32 bit signed, low 16 bits 0 */
C_ADDCON, /* -0x8000 <= v < 0 */
C_ANDCON, /* 0 < v <= 0xFFFF */
C_LCON, /* other 32 */
C_DCON, /* other 64 (could subdivide further) */
C_SACON, /* $n(REG) where n <= int16 */
C_SECON,
C_LACON, /* $n(REG) where int16 < n <= int32 */
C_LECON,
C_DACON, /* $n(REG) where int32 < n */
C_SBRA,
C_LBRA,
C_SAUTO,
C_LAUTO,
C_SEXT,
C_LEXT,
C_ZOREG,
C_SOREG,
C_LOREG,
C_FPSCR,
C_MSR,
C_XER,
C_LR,
C_CTR,
C_ANY,
C_GOK,
C_ADDR,
C_TEXTSIZE,
C_NCLASS, /* must be the last */
};
enum
{
AADD = A_ARCHSPECIFIC,
AADDCC,
AADDV,
AADDVCC,
AADDC,
AADDCCC,
AADDCV,
AADDCVCC,
AADDME,
AADDMECC,
AADDMEVCC,
AADDMEV,
AADDE,
AADDECC,
AADDEVCC,
AADDEV,
AADDZE,
AADDZECC,
AADDZEVCC,
AADDZEV,
AAND,
AANDCC,
AANDN,
AANDNCC,
ABC,
ABCL,
ABEQ,
ABGE,
ABGT,
ABLE,
ABLT,
ABNE,
ABVC,
ABVS,
ACMP,
ACMPU,
ACNTLZW,
ACNTLZWCC,
ACRAND,
ACRANDN,
ACREQV,
ACRNAND,
ACRNOR,
ACROR,
ACRORN,
ACRXOR,
ADIVW,
ADIVWCC,
ADIVWVCC,
ADIVWV,
ADIVWU,
ADIVWUCC,
ADIVWUVCC,
ADIVWUV,
AEQV,
AEQVCC,
AEXTSB,
AEXTSBCC,
AEXTSH,
AEXTSHCC,
AFABS,
AFABSCC,
AFADD,
AFADDCC,
AFADDS,
AFADDSCC,
AFCMPO,
AFCMPU,
AFCTIW,
AFCTIWCC,
AFCTIWZ,
AFCTIWZCC,
AFDIV,
AFDIVCC,
AFDIVS,
AFDIVSCC,
AFMADD,
AFMADDCC,
AFMADDS,
AFMADDSCC,
AFMOVD,
AFMOVDCC,
AFMOVDU,
AFMOVS,
AFMOVSU,
AFMSUB,
AFMSUBCC,
AFMSUBS,
AFMSUBSCC,
AFMUL,
AFMULCC,
AFMULS,
AFMULSCC,
AFNABS,
AFNABSCC,
AFNEG,
AFNEGCC,
AFNMADD,
AFNMADDCC,
AFNMADDS,
AFNMADDSCC,
AFNMSUB,
AFNMSUBCC,
AFNMSUBS,
AFNMSUBSCC,
AFRSP,
AFRSPCC,
AFSUB,
AFSUBCC,
AFSUBS,
AFSUBSCC,
AMOVMW,
ALSW,
ALWAR,
AMOVWBR,
AMOVB,
AMOVBU,
AMOVBZ,
AMOVBZU,
AMOVH,
AMOVHBR,
AMOVHU,
AMOVHZ,
AMOVHZU,
AMOVW,
AMOVWU,
AMOVFL,
AMOVCRFS,
AMTFSB0,
AMTFSB0CC,
AMTFSB1,
AMTFSB1CC,
AMULHW,
AMULHWCC,
AMULHWU,
AMULHWUCC,
AMULLW,
AMULLWCC,
AMULLWVCC,
AMULLWV,
ANAND,
ANANDCC,
ANEG,
ANEGCC,
ANEGVCC,
ANEGV,
ANOR,
ANORCC,
AOR,
AORCC,
AORN,
AORNCC,
AREM,
AREMCC,
AREMV,
AREMVCC,
AREMU,
AREMUCC,
AREMUV,
AREMUVCC,
ARFI,
ARLWMI,
ARLWMICC,
ARLWNM,
ARLWNMCC,
ASLW,
ASLWCC,
ASRW,
ASRAW,
ASRAWCC,
ASRWCC,
ASTSW,
ASTWCCC,
ASUB,
ASUBCC,
ASUBVCC,
ASUBC,
ASUBCCC,
ASUBCV,
ASUBCVCC,
ASUBME,
ASUBMECC,
ASUBMEVCC,
ASUBMEV,
ASUBV,
ASUBE,
ASUBECC,
ASUBEV,
ASUBEVCC,
ASUBZE,
ASUBZECC,
ASUBZEVCC,
ASUBZEV,
ASYNC,
AXOR,
AXORCC,
ADCBF,
ADCBI,
ADCBST,
ADCBT,
ADCBTST,
ADCBZ,
AECIWX,
AECOWX,
AEIEIO,
AICBI,
AISYNC,
APTESYNC,
ATLBIE,
ATLBIEL,
ATLBSYNC,
ATW,
ASYSCALL,
AWORD,
ARFCI,
/* optional on 32-bit */
AFRES,
AFRESCC,
AFRSQRTE,
AFRSQRTECC,
AFSEL,
AFSELCC,
AFSQRT,
AFSQRTCC,
AFSQRTS,
AFSQRTSCC,
/* 64-bit */
ACNTLZD,
ACNTLZDCC,
ACMPW, /* CMP with L=0 */
ACMPWU,
ADIVD,
ADIVDCC,
ADIVDVCC,
ADIVDV,
ADIVDU,
ADIVDUCC,
ADIVDUVCC,
ADIVDUV,
AEXTSW,
AEXTSWCC,
/* AFCFIW; AFCFIWCC */
AFCFID,
AFCFIDCC,
AFCTID,
AFCTIDCC,
AFCTIDZ,
AFCTIDZCC,
ALDAR,
AMOVD,
AMOVDU,
AMOVWZ,
AMOVWZU,
AMULHD,
AMULHDCC,
AMULHDU,
AMULHDUCC,
AMULLD,
AMULLDCC,
AMULLDVCC,
AMULLDV,
ARFID,
ARLDMI,
ARLDMICC,
ARLDC,
ARLDCCC,
ARLDCR,
ARLDCRCC,
ARLDCL,
ARLDCLCC,
ASLBIA,
ASLBIE,
ASLBMFEE,
ASLBMFEV,
ASLBMTE,
ASLD,
ASLDCC,
ASRD,
ASRAD,
ASRADCC,
ASRDCC,
ASTDCCC,
ATD,
/* 64-bit pseudo operation */
ADWORD,
AREMD,
AREMDCC,
AREMDV,
AREMDVCC,
AREMDU,
AREMDUCC,
AREMDUV,
AREMDUVCC,
/* more 64-bit operations */
AHRFID,
ALAST,
// aliases
ABR = AJMP,
ABL = ACALL,
ARETURN = ARET,
};
/*
* this is the ranlib header
*/
#define SYMDEF "__.GOSYMDEF"
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <libc.h> #include <libc.h>
#include <bio.h> #include <bio.h>
#include <link.h> #include <link.h>
#include "9.out.h"
#ifndef EXTERN #ifndef EXTERN
#define EXTERN extern #define EXTERN extern
...@@ -57,7 +56,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t); ...@@ -57,7 +56,6 @@ vlong archrelocvariant(Reloc *r, LSym *s, vlong t);
void asmb(void); void asmb(void);
int elfreloc1(Reloc *r, vlong sectoff); int elfreloc1(Reloc *r, vlong sectoff);
void elfsetupplt(void); void elfsetupplt(void);
void listinit(void);
int machoreloc1(Reloc *r, vlong sectoff); int machoreloc1(Reloc *r, vlong sectoff);
/* Used by ../ld/dwarf.c */ /* Used by ../ld/dwarf.c */
......
// Inferno utils/5l/list.h
// http://code.google.com/p/inferno-os/source/browse/utils/5l/list.c
//
// 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.
// Printing.
#include "l.h"
#include "../ld/lib.h"
void
listinit(void)
{
listinit9();
}
...@@ -71,7 +71,6 @@ linkarchinit(void) ...@@ -71,7 +71,6 @@ linkarchinit(void)
thearch.elfreloc1 = elfreloc1; thearch.elfreloc1 = elfreloc1;
thearch.elfsetupplt = elfsetupplt; thearch.elfsetupplt = elfsetupplt;
thearch.gentext = gentext; thearch.gentext = gentext;
thearch.listinit = listinit;
thearch.machoreloc1 = machoreloc1; thearch.machoreloc1 = machoreloc1;
if(thelinkarch == &linkppc64le) { if(thelinkarch == &linkppc64le) {
thearch.lput = lputl; thearch.lput = lputl;
......
...@@ -475,7 +475,6 @@ var proto_gccargs = []string{ ...@@ -475,7 +475,6 @@ var proto_gccargs = []string{
"-Wno-switch", "-Wno-switch",
"-Wno-comment", "-Wno-comment",
"-Wno-missing-field-initializers", "-Wno-missing-field-initializers",
"-Werror",
"-fno-common", "-fno-common",
"-ggdb", "-ggdb",
"-pipe", "-pipe",
...@@ -531,10 +530,6 @@ var deptab = []struct { ...@@ -531,10 +530,6 @@ var deptab = []struct {
"$GOROOT/include/bio.h", "$GOROOT/include/bio.h",
"$GOROOT/include/ar.h", "$GOROOT/include/ar.h",
"$GOROOT/include/link.h", "$GOROOT/include/link.h",
"anames5.c",
"anames6.c",
"anames8.c",
"anames9.c",
}}, }},
{"cmd/5l", []string{ {"cmd/5l", []string{
"$GOROOT/pkg/obj/${GOHOSTOS}_$GOHOSTARCH/libld.a", "$GOROOT/pkg/obj/${GOHOSTOS}_$GOHOSTARCH/libld.a",
...@@ -574,15 +569,15 @@ var gentab = []struct { ...@@ -574,15 +569,15 @@ var gentab = []struct {
nameprefix string nameprefix string
gen func(string, string) gen func(string, string)
}{ }{
{"anames5.c", mkanames},
{"anames6.c", mkanames},
{"anames8.c", mkanames},
{"anames9.c", mkanames},
{"zdefaultcc.go", mkzdefaultcc}, {"zdefaultcc.go", mkzdefaultcc},
{"zversion.go", mkzversion}, {"zversion.go", mkzversion},
// not generated anymore, but delete the file if we see it // not generated anymore, but delete the file if we see it
{"enam.c", nil}, {"enam.c", nil},
{"anames5.c", nil},
{"anames6.c", nil},
{"anames8.c", nil},
{"anames9.c", nil},
} }
// install installs the library, package, or binary associated with dir, // install installs the library, package, or binary associated with dir,
......
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"bytes"
"fmt"
"strings"
)
/*
* Helpers for building cmd/gc.
*/
// gcopnames creates opnames.h from go.h.
// It finds the OXXX enum, pulls out all the constants
// from OXXX to OEND, and writes a table mapping
// op to string.
func gcopnames(dir, file string) {
var out bytes.Buffer
fmt.Fprintf(&out, "// auto generated by go tool dist\n")
fmt.Fprintf(&out, "static char *opnames[] = {\n")
in := readfile(pathf("%s/go.h", dir))
lines := splitlines(in)
i := 0
for i < len(lines) && !strings.Contains(lines[i], "OXXX") {
i++
}
for _, line := range lines[i:] {
if i := strings.Index(line, "//"); i >= 0 {
line = line[:i]
}
for _, field := range splitfields(line) {
field = strings.TrimPrefix(field, "O")
field = strings.TrimSuffix(field, ",")
fmt.Fprintf(&out, "\t[O%s] = \"%s\",\n", field, field)
}
if strings.Contains(line, "OEND") {
break
}
}
fmt.Fprintf(&out, "};\n")
writefile(out.String(), file, 0)
}
// mkanames reads [5689].out.h and writes anames[5689].c
// The format is much the same as the Go opcodes above.
// It also writes out cnames array for C_* constants.
func mkanames(dir, file string) {
ch := file[len(file)-3]
targ := pathf("%s/../cmd/%cl/%c.out.h", dir, ch, ch)
in := readfile(pathf("%s/../../include/link.h", dir)) + readfile(targ)
lines := splitlines(in)
// Include link.h so that the extern declaration there is
// checked against the non-extern declaration we are generating.
var out bytes.Buffer
fmt.Fprintf(&out, "// auto generated by go tool dist\n")
fmt.Fprintf(&out, "#include <u.h>\n")
fmt.Fprintf(&out, "#include <libc.h>\n")
fmt.Fprintf(&out, "#include <bio.h>\n")
fmt.Fprintf(&out, "#include <link.h>\n")
fmt.Fprintf(&out, "#include \"../cmd/%cl/%c.out.h\"\n", ch, ch)
fmt.Fprintf(&out, "\n")
fmt.Fprintf(&out, "char* anames%c[] = {\n", ch)
for _, line := range lines {
// Use all A names found in the headers,
// except don't use A_ARCHSPECIFIC (left to arch to define),
// and don't use any aliases (= A...),
// except do use the arch-defined alias for A_ARCHSPECIFIC.
if strings.Contains(line, ";") {
continue
}
if strings.HasPrefix(line, "\tA") && !strings.Contains(line, "\tA_") && (!strings.Contains(line, "= A") || strings.Contains(line, "= A_ARCHSPECIFIC")) {
if i := strings.Index(line, ","); i >= 0 {
line = line[:i]
}
if i := strings.Index(line, "="); i >= 0 {
line = line[:i]
}
if i := strings.Index(line, "\n"); i >= 0 {
line = line[:i]
}
line = line[2:]
fmt.Fprintf(&out, "\t\"%s\",\n", strings.TrimSpace(line))
}
}
fmt.Fprintf(&out, "};\n")
j := 0
var out2 bytes.Buffer
fmt.Fprintf(&out2, "char* cnames%c[] = {\n", ch)
for _, line := range lines {
if strings.HasPrefix(line, "\tC_") {
if i := strings.Index(line, ","); i >= 0 {
line = line[:i]
}
if i := strings.Index(line, "\n"); i >= 0 {
line = line[:i]
}
line = line[3:]
fmt.Fprintf(&out2, "\t\"%s\",\n", line)
j++
}
}
fmt.Fprintf(&out2, "};\n")
if j > 0 {
out.Write(out2.Bytes())
}
writefile(out.String(), file, 0)
}
...@@ -60,7 +60,6 @@ struct Arch { ...@@ -60,7 +60,6 @@ struct Arch {
int (*elfreloc1)(Reloc*, vlong); int (*elfreloc1)(Reloc*, vlong);
void (*elfsetupplt)(void); void (*elfsetupplt)(void);
void (*gentext)(void); void (*gentext)(void);
void (*listinit)(void);
int (*machoreloc1)(Reloc*, vlong); int (*machoreloc1)(Reloc*, vlong);
void (*lput)(uint32); void (*lput)(uint32);
......
...@@ -57,7 +57,6 @@ ldmain(int argc, char **argv) ...@@ -57,7 +57,6 @@ ldmain(int argc, char **argv)
ctxt->bso = &bso; ctxt->bso = &bso;
Binit(&bso, 1, OWRITE); Binit(&bso, 1, OWRITE);
thearch.listinit();
memset(debug, 0, sizeof(debug)); memset(debug, 0, sizeof(debug));
nerrors = 0; nerrors = 0;
outfile = nil; outfile = nil;
...@@ -128,12 +127,6 @@ ldmain(int argc, char **argv) ...@@ -128,12 +127,6 @@ ldmain(int argc, char **argv)
flagparse(&argc, &argv, usage); flagparse(&argc, &argv, usage);
ctxt->bso = &bso; ctxt->bso = &bso;
ctxt->debugdivmod = debug['M'];
ctxt->debugfloat = debug['F'];
ctxt->debughist = debug['O'];
ctxt->debugpcln = debug['O'];
ctxt->debugread = debug['W'];
ctxt->debugstack = debug['K'];
ctxt->debugvlog = debug['v']; ctxt->debugvlog = debug['v'];
if(argc != 1) if(argc != 1)
...@@ -154,7 +147,6 @@ ldmain(int argc, char **argv) ...@@ -154,7 +147,6 @@ ldmain(int argc, char **argv)
headstring = headstr(HEADTYPE); headstring = headstr(HEADTYPE);
thearch.archinit(); thearch.archinit();
ctxt->debugfloat = debug['F'];
if(debug['v']) if(debug['v'])
Bprint(&bso, "HEADER = -H%d -T0x%llux -D0x%llux -R0x%ux\n", Bprint(&bso, "HEADER = -H%d -T0x%llux -D0x%llux -R0x%ux\n",
...@@ -201,8 +193,6 @@ ldmain(int argc, char **argv) ...@@ -201,8 +193,6 @@ ldmain(int argc, char **argv)
if(debug['v']) { if(debug['v']) {
Bprint(&bso, "%5.2f cpu time\n", cputime()); Bprint(&bso, "%5.2f cpu time\n", cputime());
Bprint(&bso, "%d symbols\n", ctxt->nsymbol); Bprint(&bso, "%d symbols\n", ctxt->nsymbol);
Bprint(&bso, "%d sizeof adr\n", sizeof(Addr));
Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
Bprint(&bso, "%lld liveness data\n", liveness); Bprint(&bso, "%lld liveness data\n", liveness);
} }
Bflush(&bso); Bflush(&bso);
......
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <link.h>
LinkArch linkarm = {
.name = "arm",
.thechar = '5',
.endian = LittleEndian,
.minlc = 4,
.ptrsize = 4,
.regsize = 4,
};
LinkArch linkamd64 = {
.name = "amd64",
.thechar = '6',
.endian = LittleEndian,
.minlc = 1,
.ptrsize = 8,
.regsize = 8,
};
LinkArch linkamd64p32 = {
.name = "amd64p32",
.thechar = '6',
.endian = LittleEndian,
.minlc = 1,
.ptrsize = 4,
.regsize = 8,
};
LinkArch link386 = {
.name = "386",
.thechar = '8',
.endian = LittleEndian,
.minlc = 1,
.ptrsize = 4,
.regsize = 4,
};
LinkArch linkppc64 = {
.name = "ppc64",
.thechar = '9',
.endian = BigEndian,
.minlc = 4,
.ptrsize = 8,
.regsize = 8,
};
LinkArch linkppc64le = {
.name = "ppc64le",
.thechar = '9',
.endian = LittleEndian,
.minlc = 4,
.ptrsize = 8,
.regsize = 8,
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,11 +34,6 @@ ...@@ -34,11 +34,6 @@
#include <bio.h> #include <bio.h>
#include <link.h> #include <link.h>
void
mangle(char *file)
{
sysfatal("%s: mangled input file", file);
}
void void
symgrow(Link *ctxt, LSym *s, vlong lsiz) symgrow(Link *ctxt, LSym *s, vlong lsiz)
...@@ -70,80 +65,6 @@ symgrow(Link *ctxt, LSym *s, vlong lsiz) ...@@ -70,80 +65,6 @@ symgrow(Link *ctxt, LSym *s, vlong lsiz)
s->np = siz; s->np = siz;
} }
void
savedata(Link *ctxt, LSym *s, Prog *p, char *pn)
{
int32 off, siz, i, fl;
float32 flt;
uchar *cast;
vlong o;
Reloc *r;
off = p->from.offset;
siz = p->from3.offset;
if(off < 0 || siz < 0 || off >= 1<<30 || siz >= 100)
mangle(pn);
if(ctxt->enforce_data_order && off < s->np)
ctxt->diag("data out of order (already have %d)\n%P", p);
symgrow(ctxt, s, off+siz);
if(p->to.type == TYPE_FCONST) {
switch(siz) {
default:
case 4:
flt = p->to.u.dval;
cast = (uchar*)&flt;
for(i=0; i<4; i++)
s->p[off+i] = cast[fnuxi4[i]];
break;
case 8:
cast = (uchar*)&p->to.u.dval;
for(i=0; i<8; i++)
s->p[off+i] = cast[fnuxi8[i]];
break;
}
} else if(p->to.type == TYPE_SCONST) {
for(i=0; i<siz; i++)
s->p[off+i] = p->to.u.sval[i];
} else if(p->to.type == TYPE_CONST) {
if(p->to.sym)
goto addr;
o = p->to.offset;
fl = o;
cast = (uchar*)&fl;
switch(siz) {
default:
ctxt->diag("bad nuxi %d\n%P", siz, p);
break;
case 1:
s->p[off] = cast[inuxi1[0]];
break;
case 2:
for(i=0; i<2; i++)
s->p[off+i] = cast[inuxi2[i]];
break;
case 4:
for(i=0; i<4; i++)
s->p[off+i] = cast[inuxi4[i]];
break;
case 8:
cast = (uchar*)&o;
for(i=0; i<8; i++)
s->p[off+i] = cast[inuxi8[i]];
break;
}
} else if(p->to.type == TYPE_ADDR) {
addr:
r = addrel(s);
r->off = off;
r->siz = siz;
r->sym = p->to.sym;
r->type = R_ADDR;
r->add = p->to.offset;
} else {
ctxt->diag("bad data: %P", p);
}
}
Reloc* Reloc*
addrel(LSym *s) addrel(LSym *s)
...@@ -237,11 +158,6 @@ setuint8(Link *ctxt, LSym *s, vlong r, uint8 v) ...@@ -237,11 +158,6 @@ setuint8(Link *ctxt, LSym *s, vlong r, uint8 v)
return setuintxx(ctxt, s, r, v, 1); return setuintxx(ctxt, s, r, v, 1);
} }
vlong
setuint16(Link *ctxt, LSym *s, vlong r, uint16 v)
{
return setuintxx(ctxt, s, r, v, 2);
}
vlong vlong
setuint32(Link *ctxt, LSym *s, vlong r, uint32 v) setuint32(Link *ctxt, LSym *s, vlong r, uint32 v)
...@@ -249,11 +165,6 @@ setuint32(Link *ctxt, LSym *s, vlong r, uint32 v) ...@@ -249,11 +165,6 @@ setuint32(Link *ctxt, LSym *s, vlong r, uint32 v)
return setuintxx(ctxt, s, r, v, 4); return setuintxx(ctxt, s, r, v, 4);
} }
vlong
setuint64(Link *ctxt, LSym *s, vlong r, uint64 v)
{
return setuintxx(ctxt, s, r, v, 8);
}
vlong vlong
addaddrplus(Link *ctxt, LSym *s, LSym *t, vlong add) addaddrplus(Link *ctxt, LSym *s, LSym *t, vlong add)
......
...@@ -9,67 +9,6 @@ ...@@ -9,67 +9,6 @@
#include <bio.h> #include <bio.h>
#include <link.h> #include <link.h>
int framepointer_enabled;
int fieldtrack_enabled;
Prog zprog;
// Toolchain experiments.
// These are controlled by the GOEXPERIMENT environment
// variable recorded when the toolchain is built.
// This list is also known to cmd/gc.
static struct {
char *name;
int *val;
} exper[] = {
{"fieldtrack", &fieldtrack_enabled},
{"framepointer", &framepointer_enabled},
};
static void
addexp(char *s)
{
int i;
for(i=0; i < nelem(exper); i++ ) {
if(strcmp(exper[i].name, s) == 0) {
if(exper[i].val != nil)
*exper[i].val = 1;
return;
}
}
print("unknown experiment %s\n", s);
exits("unknown experiment");
}
void
linksetexp(void)
{
char *f[20];
int i, nf;
// cmd/dist #defines GOEXPERIMENT for us.
nf = getfields(GOEXPERIMENT, f, nelem(f), 1, ",");
for(i=0; i<nf; i++)
addexp(f[i]);
}
char*
expstring(void)
{
int i;
static char buf[512];
strcpy(buf, "X");
for(i=0; i<nelem(exper); i++)
if(*exper[i].val)
seprint(buf+strlen(buf), buf+sizeof buf, ",%s", exper[i].name);
if(strlen(buf) == 1)
strcpy(buf, "X,none");
buf[1] = ':';
return buf;
}
// replace all "". with pkg. // replace all "". with pkg.
char* char*
expandpkg(char *t0, char *pkg) expandpkg(char *t0, char *pkg)
...@@ -128,29 +67,6 @@ erealloc(void *p, long n) ...@@ -128,29 +67,6 @@ erealloc(void *p, long n)
return p; return p;
} }
void
double2ieee(uint64 *ieee, float64 f)
{
memmove(ieee, &f, 8);
}
void
nopout(Prog *p)
{
p->as = ANOP;
p->scond = zprog.scond;
p->from = zprog.from;
p->from3 = zprog.from3;
p->reg = zprog.reg;
p->to = zprog.to;
}
void
nocache(Prog *p)
{
p->optab = 0;
p->from.class = 0;
p->from3.class = 0;
p->to.class = 0;
}
...@@ -176,66 +176,8 @@ uchar inuxi2[2]; ...@@ -176,66 +176,8 @@ uchar inuxi2[2];
uchar inuxi4[4]; uchar inuxi4[4];
uchar inuxi8[8]; uchar inuxi8[8];
enum
{
LOG = 5,
};
void
mkfwd(LSym *sym)
{
Prog *p;
int i;
int32 dwn[LOG], cnt[LOG];
Prog *lst[LOG];
for(i=0; i<LOG; i++) {
if(i == 0)
cnt[i] = 1;
else
cnt[i] = LOG * cnt[i-1];
dwn[i] = 1;
lst[i] = nil;
}
i = 0;
for(p = sym->text; p != nil && p->link != nil; p = p->link) {
i--;
if(i < 0)
i = LOG-1;
p->forwd = nil;
dwn[i]--;
if(dwn[i] <= 0) {
dwn[i] = cnt[i];
if(lst[i] != nil)
lst[i]->forwd = p;
lst[i] = p;
}
}
}
Prog*
copyp(Link *ctxt, Prog *q)
{
Prog *p;
USED(ctxt);
p = emallocz(sizeof(Prog));
*p = *q;
return p;
}
Prog*
appendp(Link *ctxt, Prog *q)
{
Prog *p;
USED(ctxt);
p = emallocz(sizeof(Prog));
p->link = q->link;
q->link = p;
p->lineno = q->lineno;
p->mode = q->mode;
return p;
}
vlong vlong
atolwhex(char *s) atolwhex(char *s)
......
// Inferno utils/5c/list.c
// http://code.google.com/p/inferno-os/source/browse/utils/5c/list.c
//
// 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.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <link.h>
#include "../cmd/5l/5.out.h"
#include "../runtime/funcdata.h"
enum
{
STRINGSZ = 1000
};
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Mconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
static int RAconv(Fmt *fp);
static int DSconv(Fmt *fp);
static int DRconv(Fmt*);
#pragma varargck type "$" char*
#pragma varargck type "M" Addr*
#pragma varargck type "@" Addr*
void
listinit5(void)
{
fmtinstall('A', Aconv);
fmtinstall('D', Dconv);
fmtinstall('P', Pconv);
fmtinstall('R', Rconv);
// for liblink internal use
fmtinstall('^', DRconv);
// for internal use
fmtinstall('$', DSconv);
fmtinstall('M', Mconv);
fmtinstall('@', RAconv);
}
static char *extra [] = {
".EQ", ".NE", ".CS", ".CC",
".MI", ".PL", ".VS", ".VC",
".HI", ".LS", ".GE", ".LT",
".GT", ".LE", "", ".NV",
};
static Prog* bigP;
static int
Pconv(Fmt *fp)
{
char str[STRINGSZ], sc[20];
Prog *p;
int a, s;
p = va_arg(fp->args, Prog*);
bigP = p;
a = p->as;
s = p->scond;
strcpy(sc, extra[(s & C_SCOND) ^ C_SCOND_XOR]);
if(s & C_SBIT)
strcat(sc, ".S");
if(s & C_PBIT)
strcat(sc, ".P");
if(s & C_WBIT)
strcat(sc, ".W");
if(s & C_UBIT) /* ambiguous with FBIT */
strcat(sc, ".U");
if(a == AMOVM) {
if(p->from.type == TYPE_CONST)
sprint(str, "%.5lld (%L) %A%s %@,%D", p->pc, p->lineno, a, sc, &p->from, &p->to);
else
if(p->to.type == TYPE_CONST)
sprint(str, "%.5lld (%L) %A%s %D,%@", p->pc, p->lineno, a, sc, &p->from, &p->to);
else
sprint(str, "%.5lld (%L) %A%s %D,%D", p->pc, p->lineno, a, sc, &p->from, &p->to);
} else
if(a == ADATA)
sprint(str, "%.5lld (%L) %A %D/%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
else
if(p->as == ATEXT)
sprint(str, "%.5lld (%L) %A %D,%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
else
if(p->reg == 0)
sprint(str, "%.5lld (%L) %A%s %D,%D", p->pc, p->lineno, a, sc, &p->from, &p->to);
else
sprint(str, "%.5lld (%L) %A%s %D,%R,%D", p->pc, p->lineno, a, sc, &p->from, p->reg, &p->to);
bigP = nil;
return fmtstrcpy(fp, str);
}
static int
Aconv(Fmt *fp)
{
char *s;
int a;
a = va_arg(fp->args, int);
s = "???";
if(a >= AXXX && a < ALAST)
s = anames5[a];
return fmtstrcpy(fp, s);
}
static int
Dconv(Fmt *fp)
{
char str[STRINGSZ];
Addr *a;
const char *op;
int v;
a = va_arg(fp->args, Addr*);
switch(a->type) {
default:
sprint(str, "GOK-type(%d)", a->type);
break;
case TYPE_NONE:
str[0] = 0;
if(a->name != TYPE_NONE || a->reg != 0 || a->sym != nil)
sprint(str, "%M(%R)(NONE)", a, a->reg);
break;
case TYPE_CONST:
case TYPE_ADDR:
if(a->reg != 0)
sprint(str, "$%M(%R)", a, a->reg);
else
sprint(str, "$%M", a);
break;
case TYPE_TEXTSIZE:
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%d", a->offset, a->u.argsize);
break;
case TYPE_SHIFT:
v = a->offset;
op = &"<<>>->@>"[(((v>>5) & 3) << 1)];
if(v & (1<<4))
sprint(str, "R%d%c%cR%d", v&15, op[0], op[1], (v>>8)&15);
else
sprint(str, "R%d%c%c%d", v&15, op[0], op[1], (v>>7)&31);
if(a->reg != 0)
sprint(str+strlen(str), "(%R)", a->reg);
break;
case TYPE_MEM:
if(a->reg != 0)
sprint(str, "%M(%R)", a, a->reg);
else
sprint(str, "%M", a);
break;
case TYPE_REG:
sprint(str, "%R", a->reg);
if(a->name != TYPE_NONE || a->sym != nil)
sprint(str, "%M(%R)(REG)", a, a->reg);
break;
case TYPE_BRANCH:
if(a->sym != nil)
sprint(str, "%s(SB)", a->sym->name);
else if(bigP != nil && bigP->pcond != nil)
sprint(str, "%lld", bigP->pcond->pc);
else if(a->u.branch != nil)
sprint(str, "%lld", a->u.branch->pc);
else
sprint(str, "%lld(PC)", a->offset/*-pc*/);
break;
case TYPE_FCONST:
sprint(str, "$%.17g", a->u.dval);
break;
case TYPE_SCONST:
sprint(str, "$\"%$\"", a->u.sval);
break;
case TYPE_REGREG:
sprint(str, "(%R, %R)", a->reg, (int)a->offset);
break;
case TYPE_REGREG2:
sprint(str, "%R, %R", a->reg, (int)a->offset);
break;
}
return fmtstrcpy(fp, str);
}
static int
RAconv(Fmt *fp)
{
char str[STRINGSZ];
Addr *a;
int i, v;
a = va_arg(fp->args, Addr*);
sprint(str, "GOK-reglist");
switch(a->type) {
case TYPE_CONST:
if(a->reg != 0)
break;
if(a->sym != nil)
break;
v = a->offset;
strcpy(str, "");
for(i=0; i<NREG; i++) {
if(v & (1<<i)) {
if(str[0] == 0)
strcat(str, "[R");
else
strcat(str, ",R");
sprint(strchr(str, 0), "%d", i);
}
}
strcat(str, "]");
}
return fmtstrcpy(fp, str);
}
static int
DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;
a = va_arg(fp->args, char*);
p = str;
for(i=0; i<NSNAME; i++) {
c = a[i] & 0xff;
if(c >= 'a' && c <= 'z' ||
c >= 'A' && c <= 'Z' ||
c >= '0' && c <= '9' ||
c == ' ' || c == '%') {
*p++ = c;
continue;
}
*p++ = '\\';
switch(c) {
case 0:
*p++ = 'z';
continue;
case '\\':
case '"':
*p++ = c;
continue;
case '\n':
*p++ = 'n';
continue;
case '\t':
*p++ = 't';
continue;
case '\r':
*p++ = 'r';
continue;
case '\f':
*p++ = 'f';
continue;
}
*p++ = (c>>6) + '0';
*p++ = ((c>>3) & 7) + '0';
*p++ = (c & 7) + '0';
}
*p = 0;
return fmtstrcpy(fp, str);
}
static int
Rconv(Fmt *fp)
{
int r;
r = va_arg(fp->args, int);
if(r == 0)
return fmtstrcpy(fp, "NONE");
if(REG_R0 <= r && r <= REG_R15)
return fmtprint(fp, "R%d", r-REG_R0);
if(REG_F0 <= r && r <= REG_F15)
return fmtprint(fp, "F%d", r-REG_F0);
switch(r) {
case REG_FPSR:
return fmtstrcpy(fp, "FPSR");
case REG_FPCR:
return fmtstrcpy(fp, "FPCR");
case REG_CPSR:
return fmtstrcpy(fp, "CPSR");
case REG_SPSR:
return fmtstrcpy(fp, "SPSR");
}
return fmtprint(fp, "badreg(%d)", r);
}
static int
DRconv(Fmt *fp)
{
char *s;
int a;
a = va_arg(fp->args, int);
s = "C_??";
if(a >= C_NONE && a <= C_NCLASS)
s = cnames5[a];
return fmtstrcpy(fp, s);
}
static int
Mconv(Fmt *fp)
{
char str[STRINGSZ];
Addr *a;
LSym *s;
a = va_arg(fp->args, Addr*);
s = a->sym;
if(s == nil) {
sprint(str, "%d", (int)a->offset);
goto out;
}
switch(a->name) {
default:
sprint(str, "GOK-name(%d)", a->name);
break;
case NAME_NONE:
sprint(str, "%lld", a->offset);
break;
case NAME_EXTERN:
sprint(str, "%s+%d(SB)", s->name, (int)a->offset);
break;
case NAME_STATIC:
sprint(str, "%s<>+%d(SB)", s->name, (int)a->offset);
break;
case NAME_AUTO:
sprint(str, "%s-%d(SP)", s->name, (int)-a->offset);
break;
case NAME_PARAM:
sprint(str, "%s+%d(FP)", s->name, (int)a->offset);
break;
}
out:
return fmtstrcpy(fp, str);
}
// Inferno utils/6c/list.c
// http://code.google.com/p/inferno-os/source/browse/utils/6c/list.c
//
// 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.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <link.h>
#include "../cmd/6l/6.out.h"
#include "../runtime/funcdata.h"
//
// Format conversions
// %A int Opcodes (instruction mnemonics)
//
// %D Addr* Addresses (instruction operands)
//
// %P Prog* Instructions
//
// %R int Registers
//
// %$ char* String constant addresses (for internal use only)
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
static int DSconv(Fmt *fp);
enum
{
STRINGSZ = 1000
};
#pragma varargck type "$" char*
void
listinit6(void)
{
fmtinstall('A', Aconv);
fmtinstall('D', Dconv);
fmtinstall('P', Pconv);
fmtinstall('R', Rconv);
// for internal use
fmtinstall('$', DSconv);
}
static Prog* bigP;
static int
Pconv(Fmt *fp)
{
char str[STRINGSZ];
Prog *p;
p = va_arg(fp->args, Prog*);
bigP = p;
switch(p->as) {
case ADATA:
sprint(str, "%.5lld (%L) %A %D/%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
case ATEXT:
if(p->from3.offset) {
sprint(str, "%.5lld (%L) %A %D,%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
break;
default:
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if((p->from.type == TYPE_REG || p->from.type == TYPE_CONST) && p->from.index != REG_NONE)
sprint(strchr(str, 0), ":%R", p->from.index);
break;
}
bigP = nil;
return fmtstrcpy(fp, str);
}
static int
Aconv(Fmt *fp)
{
int i;
i = va_arg(fp->args, int);
return fmtstrcpy(fp, anames6[i]);
}
static int
Dconv(Fmt *fp)
{
char str[STRINGSZ], s[STRINGSZ];
Addr *a;
a = va_arg(fp->args, Addr*);
switch(a->type) {
default:
sprint(str, "type=%d", a->type);
break;
case TYPE_NONE:
str[0] = 0;
break;
case TYPE_REG:
// TODO(rsc): This special case is for instructions like
// PINSRQ CX,$1,X6
// where the $1 is included in the p->to Addr.
// Move into a new field.
if(a->offset != 0) {
sprint(str, "$%lld,%R", a->offset, a->reg);
break;
}
sprint(str, "%R", a->reg);
break;
case TYPE_BRANCH:
if(a->sym != nil)
sprint(str, "%s(SB)", a->sym->name);
else if(bigP != nil && bigP->pcond != nil)
sprint(str, "%lld", bigP->pcond->pc);
else if(a->u.branch != nil)
sprint(str, "%lld", a->u.branch->pc);
else
sprint(str, "%lld(PC)", a->offset);
break;
case TYPE_MEM:
switch(a->name) {
default:
sprint(str, "name=%d", a->name);
break;
case NAME_NONE:
if(a->offset)
sprint(str, "%lld(%R)", a->offset, a->reg);
else
sprint(str, "(%R)", a->reg);
break;
case NAME_EXTERN:
sprint(str, "%s+%lld(SB)", a->sym->name, a->offset);
break;
case NAME_STATIC:
sprint(str, "%s<>+%lld(SB)", a->sym->name, a->offset);
break;
case NAME_AUTO:
if(a->sym)
sprint(str, "%s+%lld(SP)", a->sym->name, a->offset);
else
sprint(str, "%lld(SP)", a->offset);
break;
case NAME_PARAM:
if(a->sym)
sprint(str, "%s+%lld(FP)", a->sym->name, a->offset);
else
sprint(str, "%lld(FP)", a->offset);
break;
}
if(a->index != REG_NONE) {
sprint(s, "(%R*%d)", (int)a->index, (int)a->scale);
strcat(str, s);
}
break;
case TYPE_CONST:
sprint(str, "$%lld", a->offset);
break;
case TYPE_TEXTSIZE:
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%d", a->offset, a->u.argsize);
break;
case TYPE_FCONST:
sprint(str, "$(%.17g)", a->u.dval);
break;
case TYPE_SCONST:
sprint(str, "$\"%$\"", a->u.sval);
break;
case TYPE_ADDR:
a->type = TYPE_MEM;
sprint(str, "$%D", a);
a->type = TYPE_ADDR;
break;
}
return fmtstrcpy(fp, str);
}
static char* regstr[] =
{
"AL", /* [D_AL] */
"CL",
"DL",
"BL",
"SPB",
"BPB",
"SIB",
"DIB",
"R8B",
"R9B",
"R10B",
"R11B",
"R12B",
"R13B",
"R14B",
"R15B",
"AX", /* [D_AX] */
"CX",
"DX",
"BX",
"SP",
"BP",
"SI",
"DI",
"R8",
"R9",
"R10",
"R11",
"R12",
"R13",
"R14",
"R15",
"AH",
"CH",
"DH",
"BH",
"F0", /* [D_F0] */
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"M0",
"M1",
"M2",
"M3",
"M4",
"M5",
"M6",
"M7",
"X0",
"X1",
"X2",
"X3",
"X4",
"X5",
"X6",
"X7",
"X8",
"X9",
"X10",
"X11",
"X12",
"X13",
"X14",
"X15",
"CS", /* [D_CS] */
"SS",
"DS",
"ES",
"FS",
"GS",
"GDTR", /* [D_GDTR] */
"IDTR", /* [D_IDTR] */
"LDTR", /* [D_LDTR] */
"MSW", /* [D_MSW] */
"TASK", /* [D_TASK] */
"CR0", /* [D_CR] */
"CR1",
"CR2",
"CR3",
"CR4",
"CR5",
"CR6",
"CR7",
"CR8",
"CR9",
"CR10",
"CR11",
"CR12",
"CR13",
"CR14",
"CR15",
"DR0", /* [D_DR] */
"DR1",
"DR2",
"DR3",
"DR4",
"DR5",
"DR6",
"DR7",
"TR0", /* [D_TR] */
"TR1",
"TR2",
"TR3",
"TR4",
"TR5",
"TR6",
"TR7",
"TLS", /* [D_TLS] */
"MAXREG", /* [MAXREG] */
};
static int
Rconv(Fmt *fp)
{
char str[STRINGSZ];
int r;
r = va_arg(fp->args, int);
if(r == REG_NONE)
return fmtstrcpy(fp, "NONE");
if(REG_AL <= r && r-REG_AL < nelem(regstr))
sprint(str, "%s", regstr[r-REG_AL]);
else
sprint(str, "gok(%d)", r);
return fmtstrcpy(fp, str);
}
static int
DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;
a = va_arg(fp->args, char*);
p = str;
for(i=0; i<sizeof(double); i++) {
c = a[i] & 0xff;
if(c >= 'a' && c <= 'z' ||
c >= 'A' && c <= 'Z' ||
c >= '0' && c <= '9') {
*p++ = c;
continue;
}
*p++ = '\\';
switch(c) {
default:
if(c < 040 || c >= 0177)
break; /* not portable */
p[-1] = c;
continue;
case 0:
*p++ = 'z';
continue;
case '\\':
case '"':
*p++ = c;
continue;
case '\n':
*p++ = 'n';
continue;
case '\t':
*p++ = 't';
continue;
}
*p++ = (c>>6) + '0';
*p++ = ((c>>3) & 7) + '0';
*p++ = (c & 7) + '0';
}
*p = 0;
return fmtstrcpy(fp, str);
}
// Inferno utils/8c/list.c
// http://code.google.com/p/inferno-os/source/browse/utils/8c/list.c
//
// 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.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <link.h>
#include "../cmd/8l/8.out.h"
#include "../runtime/funcdata.h"
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
static int DSconv(Fmt *fp);
enum
{
STRINGSZ = 1000
};
#pragma varargck type "$" char*
void
listinit8(void)
{
fmtinstall('A', Aconv);
fmtinstall('D', Dconv);
fmtinstall('P', Pconv);
fmtinstall('R', Rconv);
// for internal use
fmtinstall('$', DSconv);
}
static Prog* bigP;
static int
Pconv(Fmt *fp)
{
char str[STRINGSZ];
Prog *p;
p = va_arg(fp->args, Prog*);
bigP = p;
switch(p->as) {
case ADATA:
sprint(str, "%.5lld (%L) %A %D/%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
case ATEXT:
if(p->from3.offset) {
sprint(str, "%.5lld (%L) %A %D,%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
break;
default:
sprint(str, "%.5lld (%L) %A %D,%D",
p->pc, p->lineno, p->as, &p->from, &p->to);
// TODO(rsc): This special case is for SHRQ $32, AX:DX, which encodes as
// SHRQ $32(DX*0), AX
// Remove.
if((p->from.type == TYPE_REG || p->from.type == TYPE_CONST) && p->from.index != 0)
sprint(strchr(str, 0), ":%R", p->from.index);
break;
}
bigP = nil;
return fmtstrcpy(fp, str);
}
static int
Aconv(Fmt *fp)
{
int i;
i = va_arg(fp->args, int);
return fmtstrcpy(fp, anames8[i]);
}
static int
Dconv(Fmt *fp)
{
char str[STRINGSZ], s[STRINGSZ];
Addr *a;
a = va_arg(fp->args, Addr*);
switch(a->type) {
default:
sprint(str, "type=%d", a->type);
break;
case TYPE_NONE:
str[0] = 0;
break;
case TYPE_REG:
// TODO(rsc): This special case is for instructions like
// PINSRQ CX,$1,X6
// where the $1 is included in the p->to Addr.
// Move into a new field.
if(a->offset != 0) {
sprint(str, "$%lld,%R", a->offset, a->reg);
break;
}
sprint(str, "%R", a->reg);
break;
case TYPE_BRANCH:
if(a->sym != nil)
sprint(str, "%s(SB)", a->sym->name);
else if(bigP != nil && bigP->pcond != nil)
sprint(str, "%lld", bigP->pcond->pc);
else if(a->u.branch != nil)
sprint(str, "%lld", a->u.branch->pc);
else
sprint(str, "%lld(PC)", a->offset);
break;
case TYPE_MEM:
switch(a->name) {
default:
sprint(str, "name=%d", a->name);
break;
case NAME_NONE:
if(a->offset)
sprint(str, "%lld(%R)", a->offset, a->reg);
else
sprint(str, "(%R)", a->reg);
break;
case NAME_EXTERN:
sprint(str, "%s+%lld(SB)", a->sym->name, a->offset);
break;
case NAME_STATIC:
sprint(str, "%s<>+%lld(SB)", a->sym->name, a->offset);
break;
case NAME_AUTO:
if(a->sym)
sprint(str, "%s+%lld(SP)", a->sym->name, a->offset);
else
sprint(str, "%lld(SP)", a->offset);
break;
case NAME_PARAM:
if(a->sym)
sprint(str, "%s+%lld(FP)", a->sym->name, a->offset);
else
sprint(str, "%lld(FP)", a->offset);
break;
}
if(a->index != REG_NONE) {
sprint(s, "(%R*%d)", (int)a->index, (int)a->scale);
strcat(str, s);
}
break;
case TYPE_CONST:
sprint(str, "$%lld", a->offset);
break;
case TYPE_TEXTSIZE:
if(a->u.argsize == ArgsSizeUnknown)
sprint(str, "$%lld", a->offset);
else
sprint(str, "$%lld-%d", a->offset, a->u.argsize);
break;
case TYPE_FCONST:
sprint(str, "$(%.17g)", a->u.dval);
break;
case TYPE_SCONST:
sprint(str, "$\"%$\"", a->u.sval);
break;
case TYPE_ADDR:
a->type = TYPE_MEM;
sprint(str, "$%D", a);
a->type = TYPE_ADDR;
break;
}
return fmtstrcpy(fp, str);
}
static char* regstr[] =
{
"AL", /* [REG_AL] */
"CL",
"DL",
"BL",
"AH",
"CH",
"DH",
"BH",
"AX", /* [REG_AX] */
"CX",
"DX",
"BX",
"SP",
"BP",
"SI",
"DI",
"F0", /* [REG_F0] */
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"CS", /* [REG_CS] */
"SS",
"DS",
"ES",
"FS",
"GS",
"GDTR", /* [REG_GDTR] */
"IDTR", /* [REG_IDTR] */
"LDTR", /* [REG_LDTR] */
"MSW", /* [REG_MSW] */
"TASK", /* [REG_TASK] */
"CR0", /* [REG_CR] */
"CR1",
"CR2",
"CR3",
"CR4",
"CR5",
"CR6",
"CR7",
"DR0", /* [REG_DR] */
"DR1",
"DR2",
"DR3",
"DR4",
"DR5",
"DR6",
"DR7",
"TR0", /* [REG_TR] */
"TR1",
"TR2",
"TR3",
"TR4",
"TR5",
"TR6",
"TR7",
"X0", /* [REG_X0] */
"X1",
"X2",
"X3",
"X4",
"X5",
"X6",
"X7",
"TLS", /* [REG_TLS] */
"MAXREG", /* [MAXREG] */
};
static int
Rconv(Fmt *fp)
{
char str[STRINGSZ];
int r;
r = va_arg(fp->args, int);
if(r == REG_NONE)
return fmtstrcpy(fp, "NONE");
if(r >= REG_AL && r-REG_AL < nelem(regstr))
sprint(str, "%s", regstr[r-REG_AL]);
else
sprint(str, "gok(%d)", r);
return fmtstrcpy(fp, str);
}
static int
DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;
a = va_arg(fp->args, char*);
p = str;
for(i=0; i<sizeof(double); i++) {
c = a[i] & 0xff;
if(c >= 'a' && c <= 'z' ||
c >= 'A' && c <= 'Z' ||
c >= '0' && c <= '9') {
*p++ = c;
continue;
}
*p++ = '\\';
switch(c) {
default:
if(c < 040 || c >= 0177)
break; /* not portable */
p[-1] = c;
continue;
case 0:
*p++ = 'z';
continue;
case '\\':
case '"':
*p++ = c;
continue;
case '\n':
*p++ = 'n';
continue;
case '\t':
*p++ = 't';
continue;
}
*p++ = (c>>6) + '0';
*p++ = ((c>>3) & 7) + '0';
*p++ = (c & 7) + '0';
}
*p = 0;
return fmtstrcpy(fp, str);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -90,16 +90,12 @@ linknew(LinkArch *arch) ...@@ -90,16 +90,12 @@ linknew(LinkArch *arch)
char *p; char *p;
char buf[1024]; char buf[1024];
linksetexp();
nuxiinit(arch); nuxiinit(arch);
ctxt = emallocz(sizeof *ctxt); ctxt = emallocz(sizeof *ctxt);
ctxt->arch = arch; ctxt->arch = arch;
ctxt->version = HistVersion; ctxt->version = HistVersion;
ctxt->goroot = getgoroot(); ctxt->goroot = getgoroot();
ctxt->goroot_final = getenv("GOROOT_FINAL");
if(ctxt->goroot_final != nil && ctxt->goroot_final[0] == '\0')
ctxt->goroot_final = nil;
p = getgoarch(); p = getgoarch();
if(strcmp(p, arch->name) != 0) if(strcmp(p, arch->name) != 0)
...@@ -116,7 +112,6 @@ linknew(LinkArch *arch) ...@@ -116,7 +112,6 @@ linknew(LinkArch *arch)
if(*p == '\\') if(*p == '\\')
*p = '/'; *p = '/';
} }
ctxt->pathname = strdup(buf);
ctxt->headtype = headtype(getgoos()); ctxt->headtype = headtype(getgoos());
if(ctxt->headtype < 0) if(ctxt->headtype < 0)
...@@ -258,14 +253,3 @@ linkrlookup(Link *ctxt, char *name, int v) ...@@ -258,14 +253,3 @@ linkrlookup(Link *ctxt, char *name, int v)
return _lookup(ctxt, name, v, 0); return _lookup(ctxt, name, v, 0);
} }
int
linksymfmt(Fmt *f)
{
LSym *s;
s = va_arg(f->args, LSym*);
if(s == nil)
return fmtstrcpy(f, "<nil>");
return fmtstrcpy(f, s->name);
}
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