1
0
mirror of https://github.com/golang/go synced 2024-10-04 19:21:21 -06:00
Commit Graph

22155 Commits

Author SHA1 Message Date
Russ Cox
8d44ede0dc cmd/gc: simplify code for c2go (more)
- Remove more ? : expressions.
- Use uint32 **hash instead of uint32 *hash[] in function argument.
- Change array.c API to use int, not int32, to match Go's slices.
- Rename strlit to newstrlit, to avoid case-insensitive collision with Strlit.
- Fix a few incorrect printf formats.
- Rename a few variables from 'len' to n or length.
- Eliminate direct string editing building up names like convI2T.

Change-Id: I754cf553402ccdd4963e51b7039f589286219c29
Reviewed-on: https://go-review.googlesource.com/3278
Reviewed-by: Rob Pike <r@golang.org>
2015-01-26 20:00:44 +00:00
Russ Cox
349ecfb0d6 cmd/gc: make cmd/gc a real library
cmd/gc contains symbol references into the back end dirs like 6g.
It also contains a few files that include the back end header files and
are compiled separately for each back end, despite being in cmd/gc.
cmd/gc also defines main, which makes at least one reverse symbol
reference unavoidable. (Otherwise you can't get into back-end code.)

This was all expedient, but it's too tightly coupled, especially for a
program written Go.

Make cmd/gc into a true library, letting the back end define main and
call into cmd/gc after making the necessary references available.
cmd/gc being a real library will ease the transition to Go.

Change-Id: I4fb9a0e2b11a32f1d024b3c56fc3bd9ee458842c
Reviewed-on: https://go-review.googlesource.com/3277
Reviewed-by: Rob Pike <r@golang.org>
2015-01-26 20:00:38 +00:00
Russ Cox
e82003e750 cmd/gc: simplify code for c2go
- Change forward reference to struct Node* to void* in liblink.
- Use explicit (Node*) casts in cmd/gc to get at that field.
- Define struct Array in go.h instead of hiding it in array.c.
- Remove some sizeof(uint32), sizeof(uint64) uses.
- Remove some ? : expressions.
- Rewrite some problematic mid-expression assignments.

Change-Id: I308c70140238a0cfffd90e133f86f442cd0e17d4
Reviewed-on: https://go-review.googlesource.com/3276
Reviewed-by: Rob Pike <r@golang.org>
2015-01-26 20:00:30 +00:00
David du Colombier
2a74f436aa os: emulate plan 9 libc in stat
This change is a recreation of the CL written
by Nick Owens on http://golang.org/cl/150730043.

If the stat buffer is too short, the kernel
informs us by putting the 2-byte size in the
buffer, so we read that and try again.

This follows the same algorithm as /sys/src/libc/9sys/dirfstat.c.

Fixes #8781.

Change-Id: I01b4ad3a5e705dd4cab6673c7a119f8bef9bbd7c
Reviewed-on: https://go-review.googlesource.com/3281
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-26 06:34:07 +00:00
Shenghou Ma
e24e299f41 regexp: update URLs in tests
Change-Id: I06035d949272157bbb7255563b37ac93cbf07f15
Reviewed-on: https://go-review.googlesource.com/3272
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-26 01:54:28 +00:00
Shenghou Ma
c39d669230 archive/tar: set Header.Mode in example
Creating a tar containing files with 0000 permission bits is
not going to be useful.

Change-Id: Ie489c2891c335d32270b18f37b0e32ecdca536a6
Reviewed-on: https://go-review.googlesource.com/3271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-26 01:54:06 +00:00
Andrew Ekstedt
dfc4997ede image: fix typo in Alpha16 doc comment
Change-Id: Ie7031ae37f52ea1f229bfb769daf306d537b3d3e
Reviewed-on: https://go-review.googlesource.com/3300
Reviewed-by: Minux Ma <minux@golang.org>
2015-01-25 22:46:49 +00:00
INADA Naoki
1b61a97811 database/sql: reduce lock contention in Stmt.connStmt
Previouslly, Stmt.connStmt calls DB.connIfFree on each Stmt.css.
Since Stmt.connStmt locks Stmt.mu, a concurrent use of Stmt causes lock
contention on Stmt.mu.
Additionally, DB.connIfFree locks DB.mu which is shared by DB.addDep and
DB.removeDep.

This change removes DB.connIfFree and makes use of a first unused
connection in idle connection pool to reduce lock contention
without making it complicated.

Fixes #9484

On EC2 c3.8xlarge (E5-2680 v2 @ 2.80GHz * 32 vCPU):

benchmark                           old ns/op     new ns/op     delta
BenchmarkManyConcurrentQuery-8      40249         34721         -13.73%
BenchmarkManyConcurrentQuery-16     45610         40176         -11.91%
BenchmarkManyConcurrentQuery-32     109831        43179         -60.69%

benchmark                           old allocs     new allocs     delta
BenchmarkManyConcurrentQuery-8      25             25             +0.00%
BenchmarkManyConcurrentQuery-16     25             25             +0.00%
BenchmarkManyConcurrentQuery-32     25             25             +0.00%

benchmark                           old bytes     new bytes     delta
BenchmarkManyConcurrentQuery-8      3980          3969          -0.28%
BenchmarkManyConcurrentQuery-16     3980          3982          +0.05%
BenchmarkManyConcurrentQuery-32     3993          3990          -0.08%

Change-Id: Ic96296922c465bac38a260018c58324dae1531d9
Reviewed-on: https://go-review.googlesource.com/2207
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-01-24 09:56:25 +00:00
Robert Griesemer
3acb9fd98e math/big: disable some tests on 32bit platforms (fix build)
TBR: adonovan

Change-Id: I59757b5b46a2c533fc5f888423c99d550d3c7648
Reviewed-on: https://go-review.googlesource.com/3264
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-24 05:42:47 +00:00
Robert Griesemer
bd275b2381 math/big: multi-precision Floats (starting point)
Implemented:
- +, -, *, /, and some unary ops
- all rounding modes
- basic conversions
- string to float conversion
- tests

Missing:
- float to string conversion, formatting
- handling of +/-0 and +/-inf (under- and overflow)
- various TODOs and cleanups

With precision set to 24 or 53, the results match
float32 or float64 operations exactly (excluding
NaNs and denormalized numbers which will not be
supported).

Change-Id: I3121e90fc4b1528e40bb6ff526008da18b3c6520
Reviewed-on: https://go-review.googlesource.com/1218
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-24 05:17:27 +00:00
Rob Pike
89162307cd [dev.cc] cmd/asm: changes to get identical output as new6a
Fix up a couple of minor things pointed out in the last review.
Also:

1. If the symbol starts with center dot, prefix the name with "".
2. If there is no locals size specified, use ArgsSizeUnknown (sic).
3. Do not emit a history point at the start of a macro invocation,
since we do not pop it at the end, behavior consistent with the
old code.

With these changes, old and new assemblers produce identical
output at least for my simple test case, so that provides a verifiable
check for future cleanups.

Change-Id: Iaa91d8e453109824b4be44321ec5e828f39f0299
Reviewed-on: https://go-review.googlesource.com/3242
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-24 03:28:26 +00:00
Robert Griesemer
571d02d9fe go/ast: document that ast.FilterFile always filters imports
Fixes #9248.

Change-Id: Id1c50af5eb35d7720b8f0a4d4881414baf061d56
Reviewed-on: https://go-review.googlesource.com/3241
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 19:52:07 +00:00
Robert Griesemer
c8d7d0d9f1 go/printer: update golden file (fix build)
Change-Id: I897a09a1c54f6d68c5dc68e189cb25dc72bb7590
Reviewed-on: https://go-review.googlesource.com/3240
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 19:23:14 +00:00
Robert Griesemer
ad54a16b15 go/printer, cmd/gofmt: print import paths in double quotes
Fixes #9644.

Change-Id: Ia2e42befa20233107ac5409e79f9dce794983a3f
Reviewed-on: https://go-review.googlesource.com/3200
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 18:24:17 +00:00
Russ Cox
07a27ce09e [dev.cc] cmd/dist: show bootstrap build progress in real time
Change-Id: I97bbf7a276c8f99554f0e3a9bcc8d3792a5e0f65
Reviewed-on: https://go-review.googlesource.com/3221
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-23 17:13:33 +00:00
Robert Griesemer
dcb37f94e0 go/parser: report error for var/const decls with missing init exprs
Fixes #9639.

Change-Id: I311045d3df26b29b9380c159ef4727e85650d13b
Reviewed-on: https://go-review.googlesource.com/3211
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 17:01:28 +00:00
Rob Pike
fdeee3a538 [dev.cc] cmd/asm: the assembler proper
Add main.go, the simple driver for the assembler, and the
subdirectory internal/asm, which contains the parser and
instruction generator.

It's likely that much of the implementation is superstition,
or at best experimental phenomenology, but it does generate
working binaries.

Change-Id: I322a9ae8a20174b6693153f30e39217ba68f8032
Reviewed-on: https://go-review.googlesource.com/3196
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-23 04:54:05 +00:00
Rob Pike
8642639575 [dev.cc] cmd/asm: add lex internal package
Add the lexing code for the new portable assembler.
It is internal to the assembler, so lives in a subdirectory of cmd/asm/internal.

Its only new dependency is the flags package for the assembler, so
add that too; it's trivial. That package manages the command-line
flags in a central place.

The lexer builds on text/scanner to lex the input, including doing a
Plan 9-level implementation of the C preprocessor.

Change-Id: I262e8717b8c797010afaa5051920839906c0dd19
Reviewed-on: https://go-review.googlesource.com/3195
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-23 04:24:57 +00:00
Rob Pike
40eb0ed0d8 [dev.cc] cmd/asm: add addr package
This simple package holds the definition of the Addr (address) type
that represents addresses inside the assembler.

It has no dependencies.

Change-Id: I7573fd70f1847ef68e3d6b663dc4c39eb2ebf8b3
Reviewed-on: https://go-review.googlesource.com/3193
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-23 03:30:37 +00:00
Rob Pike
6017f68029 [dev.cc] cmd/asm: add arch package
This package builds the representation of the machine architecture
for the new assembler.

Almost nothing in it is likely to last but this will get things running.

Change-Id: I8edd891f927a81f76d2dbdcd7484b9c87ac0fb2e
Reviewed-on: https://go-review.googlesource.com/3194
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-23 03:18:55 +00:00
Shenghou Ma
c242fbc903 runtime: fix incorrectly replaced "_type" in comments
Change-Id: I9d0b1bb68604c5a153bd5c05c7008db045c38d2a
Reviewed-on: https://go-review.googlesource.com/3180
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-23 00:12:13 +00:00
Robert Griesemer
19c1b163e8 bytes, strings: improve documentation for Count functions
Fixes #9659.

Change-Id: If364d5984a0c9a48858ae524b1560f633e621826
Reviewed-on: https://go-review.googlesource.com/3181
Reviewed-by: Rob Pike <r@golang.org>
2015-01-22 18:28:35 +00:00
Martin Möhrmann
494b4ce2a7 net: simplify itoa conversions
Rename itod to uitoa to have consistent naming with other itoa functions.
Reduce redundant code by calling uitoa from itoa.
Reduce buffer to maximally needed size for conversion of 64bit integers.
Adjust calls to itoa functions in package net to use new name for itod.
Avoid calls to itoa if uitoa suffices.

Change-Id: I79deaede4d4b0c076a99a4f4dd6f644ba1daec53
Reviewed-on: https://go-review.googlesource.com/2212
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-01-22 13:01:28 +00:00
Michael Matloob
afe6668216 cmd/ld: s/specificaly/specifically/ in comment
Change-Id: I849b8046daaec97ae631d59f1870cd5f1cd72f22
Reviewed-on: https://go-review.googlesource.com/3176
Reviewed-by: Minux Ma <minux@golang.org>
2015-01-22 07:08:46 +00:00
Ian Lance Taylor
ec0ebc2281 cmd/gc: treat non-local vars inlined into wrapper as escaping
The compiler has a phase ordering problem.  Escape analysis runs
before wrapper generation.  When a generated wrapper calls a method
defined in a different package, if that call is inlined, there will be
no escape information for the variables defined in the inlined call.
Those variables will be placed on the stack, which fails if they
actually do escape.

There are probably various complex ways to fix this.  This is a simple
way to avoid it: when a generated wrapper calls a method defined in a
different package, treat all local variables as escaping.

Fixes #9537.

Change-Id: I530f39346de16ad173371c6c3f69cc189351a4e9
Reviewed-on: https://go-review.googlesource.com/3092
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-22 03:25:12 +00:00
Russ Cox
67e7ded029 [dev.cc] cmd/internal/obj, cmd/new9a: use ctxt.NewProg
cmd/internal/obj reconverted using rsc.io/c2go rev 40275b8.

All Prog*s need Ctxt field set so that the printer can tell
which architecture the Prog belongs to.
Use ctxt.NewProg consistently for this.

Change-Id: Ic981b3d68f24931ffae74a772e83a3dc2fdf518a
Reviewed-on: https://go-review.googlesource.com/3152
Reviewed-by: Rob Pike <r@golang.org>
2015-01-22 03:22:04 +00:00
David du Colombier
98d914201b lib9: build tokenize on Plan 9
The build was broken on Plan 9 after the
CL 2994, because of the use of getfields
in src/liblink/go.c.

This happened when building 8l, because
getfield was part of lib9 and tokenize
was part of the Plan 9 libc. However,
both getfields and tokenize depend on
utfrune, causing an incompatibility.

This change enables the build of tokenize
as part of lib9, so it doesn't use
tokenize from the Plan 9 libc anymore.

Change-Id: I2a76903b508bd92771c4754cd53dfc64df350892
Reviewed-on: https://go-review.googlesource.com/3121
Reviewed-by: Minux Ma <minux@golang.org>
2015-01-21 23:27:01 +00:00
Rick Hudson
34bc85f6f3 runtime: fix trigger for concurrent GC
Adjust triggergc so that we trigger when we have used 7/8
of the available heap memory. Do first collection when we
exceed 4Mbytes.

Change-Id: I467b4335e16dc9cd1521d687fc1f99a51cc7e54b
Reviewed-on: https://go-review.googlesource.com/3149
Reviewed-by: Austin Clements <austin@google.com>
2015-01-21 21:30:46 +00:00
Russ Cox
ebaf8db4f6 [dev.cc] cmd/internal/obj: export more symbols, rename Type_ to Type
For new assembler, reconvert using rsc.io/c2go rev f9db76e.
- Removes trailing _ from Go keywords that are exported.
- Export regstr as Register, anames[5689] as Anames.

Also update clients.

Change-Id: I41c8fd2d14490236f548b4aa0ed0b9bd7571d2d7
Reviewed-on: https://go-review.googlesource.com/3151
Reviewed-by: Rob Pike <r@golang.org>
2015-01-21 21:24:40 +00:00
David du Colombier
7522e135a3 include: declare getgohostos and getgohostarch on Plan 9
The function getgohostos and getgohostarch
were declared in include/libc.h in CL 3042.

Change-Id: Ib4ff5182cb71cc79a99663ce727fa4c28d15d7ad
Reviewed-on: https://go-review.googlesource.com/3122
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 20:23:21 +00:00
David du Colombier
7de910dccf include: declare runcmd on Plan 9
The function runcmd was declared in
include/libc.h in CL 7523043.

Change-Id: I3839b96b2ac0d63e5c2eb4c216710442d0962119
Reviewed-on: https://go-review.googlesource.com/3125
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 20:23:03 +00:00
Paul van Brouwershaven
fe40cdd756 crypto/x509: implement crypto.Signer
Signer is an interface to support opaque private keys.
These keys typically result from being kept in special hardware
(i.e. a TPM) although sometimes operating systems provide a
similar interface using process isolation for security rather
than hardware boundaries.

This changes provides updates implements crypto.Signer in
CreateCRL and CreateCertificate so that they can be used with
opaque keys.

This CL has been discussed at: http://golang.org/cl/145910043

Change-Id: Id7857fb9a3b4c957c7050b519552ef1c8e55461e
Reviewed-on: https://go-review.googlesource.com/3126
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2015-01-21 20:13:48 +00:00
Russ Cox
5282e3ab26 [dev.cc] cmd/go: run C and Go assemblers side by side and verify matching output
When an assembly file must be assembled, cmd/go now runs
both (say) 6a and new6a and checks that they write identical
output files.

This serves as a build-time test that the new assemblers are accurate
conversions of the old ones. As long as they are producing identical
bytes, there's no need for run-time testing.

Once the C conversion is done, we'll throw away the C code
and this checking.

Change-Id: I0216dad56b7e79011eecd27f1aff4fe79bfe720b
Reviewed-on: https://go-review.googlesource.com/3145
Reviewed-by: Rob Pike <r@golang.org>
2015-01-21 19:43:24 +00:00
Russ Cox
f4d2d71752 [dev.cc] cmd/dist: build new5a etc during bootstrap
The change to the bootstrap import conversion is
for the a.y files, which use import dot.

While we're editing the tool list, add "cmd/dist".
Right now 'go install cmd/dist' installs to $GOROOT/bin/dist.
(A new bug since cmd/dist has been rewritten in Go.
When cmd/dist was a C program, go install cmd/dist just didn't work.)

Change-Id: I362208dcfb4ae64c987f60b95dc946829fa506d8
Reviewed-on: https://go-review.googlesource.com/3144
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-01-21 19:43:09 +00:00
Russ Cox
4ca2fc4d8b [dev.cc] cmd/new5a etc, cmd/internal/asm: edit to produce working Go code
These assemblers produce byte-for-byte identical output
to the ones written in C.

They are primarily a proof that cmd/internal/obj can be used
standalone to produce working object files. (The use via objwriter
starts by deserializing an already-constructed internal representation,
so objwriter does not exercise the code in cmd/internal/obj that
creates such a representation from scratch.)

Change-Id: I1793d8d010046cfb9d8b4d2d4469e7f47a3d3ac7
Reviewed-on: https://go-review.googlesource.com/3143
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 19:42:58 +00:00
Russ Cox
9e2f8fdb6f [dev.cc] cmd/new5a etc, cmd/internal/asm: initial C → Go conversion
This is the raw output of c2go. It needs fixes to make it compile.
Rather than make c2go do a 100% conversion (like we're doing for
liblink and the Go compilers), since this is so trivial I'm going to
make the remaining changes by hand in a followup CL.
This CL makes the next CL's diffs useful.

Also copy unmodified .y files (5a/a.y → new5a/a.y and so on)

The converted 6a/lex.c has been written to new6a/lex.go
but also to internal/asm/asm.go, because I'm going to factor
out some common code rather than convert it four times.

Change-Id: I01d5dfd6a9be3ef6191581560bdddd0ac0e8bc58
Reviewed-on: https://go-review.googlesource.com/3142
Reviewed-by: Rob Pike <r@golang.org>
2015-01-21 19:42:48 +00:00
Russ Cox
24dfaba6d1 [dev.cc] cmd/internal/obj: reconvert from liblink
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 19:06:31 +00:00
Russ Cox
a8e5e803e6 [dev.cc] cmd/dist: write cmd/internal/obj/zbootstrap.go
cmd/internal/obj needs information about the default
values of GOROOT, GOARM, GOEXPERIMENT, Version, and so on.
It cannot ask package runtime, because during bootstrap
package runtime comes from Go 1.4.
So it must have its own copy.

Change-Id: I73d3e75a3d47210b3184a51a810ebb44826b81e5
Reviewed-on: https://go-review.googlesource.com/3140
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-01-21 19:06:21 +00:00
David Crawshaw
695a0fb4ef syscall: use name+(NN)FP on linux/amd64
Generated from a modified go vet.

Change-Id: Ibe82941283da9bd4dbc7fa624a33ffb12424daa2
Reviewed-on: https://go-review.googlesource.com/2817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 19:04:38 +00:00
David Crawshaw
01295d7912 syscall: use name+(NN)FP on linux/386
Generated from go vet.

Change-Id: I8fee4095e43034b868bfd2b07e21ac13d5beabbb
Reviewed-on: https://go-review.googlesource.com/2816
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 18:54:27 +00:00
Austin Clements
e6982fadd2 Revert "runtime: fix trigger for concurrent GC"
This reverts commit 44529d9391.

Change-Id: I7671e2cd6f6a476efffa16e8110500a98258c0c1
Reviewed-on: https://go-review.googlesource.com/3130
Reviewed-by: Austin Clements <austin@google.com>
2015-01-21 16:29:17 +00:00
Rick Hudson
44529d9391 runtime: fix trigger for concurrent GC
Adujst triggergc so that we trigger when we have used 7/8
of the available memory.

Change-Id: I7ca02546d3084e6a04d60b09479e04a9a9837ae2
Reviewed-on: https://go-review.googlesource.com/3061
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-21 16:19:48 +00:00
Shenghou Ma
6cf5a733d5 internal/syscall: add getrandom syscall number for ppc64/ppc64le
Change-Id: I04c1b8f2a9ac4efba227d6c0a20459420cd3dc05
Reviewed-on: https://go-review.googlesource.com/3014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-21 06:29:15 +00:00
Andrew Gerrand
746dec575c html/template: fix example code
Fixes #9651

Change-Id: I987833b6263482a402e58fcd9eeb0e42401599b5
Reviewed-on: https://go-review.googlesource.com/3073
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-21 04:13:06 +00:00
Russ Cox
be818361b9 [dev.cc] liblink: invoke 'go tool objwriter' to implement writeobj, if directed
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 03:15:04 +00:00
Russ Cox
35d3987dbc [dev.cc] cmd/objwriter: implement using cmd/internal/obj
New code but nothing interesting.
It's nearly all parsing code for the format written by liblink.
The interesting part is the call to obj.Writeobjdirect, which
is the Go translation of the C liblink writeobjdirect function.

Change-Id: I2e9e755e7a3c999302e2ef2c7475c0af9c5acdd2
Reviewed-on: https://go-review.googlesource.com/3047
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 03:02:35 +00:00
Russ Cox
d6f6e420fc [dev.cc] cmd/internal/obj: convert liblink C to Go
This CL adds the real cmd/internal/obj packages.
Collectively they correspond to the liblink library.
The conversion was done using rsc.io/c2go's run script
at rsc.io/c2go repo version 706fac7.

This is not the final conversion, just the first working draft.
There will be more updates, but this works well enough
to use with go tool objwriter and pass all.bash.

Change-Id: I9359e835425f995a392bb2fcdbebf29511477bed
Reviewed-on: https://go-review.googlesource.com/3046
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 03:02:27 +00:00
Russ Cox
db52315c88 [dev.cc] build: do not 'clean -i std' between dist and go_bootstrap
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 02:19:27 +00:00
Robert Griesemer
2dfa4f4eb0 math/big: use new nat.scan for Rat.SetString
Change-Id: Ida20bf95e8f0fdadb459c2daa6d22edae9c3ad16
Reviewed-on: https://go-review.googlesource.com/3091
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-21 01:48:04 +00:00
Russ Cox
725e3a7afb [dev.cc] liblink: invoke go tool objwriter during writeobj
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 00:45:07 +00:00