2015-01-19 14:34:58 -05:00
|
|
|
// Inferno utils/6l/pass.c
|
|
|
|
// http://code.google.com/p/inferno-os/source/browse/utils/6l/pass.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.
|
|
|
|
|
|
|
|
package x86
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cmd/internal/obj"
|
|
|
|
"encoding/binary"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"math"
|
|
|
|
)
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
func canuselocaltls(ctxt *obj.Link) bool {
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Arch.Regsize == 4 {
|
|
|
|
switch ctxt.Headtype {
|
|
|
|
case obj.Hlinux,
|
|
|
|
obj.Hnacl,
|
|
|
|
obj.Hplan9,
|
|
|
|
obj.Hwindows:
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2015-01-19 14:34:58 -05:00
|
|
|
switch ctxt.Headtype {
|
|
|
|
case obj.Hplan9,
|
|
|
|
obj.Hwindows:
|
2015-02-17 22:13:49 -05:00
|
|
|
return false
|
2015-02-10 15:56:32 +13:00
|
|
|
case obj.Hlinux:
|
|
|
|
return ctxt.Flag_shared == 0
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
return true
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func progedit(ctxt *obj.Link, p *obj.Prog) {
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
// Maintain information about code generation mode.
|
|
|
|
if ctxt.Mode == 0 {
|
|
|
|
ctxt.Mode = ctxt.Arch.Regsize * 8
|
|
|
|
}
|
|
|
|
p.Mode = int8(ctxt.Mode)
|
|
|
|
|
|
|
|
switch p.As {
|
|
|
|
case AMODE:
|
|
|
|
if p.From.Type == obj.TYPE_CONST || (p.From.Type == obj.TYPE_MEM && p.From.Reg == REG_NONE) {
|
|
|
|
switch int(p.From.Offset) {
|
|
|
|
case 16, 32, 64:
|
|
|
|
ctxt.Mode = int(p.From.Offset)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
obj.Nopout(p)
|
|
|
|
}
|
|
|
|
|
2015-01-19 14:34:58 -05:00
|
|
|
// Thread-local storage references use the TLS pseudo-register.
|
|
|
|
// As a register, TLS refers to the thread-local storage base, and it
|
|
|
|
// can only be loaded into another register:
|
|
|
|
//
|
|
|
|
// MOVQ TLS, AX
|
|
|
|
//
|
|
|
|
// An offset from the thread-local storage base is written off(reg)(TLS*1).
|
|
|
|
// Semantically it is off(reg), but the (TLS*1) annotation marks this as
|
|
|
|
// indexing from the loaded TLS base. This emits a relocation so that
|
|
|
|
// if the linker needs to adjust the offset, it can. For example:
|
|
|
|
//
|
|
|
|
// MOVQ TLS, AX
|
|
|
|
// MOVQ 8(AX)(TLS*1), CX // load m into CX
|
|
|
|
//
|
|
|
|
// On systems that support direct access to the TLS memory, this
|
|
|
|
// pair of instructions can be reduced to a direct TLS memory reference:
|
|
|
|
//
|
|
|
|
// MOVQ 8(TLS), CX // load m into CX
|
|
|
|
//
|
|
|
|
// The 2-instruction and 1-instruction forms correspond roughly to
|
|
|
|
// ELF TLS initial exec mode and ELF TLS local exec mode, respectively.
|
|
|
|
//
|
|
|
|
// We applies this rewrite on systems that support the 1-instruction form.
|
|
|
|
// The decision is made using only the operating system (and probably
|
|
|
|
// the -shared flag, eventually), not the link mode. If some link modes
|
|
|
|
// on a particular operating system require the 2-instruction form,
|
|
|
|
// then all builds for that operating system will use the 2-instruction
|
|
|
|
// form, so that the link mode decision can be delayed to link time.
|
|
|
|
//
|
|
|
|
// In this way, all supported systems use identical instructions to
|
|
|
|
// access TLS, and they are rewritten appropriately first here in
|
|
|
|
// liblink and then finally using relocations in the linker.
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
if canuselocaltls(ctxt) {
|
2015-01-19 14:34:58 -05:00
|
|
|
// Reduce TLS initial exec model to TLS local exec model.
|
|
|
|
// Sequences like
|
|
|
|
// MOVQ TLS, BX
|
|
|
|
// ... off(BX)(TLS*1) ...
|
|
|
|
// become
|
|
|
|
// NOP
|
|
|
|
// ... off(TLS) ...
|
|
|
|
//
|
|
|
|
// TODO(rsc): Remove the Hsolaris special case. It exists only to
|
|
|
|
// guarantee we are producing byte-identical binaries as before this code.
|
|
|
|
// But it should be unnecessary.
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if (p.As == AMOVQ || p.As == AMOVL) && p.From.Type == obj.TYPE_REG && p.From.Reg == REG_TLS && p.To.Type == obj.TYPE_REG && REG_AX <= p.To.Reg && p.To.Reg <= REG_R15 && ctxt.Headtype != obj.Hsolaris {
|
2015-02-13 14:40:36 -05:00
|
|
|
obj.Nopout(p)
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_MEM && p.From.Index == REG_TLS && REG_AX <= p.From.Reg && p.From.Reg <= REG_R15 {
|
|
|
|
p.From.Reg = REG_TLS
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Scale = 0
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Index = REG_NONE
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.To.Type == obj.TYPE_MEM && p.To.Index == REG_TLS && REG_AX <= p.To.Reg && p.To.Reg <= REG_R15 {
|
|
|
|
p.To.Reg = REG_TLS
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Scale = 0
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Index = REG_NONE
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// As a courtesy to the C compilers, rewrite TLS local exec load as TLS initial exec load.
|
|
|
|
// The instruction
|
|
|
|
// MOVQ off(TLS), BX
|
|
|
|
// becomes the sequence
|
|
|
|
// MOVQ TLS, BX
|
|
|
|
// MOVQ off(BX)(TLS*1), BX
|
|
|
|
// This allows the C compilers to emit references to m and g using the direct off(TLS) form.
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if (p.As == AMOVQ || p.As == AMOVL) && p.From.Type == obj.TYPE_MEM && p.From.Reg == REG_TLS && p.To.Type == obj.TYPE_REG && REG_AX <= p.To.Reg && p.To.Reg <= REG_R15 {
|
2015-03-02 12:35:15 -05:00
|
|
|
q := obj.Appendp(ctxt, p)
|
2015-01-19 14:34:58 -05:00
|
|
|
q.As = p.As
|
|
|
|
q.From = p.From
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
q.From.Type = obj.TYPE_MEM
|
|
|
|
q.From.Reg = p.To.Reg
|
|
|
|
q.From.Index = REG_TLS
|
2015-01-19 14:34:58 -05:00
|
|
|
q.From.Scale = 2 // TODO: use 1
|
|
|
|
q.To = p.To
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_TLS
|
|
|
|
p.From.Index = REG_NONE
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Remove.
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hwindows && p.Mode == 64 || ctxt.Headtype == obj.Hplan9 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Scale == 1 && p.From.Index == REG_TLS {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Scale = 2
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.To.Scale == 1 && p.To.Index == REG_TLS {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Scale = 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-05 00:43:21 -05:00
|
|
|
// Rewrite 0 to $0 in 3rd argment to CMPPS etc.
|
|
|
|
// That's what the tables expect.
|
|
|
|
switch p.As {
|
|
|
|
case ACMPPD, ACMPPS, ACMPSD, ACMPSS:
|
|
|
|
if p.To.Type == obj.TYPE_MEM && p.To.Name == obj.NAME_NONE && p.To.Reg == REG_NONE && p.To.Index == REG_NONE && p.To.Sym == nil {
|
|
|
|
p.To.Type = obj.TYPE_CONST
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
// Rewrite CALL/JMP/RET to symbol as TYPE_BRANCH.
|
2015-01-19 14:34:58 -05:00
|
|
|
switch p.As {
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
case obj.ACALL, obj.AJMP, obj.ARET:
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.To.Type == obj.TYPE_MEM && (p.To.Name == obj.NAME_EXTERN || p.To.Name == obj.NAME_STATIC) && p.To.Sym != nil {
|
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-18 17:26:36 -04:00
|
|
|
// Rewrite MOVL/MOVQ $XXX(FP/SP) as LEAL/LEAQ.
|
|
|
|
if p.From.Type == obj.TYPE_ADDR && (ctxt.Arch.Thechar == '6' || p.From.Name != obj.NAME_EXTERN && p.From.Name != obj.NAME_STATIC) {
|
|
|
|
switch p.As {
|
|
|
|
case AMOVL:
|
|
|
|
p.As = ALEAL
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
case AMOVQ:
|
|
|
|
p.As = ALEAQ
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-05 00:43:21 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl && p.Mode == 64 {
|
2015-03-07 01:44:24 -05:00
|
|
|
nacladdr(ctxt, p, &p.From3)
|
2015-03-05 00:43:21 -05:00
|
|
|
nacladdr(ctxt, p, &p.From)
|
|
|
|
nacladdr(ctxt, p, &p.To)
|
2015-03-04 23:54:13 -05:00
|
|
|
}
|
|
|
|
|
2015-01-19 14:34:58 -05:00
|
|
|
// Rewrite float constants to values stored in memory.
|
|
|
|
switch p.As {
|
|
|
|
// Convert AMOVSS $(0), Xx to AXORPS Xx, Xx
|
|
|
|
case AMOVSS:
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_FCONST {
|
2015-03-16 15:54:44 -04:00
|
|
|
if p.From.Val.(float64) == 0 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.To.Type == obj.TYPE_REG && REG_X0 <= p.To.Reg && p.To.Reg <= REG_X15 {
|
|
|
|
p.As = AXORPS
|
|
|
|
p.From = p.To
|
|
|
|
break
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
|
|
|
|
case AFMOVF,
|
|
|
|
AFADDF,
|
|
|
|
AFSUBF,
|
|
|
|
AFSUBRF,
|
|
|
|
AFMULF,
|
|
|
|
AFDIVF,
|
|
|
|
AFDIVRF,
|
|
|
|
AFCOMF,
|
|
|
|
AFCOMFP,
|
|
|
|
AADDSS,
|
|
|
|
ASUBSS,
|
|
|
|
AMULSS,
|
|
|
|
ADIVSS,
|
|
|
|
ACOMISS,
|
|
|
|
AUCOMISS:
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_FCONST {
|
2015-03-16 15:54:44 -04:00
|
|
|
f32 := float32(p.From.Val.(float64))
|
2015-03-02 12:35:15 -05:00
|
|
|
i32 := math.Float32bits(f32)
|
|
|
|
literal := fmt.Sprintf("$f32.%08x", i32)
|
|
|
|
s := obj.Linklookup(ctxt, literal, 0)
|
2015-01-21 14:48:18 -05:00
|
|
|
if s.Type == 0 {
|
|
|
|
s.Type = obj.SRODATA
|
2015-01-19 14:34:58 -05:00
|
|
|
obj.Adduint32(ctxt, s, i32)
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Name = obj.NAME_EXTERN
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Sym = s
|
2015-04-18 08:14:08 +12:00
|
|
|
p.From.Sym.Local = true
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
case AMOVSD:
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
// Convert AMOVSD $(0), Xx to AXORPS Xx, Xx
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_FCONST {
|
2015-03-16 15:54:44 -04:00
|
|
|
if p.From.Val.(float64) == 0 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.To.Type == obj.TYPE_REG && REG_X0 <= p.To.Reg && p.To.Reg <= REG_X15 {
|
|
|
|
p.As = AXORPS
|
|
|
|
p.From = p.To
|
|
|
|
break
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fallthrough
|
|
|
|
|
|
|
|
case AFMOVD,
|
|
|
|
AFADDD,
|
|
|
|
AFSUBD,
|
|
|
|
AFSUBRD,
|
|
|
|
AFMULD,
|
|
|
|
AFDIVD,
|
|
|
|
AFDIVRD,
|
|
|
|
AFCOMD,
|
|
|
|
AFCOMDP,
|
|
|
|
AADDSD,
|
|
|
|
ASUBSD,
|
|
|
|
AMULSD,
|
|
|
|
ADIVSD,
|
|
|
|
ACOMISD,
|
|
|
|
AUCOMISD:
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_FCONST {
|
2015-03-16 15:54:44 -04:00
|
|
|
i64 := math.Float64bits(p.From.Val.(float64))
|
2015-03-02 12:35:15 -05:00
|
|
|
literal := fmt.Sprintf("$f64.%016x", i64)
|
|
|
|
s := obj.Linklookup(ctxt, literal, 0)
|
2015-01-21 14:48:18 -05:00
|
|
|
if s.Type == 0 {
|
|
|
|
s.Type = obj.SRODATA
|
2015-01-19 14:34:58 -05:00
|
|
|
obj.Adduint64(ctxt, s, i64)
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Name = obj.NAME_EXTERN
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Sym = s
|
2015-04-18 08:14:08 +12:00
|
|
|
p.From.Sym.Local = true
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0
|
|
|
|
}
|
|
|
|
}
|
2015-03-30 00:49:25 +00:00
|
|
|
|
2015-03-30 01:54:49 +00:00
|
|
|
if ctxt.Flag_dynlink && (p.As == obj.ADUFFCOPY || p.As == obj.ADUFFZERO) {
|
|
|
|
var sym *obj.LSym
|
|
|
|
if p.As == obj.ADUFFZERO {
|
|
|
|
sym = obj.Linklookup(ctxt, "runtime.duffzero", 0)
|
|
|
|
} else {
|
|
|
|
sym = obj.Linklookup(ctxt, "runtime.duffcopy", 0)
|
|
|
|
}
|
|
|
|
offset := p.To.Offset
|
|
|
|
p.As = AMOVQ
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Name = obj.NAME_GOTREF
|
|
|
|
p.From.Sym = sym
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_R15
|
|
|
|
p.To.Offset = 0
|
|
|
|
p.To.Sym = nil
|
|
|
|
p1 := obj.Appendp(ctxt, p)
|
|
|
|
p1.As = AADDQ
|
|
|
|
p1.From.Type = obj.TYPE_CONST
|
|
|
|
p1.From.Offset = offset
|
|
|
|
p1.To.Type = obj.TYPE_REG
|
|
|
|
p1.To.Reg = REG_R15
|
|
|
|
p2 := obj.Appendp(ctxt, p1)
|
|
|
|
p2.As = obj.ACALL
|
|
|
|
p2.To.Type = obj.TYPE_REG
|
|
|
|
p2.To.Reg = REG_R15
|
|
|
|
}
|
|
|
|
|
2015-03-30 00:49:25 +00:00
|
|
|
if ctxt.Flag_dynlink {
|
2015-04-18 08:14:08 +12:00
|
|
|
if p.As == ALEAQ && p.From.Type == obj.TYPE_MEM && p.From.Name == obj.NAME_EXTERN && !p.From.Sym.Local {
|
2015-03-30 00:49:25 +00:00
|
|
|
p.As = AMOVQ
|
|
|
|
p.From.Type = obj.TYPE_ADDR
|
|
|
|
}
|
2015-04-18 08:14:08 +12:00
|
|
|
if p.From.Type == obj.TYPE_ADDR && p.From.Name == obj.NAME_EXTERN && !p.From.Sym.Local {
|
2015-03-30 00:49:25 +00:00
|
|
|
if p.As != AMOVQ {
|
|
|
|
ctxt.Diag("do not know how to handle TYPE_ADDR in %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
if p.To.Type != obj.TYPE_REG {
|
|
|
|
ctxt.Diag("do not know how to handle LEAQ-type insn to non-register in %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Name = obj.NAME_GOTREF
|
|
|
|
if p.From.Offset != 0 {
|
|
|
|
q := obj.Appendp(ctxt, p)
|
|
|
|
q.As = AADDQ
|
|
|
|
q.From.Type = obj.TYPE_CONST
|
|
|
|
q.From.Offset = p.From.Offset
|
|
|
|
q.To = p.To
|
|
|
|
p.From.Offset = 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if p.From3.Name == obj.NAME_EXTERN {
|
|
|
|
ctxt.Diag("don't know how to handle %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
if p.To2.Name == obj.NAME_EXTERN {
|
|
|
|
ctxt.Diag("don't know how to handle %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
var source *obj.Addr
|
2015-04-18 08:14:08 +12:00
|
|
|
if p.From.Name == obj.NAME_EXTERN && !p.From.Sym.Local {
|
|
|
|
if p.To.Name == obj.NAME_EXTERN && !p.To.Sym.Local {
|
2015-03-30 00:49:25 +00:00
|
|
|
ctxt.Diag("cannot handle NAME_EXTERN on both sides in %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
source = &p.From
|
2015-04-18 08:14:08 +12:00
|
|
|
} else if p.To.Name == obj.NAME_EXTERN && !p.To.Sym.Local {
|
2015-03-30 00:49:25 +00:00
|
|
|
source = &p.To
|
|
|
|
} else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if p.As == obj.ATEXT || p.As == obj.AFUNCDATA || p.As == obj.ACALL || p.As == obj.ARET || p.As == obj.AJMP {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if source.Type != obj.TYPE_MEM {
|
|
|
|
ctxt.Diag("don't know how to handle %v with -dynlink", p)
|
|
|
|
}
|
|
|
|
p1 := obj.Appendp(ctxt, p)
|
|
|
|
p2 := obj.Appendp(ctxt, p1)
|
|
|
|
|
|
|
|
p1.As = AMOVQ
|
|
|
|
p1.From.Type = obj.TYPE_MEM
|
|
|
|
p1.From.Sym = source.Sym
|
|
|
|
p1.From.Name = obj.NAME_GOTREF
|
|
|
|
p1.To.Type = obj.TYPE_REG
|
|
|
|
p1.To.Reg = REG_R15
|
|
|
|
|
|
|
|
p2.As = p.As
|
|
|
|
p2.From = p.From
|
|
|
|
p2.To = p.To
|
|
|
|
if p.From.Name == obj.NAME_EXTERN {
|
|
|
|
p2.From.Reg = REG_R15
|
|
|
|
p2.From.Name = obj.NAME_NONE
|
|
|
|
p2.From.Sym = nil
|
|
|
|
} else if p.To.Name == obj.NAME_EXTERN {
|
|
|
|
p2.To.Reg = REG_R15
|
|
|
|
p2.To.Name = obj.NAME_NONE
|
|
|
|
p2.To.Sym = nil
|
|
|
|
} else {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
l := p.Link
|
|
|
|
l2 := p2.Link
|
|
|
|
*p = *p1
|
|
|
|
*p1 = *p2
|
|
|
|
p.Link = l
|
|
|
|
p1.Link = l2
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func nacladdr(ctxt *obj.Link, p *obj.Prog, a *obj.Addr) {
|
|
|
|
if p.As == ALEAL || p.As == ALEAQ {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a.Reg == REG_BP {
|
2015-01-19 14:34:58 -05:00
|
|
|
ctxt.Diag("invalid address: %v", p)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a.Reg == REG_TLS {
|
|
|
|
a.Reg = REG_BP
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a.Type == obj.TYPE_MEM && a.Name == obj.NAME_NONE {
|
|
|
|
switch a.Reg {
|
2015-01-19 14:34:58 -05:00
|
|
|
// all ok
|
2015-04-01 09:38:44 -07:00
|
|
|
case REG_BP, REG_SP, REG_R15:
|
2015-01-19 14:34:58 -05:00
|
|
|
break
|
|
|
|
|
|
|
|
default:
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a.Index != REG_NONE {
|
2015-01-19 14:34:58 -05:00
|
|
|
ctxt.Diag("invalid address %v", p)
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a.Index = a.Reg
|
|
|
|
if a.Index != REG_NONE {
|
2015-01-19 14:34:58 -05:00
|
|
|
a.Scale = 1
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a.Reg = REG_R15
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
2015-01-19 14:34:58 -05:00
|
|
|
if ctxt.Tlsg == nil {
|
|
|
|
ctxt.Tlsg = obj.Linklookup(ctxt, "runtime.tlsg", 0)
|
|
|
|
}
|
|
|
|
if ctxt.Symmorestack[0] == nil {
|
|
|
|
ctxt.Symmorestack[0] = obj.Linklookup(ctxt, "runtime.morestack", 0)
|
|
|
|
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
if ctxt.Headtype == obj.Hplan9 && ctxt.Plan9privates == nil {
|
|
|
|
ctxt.Plan9privates = obj.Linklookup(ctxt, "_privates", 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctxt.Cursym = cursym
|
|
|
|
|
|
|
|
if cursym.Text == nil || cursym.Text.Link == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2015-03-02 12:35:15 -05:00
|
|
|
p := cursym.Text
|
|
|
|
autoffset := int32(p.To.Offset)
|
2015-01-19 14:34:58 -05:00
|
|
|
if autoffset < 0 {
|
|
|
|
autoffset = 0
|
|
|
|
}
|
|
|
|
|
2015-03-02 12:35:15 -05:00
|
|
|
var bpsize int
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 64 && obj.Framepointer_enabled != 0 && autoffset > 0 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
// Make room for to save a base pointer. If autoffset == 0,
|
|
|
|
// this might do something special like a tail jump to
|
|
|
|
// another function, so in that case we omit this.
|
|
|
|
bpsize = ctxt.Arch.Ptrsize
|
|
|
|
|
|
|
|
autoffset += int32(bpsize)
|
|
|
|
p.To.Offset += int64(bpsize)
|
|
|
|
} else {
|
|
|
|
bpsize = 0
|
|
|
|
}
|
|
|
|
|
2015-03-16 15:54:44 -04:00
|
|
|
textarg := int64(p.To.Val.(int32))
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
cursym.Args = int32(textarg)
|
|
|
|
cursym.Locals = int32(p.To.Offset)
|
2015-01-19 14:34:58 -05:00
|
|
|
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
// TODO(rsc): Remove.
|
|
|
|
if p.Mode == 32 && cursym.Locals < 0 {
|
|
|
|
cursym.Locals = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(rsc): Remove 'p.Mode == 64 &&'.
|
|
|
|
if p.Mode == 64 && autoffset < obj.StackSmall && p.From3.Offset&obj.NOSPLIT == 0 {
|
2015-03-02 12:35:15 -05:00
|
|
|
for q := p; q != nil; q = q.Link {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if q.As == obj.ACALL {
|
2015-01-19 14:34:58 -05:00
|
|
|
goto noleaf
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if (q.As == obj.ADUFFCOPY || q.As == obj.ADUFFZERO) && autoffset >= obj.StackSmall-8 {
|
2015-01-19 14:34:58 -05:00
|
|
|
goto noleaf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From3.Offset |= obj.NOSPLIT
|
2015-01-19 14:34:58 -05:00
|
|
|
noleaf:
|
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
if p.From3.Offset&obj.NOSPLIT == 0 || (p.From3.Offset&obj.WRAPPER != 0) {
|
2015-01-19 14:34:58 -05:00
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p = load_g_cx(ctxt, p) // load g into CX
|
|
|
|
}
|
|
|
|
|
2015-03-02 14:22:05 -05:00
|
|
|
var q *obj.Prog
|
2015-02-17 22:13:49 -05:00
|
|
|
if cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
|
|
|
|
p = stacksplit(ctxt, p, autoffset, int32(textarg), cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if autoffset != 0 {
|
|
|
|
if autoffset%int32(ctxt.Arch.Regsize) != 0 {
|
|
|
|
ctxt.Diag("unaligned stack size %d", autoffset)
|
|
|
|
}
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AADJSP
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_CONST
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = int64(autoffset)
|
|
|
|
p.Spadj = autoffset
|
|
|
|
} else {
|
|
|
|
// zero-byte stack adjustment.
|
|
|
|
// Insert a fake non-zero adjustment so that stkcheck can
|
|
|
|
// recognize the end of the stack-splitting prolog.
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.ANOP
|
2015-01-19 14:34:58 -05:00
|
|
|
p.Spadj = int32(-ctxt.Arch.Ptrsize)
|
|
|
|
p = obj.Appendp(ctxt, p)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.ANOP
|
2015-01-19 14:34:58 -05:00
|
|
|
p.Spadj = int32(ctxt.Arch.Ptrsize)
|
|
|
|
}
|
|
|
|
|
|
|
|
if q != nil {
|
|
|
|
q.Pcond = p
|
|
|
|
}
|
2015-03-02 12:35:15 -05:00
|
|
|
deltasp := autoffset
|
2015-01-19 14:34:58 -05:00
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if bpsize > 0 {
|
|
|
|
// Save caller's BP
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = AMOVQ
|
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_BP
|
|
|
|
p.To.Type = obj.TYPE_MEM
|
|
|
|
p.To.Reg = REG_SP
|
|
|
|
p.To.Scale = 1
|
|
|
|
p.To.Offset = int64(autoffset) - int64(bpsize)
|
|
|
|
|
|
|
|
// Move current frame to BP
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = ALEAQ
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_SP
|
|
|
|
p.From.Scale = 1
|
|
|
|
p.From.Offset = int64(autoffset) - int64(bpsize)
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_BP
|
|
|
|
}
|
|
|
|
|
|
|
|
if cursym.Text.From3.Offset&obj.WRAPPER != 0 {
|
2015-01-19 14:34:58 -05:00
|
|
|
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
|
|
|
|
//
|
|
|
|
// MOVQ g_panic(CX), BX
|
|
|
|
// TESTQ BX, BX
|
|
|
|
// JEQ end
|
|
|
|
// LEAQ (autoffset+8)(SP), DI
|
|
|
|
// CMPQ panic_argp(BX), DI
|
|
|
|
// JNE end
|
|
|
|
// MOVQ SP, panic_argp(BX)
|
|
|
|
// end:
|
|
|
|
// NOP
|
|
|
|
//
|
|
|
|
// The NOP is needed to give the jumps somewhere to land.
|
|
|
|
// It is a liblink NOP, not an x86 NOP: it encodes to 0 instruction bytes.
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = AMOVQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_CX
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 4 * int64(ctxt.Arch.Ptrsize) // G.panic
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_BX
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl && p.Mode == 64 {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = AMOVL
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_R15
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Scale = 1
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Index = REG_CX
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = ATESTQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_BX
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_BX
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl || p.Mode == 32 {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = ATESTL
|
|
|
|
}
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AJEQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-03-02 12:35:15 -05:00
|
|
|
p1 := p
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = ALEAQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_SP
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
p.From.Offset = int64(autoffset) + int64(ctxt.Arch.Regsize)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_DI
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl || p.Mode == 32 {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = ALEAL
|
|
|
|
}
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = ACMPQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_BX
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0 // Panic.argp
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_DI
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl && p.Mode == 64 {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = ACMPL
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_R15
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Scale = 1
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Index = REG_BX
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = ACMPL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AJNE
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-03-02 12:35:15 -05:00
|
|
|
p2 := p
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AMOVQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_SP
|
|
|
|
p.To.Type = obj.TYPE_MEM
|
|
|
|
p.To.Reg = REG_BX
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset = 0 // Panic.argp
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl && p.Mode == 64 {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = AMOVL
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_MEM
|
|
|
|
p.To.Reg = REG_R15
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Scale = 1
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Index = REG_BX
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.ANOP
|
2015-01-19 14:34:58 -05:00
|
|
|
p1.Pcond = p
|
|
|
|
p2.Pcond = p
|
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
if ctxt.Debugzerostack != 0 && autoffset != 0 && cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
|
2015-01-19 14:34:58 -05:00
|
|
|
// 6l -Z means zero the stack frame on entry.
|
|
|
|
// This slows down function calls but can help avoid
|
|
|
|
// false positives in garbage collection.
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = AMOVQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_SP
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_DI
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AMOVQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_CONST
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
p.From.Offset = int64(autoffset) / int64(ctxt.Arch.Regsize)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_CX
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AMOVQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_CONST
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_AX
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AREP
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = ASTOSQ
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.As = ASTOSL
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-03-02 12:35:15 -05:00
|
|
|
var a int
|
|
|
|
var pcsize int
|
2015-01-19 14:34:58 -05:00
|
|
|
for ; p != nil; p = p.Link {
|
|
|
|
pcsize = int(p.Mode) / 8
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a = int(p.From.Name)
|
|
|
|
if a == obj.NAME_AUTO {
|
|
|
|
p.From.Offset += int64(deltasp) - int64(bpsize)
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a == obj.NAME_PARAM {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset += int64(deltasp) + int64(pcsize)
|
|
|
|
}
|
2015-03-05 00:50:38 -05:00
|
|
|
a = int(p.From3.Name)
|
|
|
|
if a == obj.NAME_AUTO {
|
|
|
|
p.From3.Offset += int64(deltasp) - int64(bpsize)
|
|
|
|
}
|
|
|
|
if a == obj.NAME_PARAM {
|
|
|
|
p.From3.Offset += int64(deltasp) + int64(pcsize)
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a = int(p.To.Name)
|
|
|
|
if a == obj.NAME_AUTO {
|
|
|
|
p.To.Offset += int64(deltasp) - int64(bpsize)
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a == obj.NAME_PARAM {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset += int64(deltasp) + int64(pcsize)
|
|
|
|
}
|
|
|
|
|
|
|
|
switch p.As {
|
|
|
|
default:
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APUSHL, APUSHFL:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp += 4
|
|
|
|
p.Spadj = 4
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APUSHQ, APUSHFQ:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp += 8
|
|
|
|
p.Spadj = 8
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APUSHW, APUSHFW:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp += 2
|
|
|
|
p.Spadj = 2
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APOPL, APOPFL:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp -= 4
|
|
|
|
p.Spadj = -4
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APOPQ, APOPFQ:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp -= 8
|
|
|
|
p.Spadj = -8
|
|
|
|
continue
|
|
|
|
|
2015-04-01 09:38:44 -07:00
|
|
|
case APOPW, APOPFW:
|
2015-01-19 14:34:58 -05:00
|
|
|
deltasp -= 2
|
|
|
|
p.Spadj = -2
|
|
|
|
continue
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
case obj.ARET:
|
2015-01-19 14:34:58 -05:00
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
if autoffset != deltasp {
|
|
|
|
ctxt.Diag("unbalanced PUSH/POP")
|
|
|
|
}
|
|
|
|
|
|
|
|
if autoffset != 0 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if bpsize > 0 {
|
|
|
|
// Restore caller's BP
|
|
|
|
p.As = AMOVQ
|
|
|
|
|
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_SP
|
|
|
|
p.From.Scale = 1
|
|
|
|
p.From.Offset = int64(autoffset) - int64(bpsize)
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_BP
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
}
|
|
|
|
|
2015-01-19 14:34:58 -05:00
|
|
|
p.As = AADJSP
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_CONST
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = int64(-autoffset)
|
|
|
|
p.Spadj = -autoffset
|
|
|
|
p = obj.Appendp(ctxt, p)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.ARET
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
// If there are instructions following
|
|
|
|
// this ARET, they come from a branch
|
|
|
|
// with the same stackframe, so undo
|
|
|
|
// the cleanup.
|
|
|
|
p.Spadj = +autoffset
|
|
|
|
}
|
|
|
|
|
|
|
|
if p.To.Sym != nil { // retjmp
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.AJMP
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
func indir_cx(ctxt *obj.Link, p *obj.Prog, a *obj.Addr) {
|
|
|
|
if ctxt.Headtype == obj.Hnacl && p.Mode == 64 {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a.Type = obj.TYPE_MEM
|
|
|
|
a.Reg = REG_R15
|
|
|
|
a.Index = REG_CX
|
2015-01-19 14:34:58 -05:00
|
|
|
a.Scale = 1
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
a.Type = obj.TYPE_MEM
|
|
|
|
a.Reg = REG_CX
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Append code to p to load g into cx.
|
|
|
|
// Overwrites p with the first instruction (no first appendp).
|
|
|
|
// Overwriting p is unusual but it lets use this in both the
|
|
|
|
// prologue (caller must call appendp first) and in the epilogue.
|
|
|
|
// Returns last new instruction.
|
|
|
|
func load_g_cx(ctxt *obj.Link, p *obj.Prog) *obj.Prog {
|
|
|
|
p.As = AMOVQ
|
|
|
|
if ctxt.Arch.Ptrsize == 4 {
|
|
|
|
p.As = AMOVL
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_TLS
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 0
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_CX
|
2015-01-19 14:34:58 -05:00
|
|
|
|
2015-03-02 12:35:15 -05:00
|
|
|
next := p.Link
|
2015-01-19 14:34:58 -05:00
|
|
|
progedit(ctxt, p)
|
|
|
|
for p.Link != next {
|
|
|
|
p = p.Link
|
|
|
|
}
|
|
|
|
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Index == REG_TLS {
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Scale = 2
|
|
|
|
}
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append code to p to check for stack split.
|
|
|
|
// Appends to (does not overwrite) p.
|
|
|
|
// Assumes g is in CX.
|
|
|
|
// Returns last new instruction.
|
|
|
|
// On return, *jmpok is the instruction that should jump
|
|
|
|
// to the stack frame allocation if no split is needed.
|
2015-02-17 22:13:49 -05:00
|
|
|
func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, textarg int32, noctxt bool, jmpok **obj.Prog) *obj.Prog {
|
2015-03-02 12:35:15 -05:00
|
|
|
cmp := ACMPQ
|
|
|
|
lea := ALEAQ
|
|
|
|
mov := AMOVQ
|
|
|
|
sub := ASUBQ
|
2015-01-19 14:34:58 -05:00
|
|
|
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if ctxt.Headtype == obj.Hnacl || p.Mode == 32 {
|
2015-01-19 14:34:58 -05:00
|
|
|
cmp = ACMPL
|
|
|
|
lea = ALEAL
|
|
|
|
mov = AMOVL
|
|
|
|
sub = ASUBL
|
|
|
|
}
|
|
|
|
|
2015-03-02 14:22:05 -05:00
|
|
|
var q1 *obj.Prog
|
2015-01-19 14:34:58 -05:00
|
|
|
if framesize <= obj.StackSmall {
|
|
|
|
// small stack: SP <= stackguard
|
|
|
|
// CMPQ SP, stackguard
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = int16(cmp)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_SP
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
indir_cx(ctxt, p, &p.To)
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
|
|
|
|
if ctxt.Cursym.Cfunc != 0 {
|
|
|
|
p.To.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
|
|
|
|
}
|
|
|
|
} else if framesize <= obj.StackBig {
|
|
|
|
// large stack: SP-framesize <= stackguard-StackSmall
|
|
|
|
// LEAQ -xxx(SP), AX
|
|
|
|
// CMPQ AX, stackguard
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = int16(lea)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_SP
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = -(int64(framesize) - obj.StackSmall)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_AX
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = int16(cmp)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_AX
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
indir_cx(ctxt, p, &p.To)
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
|
|
|
|
if ctxt.Cursym.Cfunc != 0 {
|
|
|
|
p.To.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Such a large stack we need to protect against wraparound.
|
|
|
|
// If SP is close to zero:
|
|
|
|
// SP-stackguard+StackGuard <= framesize + (StackGuard-StackSmall)
|
|
|
|
// The +StackGuard on both sides is required to keep the left side positive:
|
|
|
|
// SP is allowed to be slightly below stackguard. See stack.h.
|
|
|
|
//
|
|
|
|
// Preemption sets stackguard to StackPreempt, a very large value.
|
|
|
|
// That breaks the math above, so we have to check for that explicitly.
|
|
|
|
// MOVQ stackguard, CX
|
|
|
|
// CMPQ CX, $StackPreempt
|
|
|
|
// JEQ label-of-call-to-morestack
|
|
|
|
// LEAQ StackGuard(SP), AX
|
|
|
|
// SUBQ CX, AX
|
|
|
|
// CMPQ AX, $(framesize+(StackGuard-StackSmall))
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = int16(mov)
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
indir_cx(ctxt, p, &p.From)
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
|
|
|
|
if ctxt.Cursym.Cfunc != 0 {
|
|
|
|
p.From.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_SI
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = int16(cmp)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_SI
|
|
|
|
p.To.Type = obj.TYPE_CONST
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset = obj.StackPreempt
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
if p.Mode == 32 {
|
|
|
|
p.To.Offset = int64(uint32(obj.StackPreempt & (1<<32 - 1)))
|
|
|
|
}
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = AJEQ
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-01-19 14:34:58 -05:00
|
|
|
q1 = p
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = int16(lea)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_MEM
|
|
|
|
p.From.Reg = REG_SP
|
2015-01-19 14:34:58 -05:00
|
|
|
p.From.Offset = obj.StackGuard
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_AX
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = int16(sub)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_SI
|
|
|
|
p.To.Type = obj.TYPE_REG
|
|
|
|
p.To.Reg = REG_AX
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
p.As = int16(cmp)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.From.Type = obj.TYPE_REG
|
|
|
|
p.From.Reg = REG_AX
|
|
|
|
p.To.Type = obj.TYPE_CONST
|
2015-01-19 14:34:58 -05:00
|
|
|
p.To.Offset = int64(framesize) + (obj.StackGuard - obj.StackSmall)
|
|
|
|
}
|
|
|
|
|
|
|
|
// common
|
|
|
|
p = obj.Appendp(ctxt, p)
|
|
|
|
|
|
|
|
p.As = AJHI
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-03-02 12:35:15 -05:00
|
|
|
q := p
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.ACALL
|
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-01-19 14:34:58 -05:00
|
|
|
if ctxt.Cursym.Cfunc != 0 {
|
|
|
|
p.To.Sym = obj.Linklookup(ctxt, "runtime.morestackc", 0)
|
|
|
|
} else {
|
2015-04-22 12:41:14 +12:00
|
|
|
p.To.Sym = ctxt.Symmorestack[obj.Bool2int(noctxt)]
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
p = obj.Appendp(ctxt, p)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
p.As = obj.AJMP
|
|
|
|
p.To.Type = obj.TYPE_BRANCH
|
2015-01-19 14:34:58 -05:00
|
|
|
p.Pcond = ctxt.Cursym.Text.Link
|
|
|
|
|
|
|
|
if q != nil {
|
|
|
|
q.Pcond = p.Link
|
|
|
|
}
|
|
|
|
if q1 != nil {
|
|
|
|
q1.Pcond = q.Link
|
|
|
|
}
|
|
|
|
|
|
|
|
*jmpok = q
|
|
|
|
return p
|
|
|
|
}
|
|
|
|
|
|
|
|
func follow(ctxt *obj.Link, s *obj.LSym) {
|
|
|
|
ctxt.Cursym = s
|
|
|
|
|
2015-03-02 12:35:15 -05:00
|
|
|
firstp := ctxt.NewProg()
|
|
|
|
lastp := firstp
|
2015-01-19 14:34:58 -05:00
|
|
|
xfol(ctxt, s.Text, &lastp)
|
|
|
|
lastp.Link = nil
|
|
|
|
s.Text = firstp.Link
|
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
func nofollow(a int) bool {
|
2015-01-19 14:34:58 -05:00
|
|
|
switch a {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
case obj.AJMP,
|
|
|
|
obj.ARET,
|
2015-01-19 14:34:58 -05:00
|
|
|
AIRETL,
|
|
|
|
AIRETQ,
|
|
|
|
AIRETW,
|
|
|
|
ARETFL,
|
|
|
|
ARETFQ,
|
|
|
|
ARETFW,
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
obj.AUNDEF:
|
2015-02-17 22:13:49 -05:00
|
|
|
return true
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
return false
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
func pushpop(a int) bool {
|
2015-01-19 14:34:58 -05:00
|
|
|
switch a {
|
|
|
|
case APUSHL,
|
|
|
|
APUSHFL,
|
|
|
|
APUSHQ,
|
|
|
|
APUSHFQ,
|
|
|
|
APUSHW,
|
|
|
|
APUSHFW,
|
|
|
|
APOPL,
|
|
|
|
APOPFL,
|
|
|
|
APOPQ,
|
|
|
|
APOPFQ,
|
|
|
|
APOPW,
|
|
|
|
APOPFW:
|
2015-02-17 22:13:49 -05:00
|
|
|
return true
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
return false
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
2015-03-02 20:17:20 -08:00
|
|
|
func relinv(a int16) int16 {
|
2015-01-19 14:34:58 -05:00
|
|
|
switch a {
|
|
|
|
case AJEQ:
|
|
|
|
return AJNE
|
|
|
|
case AJNE:
|
|
|
|
return AJEQ
|
|
|
|
case AJLE:
|
|
|
|
return AJGT
|
|
|
|
case AJLS:
|
|
|
|
return AJHI
|
|
|
|
case AJLT:
|
|
|
|
return AJGE
|
|
|
|
case AJMI:
|
|
|
|
return AJPL
|
|
|
|
case AJGE:
|
|
|
|
return AJLT
|
|
|
|
case AJPL:
|
|
|
|
return AJMI
|
|
|
|
case AJGT:
|
|
|
|
return AJLE
|
|
|
|
case AJHI:
|
|
|
|
return AJLS
|
|
|
|
case AJCS:
|
|
|
|
return AJCC
|
|
|
|
case AJCC:
|
|
|
|
return AJCS
|
|
|
|
case AJPS:
|
|
|
|
return AJPC
|
|
|
|
case AJPC:
|
|
|
|
return AJPS
|
|
|
|
case AJOS:
|
|
|
|
return AJOC
|
|
|
|
case AJOC:
|
|
|
|
return AJOS
|
|
|
|
}
|
|
|
|
|
2015-03-02 20:17:20 -08:00
|
|
|
log.Fatalf("unknown relation: %s", obj.Aconv(int(a)))
|
2015-01-19 14:34:58 -05:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
func xfol(ctxt *obj.Link, p *obj.Prog, last **obj.Prog) {
|
|
|
|
var q *obj.Prog
|
|
|
|
var i int
|
|
|
|
var a int
|
|
|
|
|
|
|
|
loop:
|
|
|
|
if p == nil {
|
|
|
|
return
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.As == obj.AJMP {
|
2015-01-19 14:34:58 -05:00
|
|
|
q = p.Pcond
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if q != nil && q.As != obj.ATEXT {
|
2015-01-19 14:34:58 -05:00
|
|
|
/* mark instruction as done and continue layout at target of jump */
|
|
|
|
p.Mark = 1
|
|
|
|
|
|
|
|
p = q
|
|
|
|
if p.Mark == 0 {
|
|
|
|
goto loop
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if p.Mark != 0 {
|
|
|
|
/*
|
|
|
|
* p goes here, but already used it elsewhere.
|
|
|
|
* copy up to 4 instructions or else branch to other copy.
|
|
|
|
*/
|
|
|
|
i = 0
|
|
|
|
q = p
|
2015-03-09 00:31:13 -04:00
|
|
|
for ; i < 4; i, q = i+1, q.Link {
|
2015-01-19 14:34:58 -05:00
|
|
|
if q == nil {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if q == *last {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
a = int(q.As)
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a == obj.ANOP {
|
2015-01-19 14:34:58 -05:00
|
|
|
i--
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2015-02-17 22:13:49 -05:00
|
|
|
if nofollow(a) || pushpop(a) {
|
2015-01-19 14:34:58 -05:00
|
|
|
break // NOTE(rsc): arm does goto copy
|
|
|
|
}
|
|
|
|
if q.Pcond == nil || q.Pcond.Mark != 0 {
|
|
|
|
continue
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if a == obj.ACALL || a == ALOOP {
|
2015-01-19 14:34:58 -05:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
for {
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.As == obj.ANOP {
|
2015-01-19 14:34:58 -05:00
|
|
|
p = p.Link
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
q = obj.Copyp(ctxt, p)
|
|
|
|
p = p.Link
|
|
|
|
q.Mark = 1
|
|
|
|
(*last).Link = q
|
|
|
|
*last = q
|
|
|
|
if int(q.As) != a || q.Pcond == nil || q.Pcond.Mark != 0 {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2015-03-02 20:17:20 -08:00
|
|
|
q.As = relinv(q.As)
|
2015-01-19 14:34:58 -05:00
|
|
|
p = q.Pcond
|
|
|
|
q.Pcond = q.Link
|
|
|
|
q.Link = p
|
|
|
|
xfol(ctxt, q.Link, last)
|
|
|
|
p = q.Link
|
|
|
|
if p.Mark != 0 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
goto loop
|
|
|
|
/* */
|
|
|
|
}
|
|
|
|
}
|
2015-02-17 22:13:49 -05:00
|
|
|
q = ctxt.NewProg()
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
q.As = obj.AJMP
|
2015-01-19 14:34:58 -05:00
|
|
|
q.Lineno = p.Lineno
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
q.To.Type = obj.TYPE_BRANCH
|
2015-01-19 14:34:58 -05:00
|
|
|
q.To.Offset = p.Pc
|
|
|
|
q.Pcond = p
|
|
|
|
p = q
|
|
|
|
}
|
|
|
|
|
|
|
|
/* emit p */
|
|
|
|
p.Mark = 1
|
|
|
|
|
|
|
|
(*last).Link = p
|
|
|
|
*last = p
|
|
|
|
a = int(p.As)
|
|
|
|
|
|
|
|
/* continue loop with what comes after p */
|
2015-02-17 22:13:49 -05:00
|
|
|
if nofollow(a) {
|
2015-01-19 14:34:58 -05:00
|
|
|
return
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.Pcond != nil && a != obj.ACALL {
|
2015-01-19 14:34:58 -05:00
|
|
|
/*
|
|
|
|
* some kind of conditional branch.
|
|
|
|
* recurse to follow one path.
|
|
|
|
* continue loop on the other.
|
|
|
|
*/
|
|
|
|
q = obj.Brchain(ctxt, p.Pcond)
|
|
|
|
if q != nil {
|
|
|
|
p.Pcond = q
|
|
|
|
}
|
|
|
|
q = obj.Brchain(ctxt, p.Link)
|
|
|
|
if q != nil {
|
|
|
|
p.Link = q
|
|
|
|
}
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
if p.From.Type == obj.TYPE_CONST {
|
2015-01-19 14:34:58 -05:00
|
|
|
if p.From.Offset == 1 {
|
|
|
|
/*
|
|
|
|
* expect conditional jump to be taken.
|
|
|
|
* rewrite so that's the fall-through case.
|
|
|
|
*/
|
2015-03-02 20:17:20 -08:00
|
|
|
p.As = relinv(int16(a))
|
2015-01-19 14:34:58 -05:00
|
|
|
|
|
|
|
q = p.Link
|
|
|
|
p.Link = p.Pcond
|
|
|
|
p.Pcond = q
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
q = p.Link
|
|
|
|
if q.Mark != 0 {
|
|
|
|
if a != ALOOP {
|
2015-03-02 20:17:20 -08:00
|
|
|
p.As = relinv(int16(a))
|
2015-01-19 14:34:58 -05:00
|
|
|
p.Link = p.Pcond
|
|
|
|
p.Pcond = q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
xfol(ctxt, p.Link, last)
|
|
|
|
if p.Pcond.Mark != 0 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
p = p.Pcond
|
|
|
|
goto loop
|
|
|
|
}
|
|
|
|
|
|
|
|
p = p.Link
|
|
|
|
goto loop
|
|
|
|
}
|
|
|
|
|
2015-03-02 11:04:06 -08:00
|
|
|
var unaryDst = map[int]bool{
|
|
|
|
ABSWAPL: true,
|
|
|
|
ABSWAPQ: true,
|
|
|
|
ACMPXCHG8B: true,
|
|
|
|
ADECB: true,
|
|
|
|
ADECL: true,
|
|
|
|
ADECQ: true,
|
|
|
|
ADECW: true,
|
|
|
|
AINCB: true,
|
|
|
|
AINCL: true,
|
|
|
|
AINCQ: true,
|
|
|
|
AINCW: true,
|
|
|
|
ANEGB: true,
|
|
|
|
ANEGL: true,
|
|
|
|
ANEGQ: true,
|
|
|
|
ANEGW: true,
|
|
|
|
ANOTB: true,
|
|
|
|
ANOTL: true,
|
|
|
|
ANOTQ: true,
|
|
|
|
ANOTW: true,
|
|
|
|
APOPL: true,
|
|
|
|
APOPQ: true,
|
|
|
|
APOPW: true,
|
|
|
|
ASETCC: true,
|
|
|
|
ASETCS: true,
|
|
|
|
ASETEQ: true,
|
|
|
|
ASETGE: true,
|
|
|
|
ASETGT: true,
|
|
|
|
ASETHI: true,
|
|
|
|
ASETLE: true,
|
|
|
|
ASETLS: true,
|
|
|
|
ASETLT: true,
|
|
|
|
ASETMI: true,
|
|
|
|
ASETNE: true,
|
|
|
|
ASETOC: true,
|
|
|
|
ASETOS: true,
|
|
|
|
ASETPC: true,
|
|
|
|
ASETPL: true,
|
|
|
|
ASETPS: true,
|
|
|
|
AFFREE: true,
|
|
|
|
AFLDENV: true,
|
|
|
|
AFSAVE: true,
|
|
|
|
AFSTCW: true,
|
|
|
|
AFSTENV: true,
|
|
|
|
AFSTSW: true,
|
|
|
|
AFXSAVE: true,
|
|
|
|
AFXSAVE64: true,
|
|
|
|
ASTMXCSR: true,
|
|
|
|
}
|
|
|
|
|
2015-01-19 14:34:58 -05:00
|
|
|
var Linkamd64 = obj.LinkArch{
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
ByteOrder: binary.LittleEndian,
|
|
|
|
Name: "amd64",
|
|
|
|
Thechar: '6',
|
|
|
|
Preprocess: preprocess,
|
|
|
|
Assemble: span6,
|
|
|
|
Follow: follow,
|
|
|
|
Progedit: progedit,
|
2015-03-02 11:04:06 -08:00
|
|
|
UnaryDst: unaryDst,
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
Minlc: 1,
|
|
|
|
Ptrsize: 8,
|
|
|
|
Regsize: 8,
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
var Linkamd64p32 = obj.LinkArch{
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
ByteOrder: binary.LittleEndian,
|
|
|
|
Name: "amd64p32",
|
|
|
|
Thechar: '6',
|
|
|
|
Preprocess: preprocess,
|
|
|
|
Assemble: span6,
|
|
|
|
Follow: follow,
|
|
|
|
Progedit: progedit,
|
2015-03-02 11:04:06 -08:00
|
|
|
UnaryDst: unaryDst,
|
[dev.cc] cmd/internal/obj: reconvert from liblink
cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256.
- Brings in new, more regular Prog, Addr definitions
- Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion.
- Update objwriter for change in TEXT size encoding.
- Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand).
- Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm.
They need to be updated for the changes.
- Reenable verifyAsm in cmd/go.
- Reenable GOOBJ=2 mode by default in liblink.
All architectures build successfully again.
Change-Id: I2c845c5d365aa484b570476898171bee657b626d
Reviewed-on: https://go-review.googlesource.com/3963
Reviewed-by: Rob Pike <r@golang.org>
2015-02-05 03:57:44 -05:00
|
|
|
Minlc: 1,
|
|
|
|
Ptrsize: 4,
|
|
|
|
Regsize: 8,
|
2015-01-19 14:34:58 -05:00
|
|
|
}
|
cmd/internal/obj/x86: take over i386 duty, clean up PINSRQ, CMPSD
Make cmd/internal/obj/x86 support 32-bit mode and use
instead of cmd/internal/obj/i386. Delete cmd/internal/obj/i386.
Clean up encoding of PINSRQ, CMPSD to use explicit third arg
instead of jamming it into an unused slot of a different arg.
Also fix bug in old6a, which declared the wrong grammar.
The accepted (and encoded) arguments to CMPSD etc are mem,reg not reg,mem.
Code that did try to use mem,reg before would be rejected by liblink,
so only reg,reg ever worked, so existing code is not affected.
After this change, code can use mem,reg successfully.
The real bug here is that the encoding tables inverted the argument
order, making the comparisons all backward from what they say on the page.
It's too late to swap them, though: people have already written code that
expects the inverted comparisons (like in package math, and likely externally).
The best we can do is make the argument that should and can take a
memory operand accept it.
Bit-for-bit compatibility checked against tree without this CL.
Change-Id: Ife5685bc98c95001f64407f35066b34b4dae11c1
Reviewed-on: https://go-review.googlesource.com/6810
Reviewed-by: Rob Pike <r@golang.org>
2015-03-04 15:46:52 -05:00
|
|
|
|
|
|
|
var Link386 = obj.LinkArch{
|
|
|
|
ByteOrder: binary.LittleEndian,
|
|
|
|
Name: "386",
|
|
|
|
Thechar: '8',
|
|
|
|
Preprocess: preprocess,
|
|
|
|
Assemble: span6,
|
|
|
|
Follow: follow,
|
|
|
|
Progedit: progedit,
|
|
|
|
UnaryDst: unaryDst,
|
|
|
|
Minlc: 1,
|
|
|
|
Ptrsize: 4,
|
|
|
|
Regsize: 4,
|
|
|
|
}
|