aboutsummaryrefslogtreecommitdiff
path: root/src/liblink
AgeCommit message (Collapse)Author
2015-03-01all: delete C libraries and cmd/dist code that builds themRuss Cox
Change-Id: Ic66243674ac1dbf829c7523005e33611cc89ac83 Reviewed-on: https://go-review.googlesource.com/6362 Reviewed-by: Rob Pike <r@golang.org>
2015-03-01cmd/ld: clean for c2goRuss Cox
Change-Id: Iaab2be9a1919f2fa9dbc61a5b7fbf99bcd0712a9 Reviewed-on: https://go-review.googlesource.com/6332 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Minux Ma <minux@golang.org>
2015-02-26liblink: delete unused codeRuss Cox
Liblink is still needed for the linker (for a bit longer) but mostly not. Delete the unused parts. Change-Id: Ie63a7c1520dee52b17425b384943cd16262d36e3 Reviewed-on: https://go-review.googlesource.com/6110 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-13[dev.cc] liblink: disable GOOBJ=2 defaultRuss Cox
The point of GOOBJ=2 was to have an active test of the cmd/internal/obj code. Now we have end-to-end tests of the assembler, and soon the compiler, so we don't need this halfway test on by default anymore. (It's still possible to enable during debugging with the environment variable.) The problem it causes on the builders is that this particular testing mode ends up with both the C process and the Go objwriter subprocess having the same very large Prog list in memory simultaneously, which causes basically a 2x memory blowup. In large programs (such as the one generated by test/rotate.go) this is significant. Disabling GOOBJ=2 should help with the current dev.cc builder failures. Change-Id: I1b11e4f29ea575659f02d2234242a904f7c867e4 Reviewed-on: https://go-review.googlesource.com/4832 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-13[dev.cc] all: merge master (5f1efe7) into dev.ccRuss Cox
Conflicts: src/cmd/dist/build.go Change-Id: I98a4b5e010bee91507b85bb8efd9c74e1a1f649c
2015-02-12[dev.cc] liblink, cmd/internal/obj: fix printing of TYPE_REGREG and TYPE_REGREG2Russ Cox
Now: 0x0000 00000 (/tmp/x.s:2) MULLU R6,R3,(R7, R6) The space is a little odd but I'd rather fix the usual printing to add spaces than delete that one. But in a different CL, once C is gone. Change-Id: I344e0b06eedaaf53cd79d370fa13c444a1e69c81 Reviewed-on: https://go-review.googlesource.com/4647 Reviewed-by: Rob Pike <r@golang.org>
2015-02-11cmd/gc: factor newly-portable code into gc directoryRuss Cox
This isn't everything, but it's a start. Still producing bit-identical compiler output. The semantics of the old back ends is preserved, even when they are probably buggy. There are some TODOs in gc/gsubr.c to remove special cases to preserve bugs in 5g and 8g. Change-Id: I28ae295fbfc94ef9df43e13ab96bd6fc2f194bc4 Reviewed-on: https://go-review.googlesource.com/3802 Reviewed-by: Austin Clements <austin@google.com>
2015-02-11[dev.cc] liblink: fix printing of SHRL CX, DX:AXRuss Cox
Change-Id: I6a119109c8dea7fecb32de2c4b1b5ba54bc485be Reviewed-on: https://go-review.googlesource.com/4100 Reviewed-by: Rob Pike <r@golang.org>
2015-02-09liblink, runtime: move all references to runtime.tlsg to tls_arm.sShenghou Ma
CL 2118 makes the assumption that all references to runtime.tlsg should be accompanied by a declaration of runtime.tlsg if its type should be a normal variable, instead of a placeholder for TLS relocation. Because if runtime.tlsg is not declared by the runtime package, the type of runtime.tlsg will be zero, so fix the check in liblink to look for 0 instead of STLSBSS (the type will be initialized by cmd/ld, but cmd/ld doesn't run during assembly). Change-Id: I691ac5c3faea902f8b9a0b963e781b22e7b269a7 Reviewed-on: https://go-review.googlesource.com/4030 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-07liblink: fix warnings on Plan 9David du Colombier
warning: src/liblink/list5.c:171 format mismatch lld INT, arg 4 warning: src/liblink/list9.c:175 format mismatch lld INT, arg 4 warning: src/liblink/list6.c:211 format mismatch lld INT, arg 4 warning: src/liblink/list8.c:205 format mismatch lld INT, arg 4 Change-Id: I745ea852d8b58ecbbd32723e2a67aa784a729ff8 Reviewed-on: https://go-review.googlesource.com/4112 Reviewed-by: Minux Ma <minux@golang.org>
2015-02-06liblink, cmd/ld, cmd/5l: darwin/arm supportShenghou Ma
liblink: - set dummy value for ctxt->tlsoffset. cmd/ld: - always do external linking when using cgo on darwin/arm, as our linker might not generate codesign-compatible binary. cmd/5l: - support generate ARM Mach-O binaries - add machoreloc1() that translate our internal relocation to macho relocations used by external linking. Change-Id: Ic5454aeb87009aaf8f1453ec7fe33e6da55d5f06 Reviewed-on: https://go-review.googlesource.com/3273 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06liblink, cmd/ld, runtime: set the type of runtime.tlsg in runtimeShenghou Ma
In the old code, liblink, cmd/ld and runtime all have code determine whether runtime.tlsg is an actual variable or a placeholder for TLS relocation. This change consolidate them into one: the runtime/tls_arm.s will ultimately determine the type of that variable. Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237e43 Reviewed-on: https://go-review.googlesource.com/2118 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-05[dev.cc] cmd/internal/obj: reconvert from liblinkRuss Cox
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-05Revert "liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 ↵Russ Cox
to 32" This reverts commit da4abda2a1718c74b39134764ae6f694041a25e4. Change-Id: Ifd09b3dae0af0c7cef5fbbc332c63e78dc90d6b1 Reviewed-on: https://go-review.googlesource.com/3960 Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-05liblink, cmd/5a: fix reglist parsing/printing after changing REG_R0 to 32Shenghou Ma
Fixes #9759. Change-Id: I263f1251b9401371231374551c4f71c70cb6e359 Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/3931 Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-04[dev.cc] all: merge master (b8fcae0) into dev.ccRuss Cox
Change-Id: I2aa1d0b0c4cf7632a54e843810959b468e3812ab
2015-02-04[dev.cc] cmd/go, liblink: turn off verification against Go codeRuss Cox
The upcoming merge is going to break the synchrony. Will restore separately. Change-Id: I90946119a0901e24063b190d1a074594af7654c7 Reviewed-on: https://go-review.googlesource.com/3888 Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-04liblink: require use of TYPE_ADDR, not TYPE_CONSTRuss Cox
Add Addr-checking for all Progs on input to liblink, in liblink/pass.c, including requiring use of TYPE_ADDR, not TYPE_CONST. Update compilers and assemblers to satisfy checks. Change-Id: Idac36b9f6805f0451cb541d2338992ca5eaf3963 Reviewed-on: https://go-review.googlesource.com/3801 Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: define fixed A-numbers for common instructionsRuss Cox
This makes names like ANOP, ATEXT, AGLOBL, ACALL, AJMP, ARET available for use by architecture-independent processing passes. On arm and ppc64, the alternate names are now aliases for the official ones (ABL for ACALL, AB or ABR for AJMP, ARETURN for ARET). Change-Id: Id027771243795af2b3745199c645b6e1bedd7d18 Reviewed-on: https://go-review.googlesource.com/3577 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: place DATA size in from3.offset alwaysRuss Cox
Like the TEXT/GLOBL flags, this was split between from.scale and reg, neither of which is appropriate. Change-Id: I2a16ef066a53b6edb7afb16cce108c0d1d26389c Reviewed-on: https://go-review.googlesource.com/3576 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: the zero Prog is now valid and ready for useRuss Cox
Use AXXX instead of AGOK (neither is a valid instruction but AXXX is zero) for the initial setting of Prog.as, and now there are no non-zero default field settings. Remove the arch-specific zprog/zprg in favor of a single global zprog. Remove the arch-specific prg constructor in favor of emallocz(sizeof(Prog)). Change-Id: Ia73078726768333d7cdba296f548170c1bea9498 Reviewed-on: https://go-review.googlesource.com/3575 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: remove dead computation of p->back in span6/span8Russ Cox
Originally, when this code was part of 6l/8l, every new Prog was constructed starting with zprg, which set back=2, and then this code walked over the list setting back=1 for backward branches, back=0 otherwise. The initial back=2 setting was used to identify forward branches (the branched-to instruction had back == 2 since it hadn't yet been set to 0 or 1). When the code was extracted into liblink and linked directly with 6a/6g/8a/8g, those programs created the Prog struct and did not set back=2, breaking this backward branch detection. No one noticed, because the next loop recomputes the information. The only requirement for the next loop is that p->back == 0 or 1 for each of the Progs in the list. The initialization of the zprg with back=2 would cause problems in this second loop, for the few liblink-internally-generated instructions that are created by copying zprg, except that the first loop was making sure that back == 0 or 1. The first loop's manipulation of p->back can thus be deleted, provided we also delete the zprg.back = 2 initializations. This is awful and my fault. I apologize. While we're here, remove the .scale = 1 from the zprg init too. Anything that sets up a scaled index should set the scale itself. (And mostly those come from outside liblink anyway.) Tested by checking that all generated code is bit-for-bit identical to before this CL. Change-Id: I7f6e0b33ce9ccd5b7dc25e0f00429fedd0957c8c Reviewed-on: https://go-review.googlesource.com/3574 Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: renumber ARM conditions to make C_SCOND_NONE == 0Russ Cox
A step toward making the zero Prog useful. Change-Id: I427b98b1ce9bd8f093da825aa4bb83244fc01903 Reviewed-on: https://go-review.googlesource.com/3573 Reviewed-by: Dave Cheney <dave@cheney.net> Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: place TEXT/GLOBL flags in p->from3 alwaysRuss Cox
Before, amd64 and 386 stored the flags in p->from.scale and arm and ppc64 stored the flags in p->reg. Both caused special cases in printing and in handling of the addresses. To avoid possible conflicts with the real meaning of p->from and to avoid storing a non-register value in a reg field, use from3 to hold a TYPE_CONST value giving the flags. There is still a special case for printing, because the flags are specified without a $, and normally a TYPE_CONST prints with a $. But that's much less special than what came before. This allows us to remove the textflag and settextflag methods from LinkArch. They are no longer architecture-specific. Change-Id: I931da8e1ecd92e127cd9aa44ef5a73c42e730110 Reviewed-on: https://go-review.googlesource.com/3572 Reviewed-by: Austin Clements <austin@google.com>
2015-02-03liblink: use same TEXT $frame-arg encoding for all architecturesRuss Cox
Change-Id: I3417a8c5ddd7f405939edc9fdef086e4741495a1 Reviewed-on: https://go-review.googlesource.com/3571 Reviewed-by: Austin Clements <austin@google.com>
2015-02-02cmd/6g, liblink, runtime: support saving base pointersAustin Clements
This adds a "framepointer" GOEXPERIMENT that that makes the amd64 toolchain maintain base pointer chains in the same way that gcc -fno-omit-frame-pointer does. Go doesn't use these saved base pointers, but this does enable external tools like Linux perf and VTune to unwind Go stacks when collecting system-wide profiles. This requires support in the compilers to not clobber BP, support in liblink for generating the BP-saving function prologue and unwinding epilogue, and support in the runtime to save BPs across preemption, to skip saved BPs during stack unwinding and, and to adjust saved BPs during stack moving. As with other GOEXPERIMENTs, everything from the toolchain to the runtime must be compiled with this experiment enabled. To do this, run make.bash (or all.bash) with GOEXPERIMENT=framepointer. Change-Id: I4024853beefb9539949e5ca381adfdd9cfada544 Reviewed-on: https://go-review.googlesource.com/2992 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-30cmd/9a, cmd/9g, cmd/9l, liblink: update for portable Prog, AddrRuss Cox
Change-Id: I55afed0eabf3c38e72ff105294782ac36446b66b Reviewed-on: https://go-review.googlesource.com/3519 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-01-30cmd/8a, cmd/8g, cmd/8l, liblink: update for portable Prog, AddrRuss Cox
Change-Id: I19ed283962aa0221cf806307bde9ea0773a1bfd4 Reviewed-on: https://go-review.googlesource.com/3518 Reviewed-by: Austin Clements <austin@google.com>
2015-01-30cmd/6a, cmd/6g, cmd/6l, liblink: update for portable Prog, AddrRuss Cox
Change-Id: I5535582660da3504663c6cba2637da132c65a400 Reviewed-on: https://go-review.googlesource.com/3517 Reviewed-by: Austin Clements <austin@google.com>
2015-01-30cmd/5a, cmd/5g, cmd/5l, liblink: update for portable Prog, AddrRuss Cox
Change-Id: I06762d4fb3bb2616087339b6ae1eb5267a39c46a Reviewed-on: https://go-review.googlesource.com/3516 Reviewed-by: Austin Clements <austin@google.com>
2015-01-30cmd/gc, cmd/ld, liblink: update for portable Prog, Addr changesRuss Cox
Change-Id: Ia6f8badca56565b9df80c8dbe28c47f6cf7e653f Reviewed-on: https://go-review.googlesource.com/3515 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-01-30liblink: fix error message on linux for unknown TLS baseRuss Cox
headstr(Hlinux) was reporting "android", making for some confusing error messages. Change-Id: I437095bee7cb2143aa37c91cf786f3a3581ae7b9 Reviewed-on: https://go-review.googlesource.com/3513 Reviewed-by: Austin Clements <austin@google.com>
2015-01-30liblink: bug fixes for ppc64 %P formatRuss Cox
- certain code paths were appending to the string without first clearing it. - some prints were using spaces instead of tabs Change-Id: I7a3d38289c8206682baf8942abf5a9950a56b449 Reviewed-on: https://go-review.googlesource.com/3511 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dave Cheney <dave@cheney.net>
2015-01-28liblink: do not print pointers in debug outputRuss Cox
Pointers change from run to run, making it hard to use the debug output to identify the reason for a changed object file. Change-Id: I0c954da0943092c48686afc99ecf75eba516de6a Reviewed-on: https://go-review.googlesource.com/3352 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Rob Pike <r@golang.org>
2015-01-26liblink: arrange for Prog* argument in vaddrRuss Cox
The argument is unused in the C code but will be used in the Go translation, because the Prog holds information needed to invoke the right meaning of %A in the ctxt->diag calls in vaddr. Change-Id: I501830f8ea0e909aafd8ec9ef5d7338e109d9548 Reviewed-on: https://go-review.googlesource.com/3041 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-on: https://go-review.googlesource.com/3310 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-21[dev.cc] cmd/internal/obj: reconvert from liblinkRuss Cox
Using rsc.io/c2go repo revision 60c9302. - Export a few symbols needed by assemblers. - Implement Getgoroot etc directly, and add Getgoversion. - Removes dependency on Go 1.4 go/build. - Change magic history name <no name> to <pop> The <pop> change requires adjustment to the liblink serializer. Change-Id: If5fb52ac9e91d50805263070b3fc5cc05d8b7632 Reviewed-on: https://go-review.googlesource.com/3141 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2015-01-21[dev.cc] liblink: invoke 'go tool objwriter' to implement writeobj, if directedRuss Cox
This CL enables moving the bulk of the object writing code out of liblink and into translated Go libraries in cmd/internal/obj, but it does not do the move. This CL introduces two new environment variables, $GOOBJ and $GOOBJWRITER, but both will be deleted along with the rest of the liblink C code. The default behavior of a build is unchanged by this CL: the C version of liblink uses the C object layout and writing code. If $GOOBJ=1, liblink invokes go tool objwriter instead. If $GOOBJ=2, liblink does its own layout and then invokes go tool objwriter, which checks that it gets the same answer. That is, in $GOOBJ=2 mode, both the C and the Go version of the code run, and the operation fails if the two produce different answers. This provides a very strong check that the translation is working correctly. Change-Id: I56ab49b07ccb2c7b81085f1d6950131047c6aa3c Reviewed-on: https://go-review.googlesource.com/3048 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21[dev.cc] build: do not 'clean -i std' between dist and go_bootstrapRuss Cox
Executing 'clean -i std' removes installed Go programs, including the toolchain binaries we need for building. It's not clear why the 'clean -i std' is here in the first place. cmd/dist just removed the entire pkg tree, so everything is new. The only reason for 'clean -i std' would be if you don't trust that dist compiled the packages properly. If that's true for some reason, we can fix cmd/dist, or add -a to the install commands that follow. Perhaps clean -i std should not remove tools, or perhaps std should not expand to any tools. Not sure. Also remove banner from make.bat and make.rc that was already removed from make.bash. cmd/dist prints it now. Also fix array size error in liblink/objfile.c. Fixes dev.cc build. Change-Id: I60855e001a682efce55ad9aa307a8f3ee47f7366 Reviewed-on: https://go-review.googlesource.com/3100 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-21[dev.cc] liblink: invoke go tool objwriter during writeobjRuss Cox
This doesn't actually use objwriter for any real work. It's just to check that objwriter is available. The real work will be moved once the bootstrapping mechanisms are working. Change-Id: I5f41c8910c4b11b9d80cb0b0847ff9cb582fc2be Reviewed-on: https://go-review.googlesource.com/3045 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21[dev.cc] liblink: arrange for Prog* argument in vaddrRuss Cox
The argument is unused in the C code but will be used in the Go translation, because the Prog holds information needed to invoke the right meaning of %A in the ctxt->diag calls in vaddr. Change-Id: I501830f8ea0e909aafd8ec9ef5d7338e109d9548 Reviewed-on: https://go-review.googlesource.com/3041 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21build: implement GOEXPERIMENT again in runtime, and add to liblinkRuss Cox
For Austin's framepointer experiment. Change-Id: I81b6f414943b3578924f853300b9193684f79bf4 Reviewed-on: https://go-review.googlesource.com/2994 Reviewed-by: Austin Clements <austin@google.com>
2015-01-14liblink: adjustments for c2go conversionRuss Cox
Mostly this is using uint32 instead of int32 for unsigned values like instruction encodings or float32 bit representations, removal of ternary operations, and removal of #defines. Delete sched9.c, because it is not compiled (it is still in the history if we ever need it). Change-Id: I68579cfea679438a27a80416727a9af932b088ae Reviewed-on: https://go-review.googlesource.com/2658 Reviewed-by: Austin Clements <austin@google.com>
2015-01-07cmd/6g, cmd/8g, liblink: improve handling of float constantsJosh Bleecher Snyder
* Enable basic constant propagation for floats. The constant propagation is still not as aggressive as it could be. * Implement MOVSS $(0), Xx and MOVSD $(0), Xx as XORPS Xx, Xx. Sample code: func f32() float32 { var f float32 return f } func f64() float64 { var f float64 return f } Before: "".f32 t=1 size=32 value=0 args=0x8 locals=0x0 0x0000 00000 (demo.go:3) TEXT "".f32+0(SB),4,$0-8 0x0000 00000 (demo.go:3) FUNCDATA $0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB) 0x0000 00000 (demo.go:3) FUNCDATA $1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB) 0x0000 00000 (demo.go:3) MOVSS $f32.00000000+0(SB),X0 0x0008 00008 (demo.go:4) MOVSS $f32.00000000+0(SB),X0 0x0010 00016 (demo.go:5) MOVSS X0,"".~r0+8(FP) 0x0016 00022 (demo.go:5) RET , "".f64 t=1 size=32 value=0 args=0x8 locals=0x0 0x0000 00000 (demo.go:8) TEXT "".f64+0(SB),4,$0-8 0x0000 00000 (demo.go:8) FUNCDATA $0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB) 0x0000 00000 (demo.go:8) FUNCDATA $1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB) 0x0000 00000 (demo.go:8) MOVSD $f64.0000000000000000+0(SB),X0 0x0008 00008 (demo.go:9) MOVSD $f64.0000000000000000+0(SB),X0 0x0010 00016 (demo.go:10) MOVSD X0,"".~r0+8(FP) 0x0016 00022 (demo.go:10) RET , After: "".f32 t=1 size=16 value=0 args=0x8 locals=0x0 0x0000 00000 (demo.go:3) TEXT "".f32+0(SB),4,$0-8 0x0000 00000 (demo.go:3) FUNCDATA $0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB) 0x0000 00000 (demo.go:3) FUNCDATA $1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB) 0x0000 00000 (demo.go:3) XORPS X0,X0 0x0003 00003 (demo.go:5) MOVSS X0,"".~r0+8(FP) 0x0009 00009 (demo.go:5) RET , "".f64 t=1 size=16 value=0 args=0x8 locals=0x0 0x0000 00000 (demo.go:8) TEXT "".f64+0(SB),4,$0-8 0x0000 00000 (demo.go:8) FUNCDATA $0,gclocals·a7a3692b8e27e823add69ec4239ba55f+0(SB) 0x0000 00000 (demo.go:8) FUNCDATA $1,gclocals·3280bececceccd33cb74587feedb1f9f+0(SB) 0x0000 00000 (demo.go:8) XORPS X0,X0 0x0003 00003 (demo.go:10) MOVSD X0,"".~r0+8(FP) 0x0009 00009 (demo.go:10) RET , Change-Id: Ie9eb65e324af4f664153d0a7cd22bb16b0fba16d Reviewed-on: https://go-review.googlesource.com/2053 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-05Revert "liblink, cmd/ld, runtime: remove stackguard1"Russ Cox
This reverts commit ab0535ae3fb45ba734d47542cc4845f27f708d1b. I think it will remain useful to distinguish code that must run on a system stack from code that can run on either stack, even if that distinction is no longer based on the implementation language. That is, I expect to add a //go:systemstack comment that, in terms of the old implementation, tells the compiler, to pretend this function was written in C. Change-Id: I33d2ebb2f99ae12496484c6ec8ed07233d693275 Reviewed-on: https://go-review.googlesource.com/2275 Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-04liblink: fix encoding of SETcc for amd64Shenghou Ma
liblink used to encode both SETEQ BP and SETEQ CH as 0f 94 c5, however, SETEQ BP should have used a REX prefix. Fixes #8545. Change-Id: Ie59c990cdd0ec506cffe4318e9ad1b48db5e57dd Reviewed-on: https://go-review.googlesource.com/2270 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-29liblink, cmd/ld, runtime: remove stackguard1Shenghou Ma
Now that we've removed all the C code in runtime and the C compilers, there is no need to have a separate stackguard field to check for C code on Go stack. Remove field g.stackguard1 and rename g.stackguard0 to g.stackguard. Adjust liblink and cmd/ld as necessary. Change-Id: I54e75db5a93d783e86af5ff1a6cd497d669d8d33 Reviewed-on: https://go-review.googlesource.com/2144 Reviewed-by: Keith Randall <khr@golang.org>
2014-12-22liblink: code for debugging bad returnsAustin Clements
Disabled by default, but invaluable when you need it. Change-Id: If4a75d11d14f70b6840d339aaec4b940dc406493 Reviewed-on: https://go-review.googlesource.com/2012 Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-22liblink: remove class from %#D formatter on 6lAustin Clements
This was a copy-paste error from 9l. Besides incorrectly referring to cnames9, 6l doesn't even use a->class, so simply remove this. Fixes #9320 Change-Id: I0e3440c9dae1c3408eb795b3645f9f1dd8f50aed Reviewed-on: https://go-review.googlesource.com/1516 Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-18liblink: fail for too-large register offset constantsAustin Clements
Previously, liblink would silently truncate register offset constants to 32 bits. For example, MOVD $0x200000004(R2),R3 would assemble to addis r31,r2,0 addi r3,r31,4 To fix this, limit C_LACON to 32 bit (signed) offsets and introduce a new C_DACON operand type for larger register offsets. We don't implement this currently, but at least liblink will now give an error if it encounters an address like this. Change-Id: I8e87def8cc4cc5b75498b0fb543ac7666cf2964e Reviewed-on: https://go-review.googlesource.com/1758 Reviewed-by: Minux Ma <minux@golang.org>
2014-12-18liblink: generate correct code for MOVD $-n(Rm), x on ppc64Austin Clements
On ppc64, liblink rewrites MOVD's of >32-bit constants by putting the constant in memory and rewriting the MOVD to load from that memory address. However, there were two bugs in the condition: a) owing to an incorrect sign extension, it triggered for all negative constants, and b) it could trigger for constant offsets from registers (addresses of the form $n(Rm) in assembly) Together, these meant instructions of the form MOVD $-n(Rm), x were compiled by putting -n in memory and rewriting the MOVD to load this constant from memory (completely dropping Rm). Change-Id: I1f6cc980efa3e3d6f164b46c985b2c3b55971cca Reviewed-on: https://go-review.googlesource.com/1752 Reviewed-by: Minux Ma <minux@golang.org>