Skip to content

Commit

Permalink
liblinkm cmd/internal/obj: disable moves that use C_BITCON
Browse files Browse the repository at this point in the history
Just awful.

Updates golang#6
Updates golang#68
Fixes golang#67
  • Loading branch information
4ad committed Jan 29, 2015
1 parent 40b6137 commit abbabf9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/cmd/internal/obj/arm64/asm7.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ var optab = []Optab{

// { AMOVW, C_ADDCON, C_NONE, C_REG, 2, 4, 0 },
// { AMOV, C_ADDCON, C_NONE, C_REG, 2, 4, 0 },
Optab{AMOVW, C_BITCON, C_NONE, C_REG, 53, 4, 0, 0},
Optab{AMOV, C_BITCON, C_NONE, C_REG, 53, 4, 0, 0},
// { AMOVW, C_BITCON, C_NONE, C_REG, 53, 4, 0 },
// { AMOV, C_BITCON, C_NONE, C_REG, 53, 4, 0 },

Optab{AMOVK, C_VCON, C_NONE, C_REG, 33, 4, 0, 0},
Optab{AMOV, C_AECON, C_NONE, C_REG, 4, 4, REGSB, 0},
Optab{AMOV, C_AACON, C_NONE, C_REG, 4, 4, REGSP, 0},
Expand Down Expand Up @@ -825,6 +826,11 @@ func addpool(ctxt *obj.Link, p *obj.Prog, a *obj.Addr) {
/* This is here because MOV uint12<<12, R is disabled in optab.
Because of this, we need to load the constant from memory. */
C_ADDCON,

/* These are here because they are disabled in optab.
Because of this, we need to load the constant from memory. */
C_BITCON,
C_ABCON,
C_PSAUTO,
C_PPAUTO,
C_UAUTO4K,
Expand Down Expand Up @@ -1934,6 +1940,9 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
o3 = 0
o4 = 0
o5 = 0
if false { /*debug['P']*/
fmt.Printf("%x: %v\ttype %d\n", uint32(p.Pc), p, o.type_)
}
switch o.type_ {
default:
ctxt.Diag("unknown asm %d", o.type_)
Expand Down
10 changes: 8 additions & 2 deletions src/liblink/asm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ static Optab optab[] = {
{ AMOV, C_MOVCON, C_NONE, C_REG, 32, 4, 0 },
// { AMOVW, C_ADDCON, C_NONE, C_REG, 2, 4, 0 },
// { AMOV, C_ADDCON, C_NONE, C_REG, 2, 4, 0 },
{ AMOVW, C_BITCON, C_NONE, C_REG, 53, 4, 0 },
{ AMOV, C_BITCON, C_NONE, C_REG, 53, 4, 0 },
// { AMOVW, C_BITCON, C_NONE, C_REG, 53, 4, 0 },
// { AMOV, C_BITCON, C_NONE, C_REG, 53, 4, 0 },

{ AMOVK, C_VCON, C_NONE, C_REG, 33, 4, 0 },

Expand Down Expand Up @@ -919,6 +919,11 @@ addpool(Link *ctxt, Prog *p, Addr *a)
Because of this, we need to load the constant from memory. */
case C_ADDCON:

/* These are here because they are disabled in optab.
Because of this, we need to load the constant from memory. */
case C_BITCON:
case C_ABCON:

case C_PSAUTO:
case C_PPAUTO:
case C_UAUTO4K:
Expand Down Expand Up @@ -1886,6 +1891,7 @@ asmout(Link *ctxt, Prog *p, Optab *o, uint32 *out)
o3 = 0;
o4 = 0;
o5 = 0;
if(0 /*debug['P']*/) print("%ux: %P type %d\n", (uint32)(p->pc), p, o->type);
switch(o->type) {
default:
ctxt->diag("unknown asm %d", o->type);
Expand Down

0 comments on commit abbabf9

Please sign in to comment.