summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* liblink, cmd/dist, cmd/5l: introduce %^ and move C_* constants.Shenghou Ma2014-08-061-2/+5
| | | | | | | | | The helps certain diagnostics and also removed duplicated enums as a side effect. LGTM=dave, rsc R=rsc, dave CC=golang-codereviews https://codereview.appspot.com/115060044
* liblink: support big-endian properlyShenghou Ma2014-08-061-1/+7
| | | | | | | LGTM=rsc R=rsc, iant CC=golang-codereviews https://codereview.appspot.com/115300044
* include/u.h: define _DEFAULT_SOURCE for new glibcBobby Powers2014-07-251-0/+1
| | | | | | | | | | | | | | | | | glibc devs have apparently decided _BSD_SOURCE will be deprecated on Linux, and issue a preprocessor warning if declaring _BSD_SOURCE without _DEFAULT_SOURCE. https://sourceware.org/glibc/wiki/Release/2.20 Fixes issue 8397. LGTM=iant R=dave, gobot, iant CC=golang-codereviews https://codereview.appspot.com/112530043 Committer: Ian Lance Taylor <iant@golang.org>
* liblink: remove some gotos + other fixesRuss Cox2014-07-211-2/+2
| | | | | | | | | | | | Rewrite gotos that violate Go's stricter rules. Use uchar* instead of char* in a few places that aren't strings. Remove dead opcross code from asm5.c. Declare regstr (in both list6 and list8) static. LGTM=minux, dave R=minux, dave CC=golang-codereviews https://codereview.appspot.com/113230043
* build: annotations and modifications for c2goRuss Cox2014-07-022-1/+11
| | | | | | | | | | | | | | | | | | | | | | | The main changes fall into a few patterns: 1. Replace #define with enum. 2. Add /*c2go */ comment giving effect of #define. This is necessary for function-like #defines and non-enum-able #defined constants. (Not all compilers handle negative or large enums.) 3. Add extra braces in struct initializer. (c2go does not implement the full rules.) This is enough to let c2go typecheck the source tree. There may be more changes once it is doing other semantic analyses. LGTM=minux, iant R=minux, dave, iant CC=golang-codereviews https://codereview.appspot.com/106860045
* liblink, runtime: preliminary support for plan9/amd64Aram H?v?rneanu2014-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | A TLS slot is reserved by _rt0_.*_plan9 as an automatic and its address (which is static on Plan 9) is saved in the global _privates symbol. The startup linkage now is exactly like that from Plan 9 libc, and the way we access g is exactly as if we'd have used privalloc(2). Aside from making the code more standard, this change drastically simplifies it, both for 386 and for amd64, and makes the Plan 9 code in liblink common for both 386 and amd64. The amd64 runtime code was cleared of nxm assumptions, and now runs on the standard Plan 9 kernel. Note handling fixes will follow in a separate CL. LGTM=rsc R=golang-codereviews, rsc, bradfitz, dave CC=0intro, ality, golang-codereviews, jas, minux.ma, mischief https://codereview.appspot.com/101510049 Committer: Dave Cheney <dave@cheney.net>
* all: remove 'extern register M *m' from runtimeRuss Cox2014-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The runtime has historically held two dedicated values g (current goroutine) and m (current thread) in 'extern register' slots (TLS on x86, real registers backed by TLS on ARM). This CL removes the extern register m; code now uses g->m. On ARM, this frees up the register that formerly held m (R9). This is important for NaCl, because NaCl ARM code cannot use R9 at all. The Go 1 macrobenchmarks (those with per-op times >= 10 ?s) are unaffected: BenchmarkBinaryTree17 5491374955 5471024381 -0.37% BenchmarkFannkuch11 4357101311 4275174828 -1.88% BenchmarkGobDecode 11029957 11364184 +3.03% BenchmarkGobEncode 6852205 6784822 -0.98% BenchmarkGzip 650795967 650152275 -0.10% BenchmarkGunzip 140962363 141041670 +0.06% BenchmarkHTTPClientServer 71581 73081 +2.10% BenchmarkJSONEncode 31928079 31913356 -0.05% BenchmarkJSONDecode 117470065 113689916 -3.22% BenchmarkMandelbrot200 6008923 5998712 -0.17% BenchmarkGoParse 6310917 6327487 +0.26% BenchmarkRegexpMatchMedium_1K 114568 114763 +0.17% BenchmarkRegexpMatchHard_1K 168977 169244 +0.16% BenchmarkRevcomp 935294971 914060918 -2.27% BenchmarkTemplate 145917123 148186096 +1.55% Minux previous reported larger variations, but these were caused by run-to-run noise, not repeatable slowdowns. Actual code changes by Minux. I only did the docs and the benchmarking. LGTM=dvyukov, iant, minux R=minux, josharian, iant, dave, bradfitz, dvyukov CC=golang-codereviews https://codereview.appspot.com/109050043
* liblink: fix field trackingRuss Cox2014-05-201-0/+1
| | | | | | | | | | | | | The USEFIELD instructions no longer make it to the linker, so we have to do something else to pin the references they were pinning. Emit a 0-length relocation of type R_USEFIELD. Fixes issue 7486. LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r https://codereview.appspot.com/95530043
* include/plan9: make mklibc.rc compatible with 9atomDavid du Colombier2014-04-191-6/+1
| | | | | | | | | | | Since there is no Runemask constant in UTF-8 enum in 9atom, removing the other constants leads to an empty enum, which is illegal. Thus, we remove enum entirely. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://codereview.appspot.com/82660044
* liblink, cmd/ld: reenable nosplit checking and testRuss Cox2014-04-161-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new code is adapted from the Go 1.2 nosplit code, but it does not have the bug reported in issue 7623: g% go run nosplit.go g% go1.2 run nosplit.go BUG rejected incorrectly: main 0 call f; f 120 linker output: # _/tmp/go-test-nosplit021064539 main.main: nosplit stack overflow 120 guaranteed after split check in main.main 112 on entry to main.f -8 after main.f uses 120 g% Fixes issue 6931. Fixes issue 7623. LGTM=iant R=golang-codereviews, iant, ality CC=golang-codereviews, r https://codereview.appspot.com/88190043
* liblink, cmd/gc, cmd/{5,6,8}{a,c}: rename linkwriteobj to writeobjIan Lance Taylor2014-04-161-1/+1
| | | | | | | | | | | | | The name linkwriteobj is misleading because it implies that the function has something to do with the linker, which it does not. The name is historical: the function performs an operation that was previously performed by the linker, but no longer is. LGTM=rsc R=rsc, minux.ma CC=golang-codereviews https://codereview.appspot.com/88210045
* liblink: fix incorrect hash collision in lookupRuss Cox2014-04-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linklookup uses hash(name, v) as the hash table index but then only compares name to find a symbol to return. If hash(name, v1) == hash(name, v2) for v1 != v2, the lookup for v2 will return the symbol with v1. The input routines assume that each symbol is found only once, and then each symbol is added to a linked list, with the list header in the symbol. Adding a symbol to such a list multiple times short-circuits the list the second time it is added, causing symbols to be dropped. The liblink rewrite introduced an elegant, if inefficient, handling of duplicated symbols by creating a dummy symbol to read the duplicate into. The dummy symbols are named .dup with sequential version numbers. With many .dup symbols, eventually there will be a conflict, causing a duplicate list add, causing elided symbols, causing a crash when calling one of the elided symbols. The bug is old (2011) but could not have manifested until the liblink rewrite introduced this heavily duplicated symbol .dup. (See History section below.) 1. Correct the lookup function. 2. Since we want all the .dup symbols to be different, there's no point in inserting them into the table. Call linknewsym directly, avoiding the lookup function entirely. 3. Since nothing can refer to the .dup symbols, do not bother adding them to the list of functions (textp) at all. 4. In lieu of a unit test, introduce additional consistency checks to detect adding a symbol to a list multiple times. This would have caught the short-circuit more directly, and it will detect a variety of double-use bugs, including the one arising from the bad lookup. Fixes issue 7749. History On April 9, 2011, I submitted CL 4383047, making ld 25% faster. Much of the focus was on the hash table lookup function, and one of the changes was to remove the s->version == v comparison [1]. I don't know if this was a simple editing error or if I reasoned that same name but different v would yield a different hash slot and so the name test alone sufficed. It is tempting to claim the former, but it was probably the latter. Because the hash is an iterated multiply+add, the version ends up adding v*3? to the hash, where n is the length of the name. A collision would need x*3? ? y*3? (mod 2?? mod 100003), or equivalently x*3? ? x*3? + (y-x)*3? (mod 2?? mod 100003), so collisions will actually be periodic: versions x and y collide when d = y-x satisfies d*3? ? 0 (mod 2?? mod 100003). Since we allocate version numbers sequentially, this is actually about the best case one could imagine: the collision rate is much lower than if the hash were more random. http://play.golang.org/p/TScD41c_hA computes the collision period for various name lengths. The most common symbol in the new linker is .dup, and for n=4 the period is maximized: the 100004th symbol is the first collision. Unfortunately, there are programs with more duplicated symbols than that. In Go 1.2 and before, duplicate symbols were handled without creating a dummy symbol, so this particular case for generating many duplicate symbols could not happen. Go does not use versioned symbols. Only C does; each input file gives a different version to its static declarations. There just aren't enough C files for this to come up in that context. So the bug is old but the realization of the bug is new. [1] https://codereview.appspot.com/4383047/diff/5001/src/cmd/ld/lib.c LGTM=minux.ma, iant, dave R=golang-codereviews, minux.ma, bradfitz, iant, dave CC=golang-codereviews, r https://codereview.appspot.com/87910047
* build: remove tmp dir names from objects, support GOROOT_FINAL againRuss Cox2014-04-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we compile a generated file stored in a temporary directory - let's say /tmp/12345/work/x.c - then by default 6c stores the full path and then the pcln table in the final binary includes the full path. This makes repeated builds (using different temporary directories) produce different binaries, even if the inputs are the same. In the old 'go tool pack', the P flag specified a prefix to remove from all stored paths (if present), and cmd/go invoked 'go tool pack grcP $WORK' to remove references to the temporary work directory. We've changed the build to avoid pack as much as possible, under the theory that instead of making pack convert from .6 to .a, the tools should just write the .a directly and save a round of I/O. Instead of going back to invoking pack always, define a common flag -trimpath in the assemblers, C compilers, and Go compilers, implemented in liblink, and arrange for cmd/go to use the flag. Then the object files being written out have the shortened paths from the start. While we are here, reimplement pcln support for GOROOT_FINAL. A build in /tmp/go uses GOROOT=/tmp/go, but if GOROOT_FINAL=/usr/local/go is set, then a source file named /tmp/go/x.go is recorded instead as /usr/local/go/x.go. We use this so that we can prepare distributions to be installed in /usr/local/go without actually working in that directory. The conversion to liblink deleted all the old file name handling code, including the GOROOT_FINAL translation. Bring the GOROOT_FINAL translation back. Before this CL, using GOROOT_FINAL=/goroot make.bash: g% strings $(which go) | grep -c $TMPDIR 6 g% strings $(which go) | grep -c $GOROOT 793 g% After this CL: g% strings $(which go) | grep -c $TMPDIR 0 g% strings $(which go) | grep -c $GOROOT 0 g% (The references to $TMPDIR tend to be cgo-generated source files.) Adding the -trimpath flag to the assemblers required converting them to the new Go-semantics flag parser. The text in go1.3.html is copied and adjusted from go1.1.html, which is when we applied that conversion to the compilers and linkers. Fixes issue 6989. LGTM=iant R=r, iant CC=golang-codereviews https://codereview.appspot.com/88300045
* liblink: introduce TLS register on 386 and amd64Russ Cox2014-04-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I did the original 386 ports on Linux and OS X, I chose to define GS-relative expressions like 4(GS) as relative to the actual thread-local storage base, which was usually GS but might not be (it might be FS, or it might be a different constant offset from GS or FS). The original scope was limited but since then the rewrites have gotten out of control. Sometimes GS is rewritten, sometimes FS. Some ports do other rewrites to enable shared libraries and other linking. At no point in the code is it clear whether you are looking at the real GS/FS or some synthesized thing that will be rewritten. The code manipulating all these is duplicated in many places. The first step to fixing issue 7719 is to make the code intelligible again. This CL adds an explicit TLS pseudo-register to the 386 and amd64. 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. Liblink 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. Obviously it is late to be making changes like this, but I despair of correcting issue 7719 and issue 7164 without it. To make sure I am not changing existing behavior, I built a "hello world" program for every GOOS/GOARCH combination we have and then worked to make sure that the rewrite generates exactly the same binaries, byte for byte. There are a handful of TODOs in the code marking kludges to get the byte-for-byte property, but at least now I can explain exactly how each binary is handled. The targets I tested this way are: darwin-386 darwin-amd64 dragonfly-386 dragonfly-amd64 freebsd-386 freebsd-amd64 freebsd-arm linux-386 linux-amd64 linux-arm nacl-386 nacl-amd64p32 netbsd-386 netbsd-amd64 openbsd-386 openbsd-amd64 plan9-386 plan9-amd64 solaris-amd64 windows-386 windows-amd64 There were four exceptions to the byte-for-byte goal: windows-386 and windows-amd64 have a time stamp at bytes 137 and 138 of the header. darwin-386 and plan9-386 have five or six modified bytes in the middle of the Go symbol table, caused by editing comments in runtime/sys_{darwin,plan9}_386.s. Fixes issue 7164. LGTM=iant R=iant, aram, minux.ma, dave CC=golang-codereviews https://codereview.appspot.com/87920043
* liblink: remove arch-specific constants from file formatRuss Cox2014-04-141-2/+24
| | | | | | | | | | | | | | | | The relocation and automatic variable types were using arch-specific numbers. Introduce portable enumerations instead. To the best of my knowledge, these are the only arch-specific bits left in the new object file format. Remove now, before Go 1.3, because file formats are forever. LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/87670044
* cmd/prof, libmach: deleteRuss Cox2014-04-149-763/+0
| | | | | | | | | | | | | | | We have never released cmd/prof and don't plan to. Now that nm, addr2line, and objdump have been rewritten in Go, cmd/prof is the only thing keeping us from deleting libmach. Delete cmd/prof, and then since nothing is using libmach, delete libmach. 13,000 lines of C deleted. LGTM=minux.ma R=golang-codereviews, minux.ma CC=golang-codereviews, iant, r https://codereview.appspot.com/87020044
* libbio, libmach: warnings from the Plan 9 tool chainLucio De Re2014-04-071-1/+1
| | | | | | | | | | | | | Superficial inconsistencies that trigger warnings in Plan 9. Small enough to be considered trivial and seemingly benign outside of the Plan 9 environment. LGTM=iant R=golang-codereviews, 0intro, iant CC=golang-codereviews https://codereview.appspot.com/73460043 Committer: Ian Lance Taylor <iant@golang.org>
* cmd/ld: clear unused ctxt before morestackRuss Cox2014-03-041-1/+1
| | | | | | | | | | | | | | | | | | For non-closure functions, the context register is uninitialized on entry and will not be used, but morestack saves it and then the garbage collector treats it as live. This can be a source of memory leaks if the context register points at otherwise dead memory. Avoid this by introducing a parallel set of morestack functions that clear the context register, and use those for the non-closure functions. I hope this will help with some of the finalizer flakiness, but it probably won't. Fixes issue 7244. LGTM=dvyukov R=khr, dvyukov CC=golang-codereviews https://codereview.appspot.com/71030044
* all: final merge of NaCl treeRuss Cox2014-02-271-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL replays the following one CL from the rsc-go13nacl repo. This is the last replay CL: after this CL the main repo will have everything the rsc-go13nacl repo did. Changes made to the main repo after the rsc-go13nacl repo branched off probably mean that NaCl doesn't actually work after this CL, but all the code is now moved over and just needs to be redebugged. --- cmd/6l, cmd/8l, cmd/ld: support for Native Client See golang.org/s/go13nacl for design overview. This CL is publicly visible but not CC'ed to golang-dev, to avoid distracting from the preparation of the Go 1.2 release. This CL and the others will be checked into my rsc-go13nacl clone repo for now, and I will send CLs against the main repo early in the Go 1.3 development. R?khr https://codereview.appspot.com/15750044 --- LGTM=bradfitz, dave, iant R=dave, bradfitz, iant CC=golang-codereviews https://codereview.appspot.com/69040044
* include: fix comment in link.hIan Lance Taylor2014-02-261-1/+1
| | | | | | | LGTM=dave, rsc R=rsc, dave CC=golang-codereviews https://codereview.appspot.com/68960044
* cmd/gc: correct liveness for fat variablesRuss Cox2014-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VARDEF placement must be before the initialization but after any final use. If you have something like s = ... using s ... the rhs must be evaluated, then the VARDEF, then the lhs assigned. There is a large comment in pgen.c on gvardef explaining this in more detail. This CL also includes Ian's suggestions from earlier CLs, namely commenting the use of mode in link.h and fixing the precedence of the ~r check in dcl.c. This CL enables the check that if liveness analysis decides a variable is live on entry to the function, that variable must be a function parameter (not a result, and not a local variable). If this check fails, it indicates a bug in the liveness analysis or in the generated code being analyzed. The race detector generates invalid code for append(x, y...). The code declares a temporary t and then uses cap(t) before initializing t. The new liveness check catches this bug and stops the compiler from writing out the buggy code. Consequently, this CL disables the race detector tests in run.bash until the race detector bug can be fixed (golang.org/issue/7334). Except for the race detector bug, the liveness analysis check does not detect any problems (this CL and the previous CLs fixed all the detected problems). The net test still fails with GOGC=0 but the rest of the tests now pass or time out (because GOGC=0 is so slow). TBR=iant CC=golang-codereviews https://codereview.appspot.com/64170043
* lib9: enable on Plan 9David du Colombier2014-02-136-1/+98
| | | | | | | | | This change depends on CL 57170052. LGTM=rsc R=rsc, bradfitz CC=golang-codereviews https://codereview.appspot.com/60840049
* cmd/cc, cmd/gc, cmd/ld: consolidate print format routinesAnthony Martin2014-02-122-13/+10
| | | | | | | | | | | | | | | We now use the %A, %D, %P, and %R routines from liblink across the board. Fixes issue 7178. Fixes issue 7055. LGTM=iant R=golang-codereviews, gobot, rsc, dave, iant, remyoudompheng CC=golang-codereviews https://codereview.appspot.com/49170043 Committer: Russ Cox <rsc@golang.org>
* include, linlink, cmd/6l, cmd/ld: part 1 of solaris/amd64 linker changes.Shenghou Ma2014-02-091-0/+1
| | | | | | | | | | rsc suggested that we split the whole linker changes into three parts. This is the first one, mostly dealing with adding Hsolaris. LGTM=iant R=golang-codereviews, iant, dave CC=golang-codereviews https://codereview.appspot.com/54210050
* liblink: include missing pragmas for plan9 formatterJeff Sickel2014-01-221-0/+12
| | | | | | | | R=rsc, r, 0intro CC=golang-codereviews https://codereview.appspot.com/36060047 Committer: David du Colombier <0intro@gmail.com>
* liblink: check for symgrow size too largeIan Lance Taylor2014-01-211-1/+1
| | | | | | | | | | Many calls to symgrow pass a vlong value. Change the function to not implicitly truncate, and to instead give an error if the value is too large. R=golang-codereviews, gobot, rsc CC=golang-codereviews https://codereview.appspot.com/54010043
* libmach: use different names for different Ureg typesRuss Cox2014-01-083-3/+6
| | | | | | | | | Everything was doing this already with #defines. Do it right. R=golang-codereviews, jsing, 0intro, iant CC=golang-codereviews https://codereview.appspot.com/49090043
* libmach: use Go's ureg headers on Plan 9David du Colombier2014-01-083-3/+3
| | | | | | | | | | | The CL 49090043 renamed Ureg structures to Ureg386, UregArm and UregAmd64. This broke build on Plan 9, since ureg_x86.h includes /386/include/ureg.h, which declares a structure named Ureg instead of Ureg386. R=golang-codereviews, bradfitz CC=golang-codereviews, rsc https://codereview.appspot.com/49260043
* liblink: use explicit field for globl duplicate detectionRuss Cox2013-12-181-0/+1
| | | | | | | | | Overloading size leads to problems if clients try to set up an LSym by hand. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/44140043
* cmd/ld: move instruction selection + layout into compilers, assemblersRuss Cox2013-12-161-45/+37
| | | | | | | | | | | | | | | | | | | | | - new object file reader/writer (liblink/objfile.c) - remove old object file writing routines - add pcdata iterator - remove all trace of "line number stack" and "path fragments" from object files, linker (!!!) - dwarf now writes a single "compilation unit" instead of one per package This CL disables the check for chains of no-split functions that could overflow the stack red zone. A future CL will attack the problem of reenabling that check (issue 6931). This CL is just the liblink and cmd/ld changes. There are minor associated adjustments in CL 37030045. Each depends on the other. R=golang-dev, dave, iant CC=golang-dev https://codereview.appspot.com/39680043
* liblink, cmd/gc: fix incompatible type signatures on Plan 9David du Colombier2013-12-101-0/+6
| | | | | | | | R=ality, golang-dev, r, rsc CC=golang-dev https://codereview.appspot.com/39640043 Committer: Russ Cox <rsc@golang.org>
* build: do not use the host's libbio on Plan 9Anthony Martin2013-12-092-2/+8
| | | | | | | | R=jas, lucio.dere, rsc CC=golang-dev https://codereview.appspot.com/14604047 Committer: Russ Cox <rsc@golang.org>
* liblink: fix Plan 9 buildDavid du Colombier2013-12-093-0/+9
| | | | | | | | R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/39280043 Committer: Russ Cox <rsc@golang.org>
* liblink: create new library based on linker codeRuss Cox2013-12-082-0/+569
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an enormous amount of code moving around in this CL, but the code is the same, and it is invoked in the same ways. This CL is preparation for the new linker structure, not the new structure itself. The new library's definition is in include/link.h. The main change is the use of a Link structure to hold all the linker-relevant state, replacing the smattering of global variables. The Link structure should both make it clearer which state must be carried around and make it possible to parallelize more easily later. The main body of the linker has moved into the architecture-independent cmd/ld directory. That includes the list of known header types, so the distinction between Hplan9x32 and Hplan9x64 is removed (no other header type distinguished 32- and 64-bit formats), and code for unused formats such as ipaq kernels has been deleted. The code being deleted from 5l, 6l, and 8l reappears in liblink or in ld. Because multiple files are being merged in the liblink directory, it is not possible to show the diffs nicely in hg. The Prog and Addr structures have been unified into an architecture-independent form and moved to link.h, where they will be shared by all tools: the assemblers, the compilers, and the linkers. The unification makes it possible to write architecture-independent traversal of Prog lists, among other benefits. The Sym structures cannot be unified: they are too fundamentally different between the linker and the compilers. Instead, liblink defines an LSym - a linker Sym - to be used in the Prog and Addr structures, and the linker now refers exclusively to LSyms. The compilers will keep using their own syms but will fill out the corresponding LSyms in the Prog and Addr structures. Although code from 5l, 6l, and 8l is now in a single library, the code has been arranged so that only one architecture needs to be linked into a particular program: 5l will not contain the code needed for x86 instruction layout, for example. The object file writing code in liblink/obj.c is from cmd/gc/obj.c. Preparation for golang.org/s/go13linker work. This CL does not build by itself. It depends on 35740044 and will be submitted at the same time. R=iant CC=golang-dev https://codereview.appspot.com/35790044
* build: remove various uses of C undefined behaviorRuss Cox2013-09-091-1/+1
| | | | | | | | | | | | | | | | | | If you thought gcc -ansi -pedantic was pedantic, just wait until you meet clang -fsanitize=undefined. I think this addresses all the reported "errors", but we'll need another run to be sure. all.bash still passes. Update issue 5764 Dave, can you please try again? R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/13334049
* libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/BputcDmitriy Vyukov2013-08-301-2/+24
| | | | | | | | | | | | | | | | | | | Also introduce BGET2/4, BPUT2/4 as they are widely used. Slightly improve BGETC/BPUTC implementation. This gives ~5% CPU time improvement on go install -a -p1 std. Before: real user sys 0m23.561s 0m16.625s 0m5.848s 0m23.766s 0m16.624s 0m5.846s 0m23.742s 0m16.621s 0m5.868s after: 0m22.999s 0m15.841s 0m5.889s 0m22.845s 0m15.808s 0m5.850s 0m22.889s 0m15.832s 0m5.848s R=golang-dev, r CC=golang-dev https://codereview.appspot.com/12745047
* include/plan9: define size_t to fix build breakageIan Lance Taylor2013-06-281-0/+4
| | | | | | R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/10760043
* build: add intptr typedef for Plan 9Anthony Martin2013-06-043-24/+27
| | | | | | | | | | | | | | | | | | | | | | Revision 01810e5c68e9 added the following to src/pkg/runtime/stack.h: StackPreempt = (uintptr)(intptr)0xffffade, The typedef for intptr is defined in two places: 1. src/pkg/runtime/runtime.h for use by the runtime 2. include/u.h for use by the compilers and linkers On Plan 9, we don't use include/u.h but instead augment the host's u.h with extra typedefs. These are in include/plan9/GOARCH/u.h. We forgot to add intptr. It didn't cause a problem until now since that typedef was never used outside the runtime. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/10023043
* build: remove special definition of Runemax on Plan 9Anthony Martin2013-06-011-7/+0
| | | | | | | | The Bell Labs distribution now supports 21-bit runes. R=golang-dev, akumar CC=golang-dev https://codereview.appspot.com/9249045
* include: add a README fileShenghou Ma2013-05-221-0/+6
| | | | | | R=golang-dev, r CC=golang-dev https://codereview.appspot.com/9392049
* include/plan9/libc.h: fix Plan 9 buildDavid du Colombier2013-03-301-0/+1
| | | | | | | | | | | | Add missing getgoextlinkenabled(void) declaration in Plan 9 libc.h. This function was added as part of CL #8183043. R=golang-dev, minux.ma CC=golang-dev https://codereview.appspot.com/8191043 Committer: Shenghou Ma <minux.ma@gmail.com>
* cmd/dist, cmd/ld: GO_EXTLINK_ENABLED=0 defaults to -linkmode=internalIan Lance Taylor2013-03-291-0/+1
| | | | | | | | | | | | Change build system to set GO_EXTLINK_ENABLED=0 by default for OS X 10.6, since the system linker has a bug and can not handle the object files generated by 6l. Fixes issue 5130. R=golang-dev, r CC=golang-dev https://codereview.appspot.com/8183043
* build: fix for 32-bit windows builds on 64-bit windows systemRuss Cox2013-03-151-1/+1
| | | | | | | | | | Thanks to jon.forums@ for the fix. Fixes issue 5051. R=golang-dev, minux.ma CC=golang-dev https://codereview.appspot.com/7813045
* lib9: add mktempdir, removeall, runprogRuss Cox2013-03-061-0/+4
| | | | | | R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/7523043
* build: clang supportRuss Cox2013-02-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | This works with at least one version of clang that existed at one moment in time. No guarantees about clangs past or future. To try: CC=clang all.bash It does not work with the Xcode clang, because that clang fails at printing a useful answer to: clang -print-libgcc-file-name The clang that works prints a full path name for that command, not just "libgcc.a". Fixes issue 4713. R=iant, minux.ma CC=golang-dev https://codereview.appspot.com/7323068
* include: Plan 9: hide any previous definition of RunemaxAkshat Kumar2013-01-301-0/+2
| | | | | | | | | | | | | Runemax is already defined in libc on 64-bit version of Plan 9, but is not defined on other versions. To accommodate, we make sure to rename any previous instance of Runemax and re-define it subsequently. R=rsc, ality, rminnich CC=golang-dev https://codereview.appspot.com/7232059 Committer: Russ Cox <rsc@golang.org>
* build: add missing function declarations for Plan 9Lucio De Re2013-01-111-0/+12
| | | | | | | | R=golang-dev, minux.ma, rsc, ality, seed CC=golang-dev https://codereview.appspot.com/7034052 Committer: Anthony Martin <ality@pbrane.org>
* cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsingRuss Cox2013-01-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds a flag parser that matches the semantics of Go's package flag. It also changes the linkers and compilers to use the new flag parser. Command lines that used to work, like 8c -FVw 6c -Dfoo 5g -I/foo/bar now need to be split into separate arguments: 8c -F -V -w 6c -D foo 5g -I /foo/bar The new spacing will work with both old and new tools. The new parser also allows = for arguments, as in 6c -D=foo 5g -I=/foo/bar but that syntax will not work with the old tools. In addition to matching standard Go binary flag parsing, the new flag parser generates more detailed usage messages and opens the door to long flag names. The recently added gc flag -= has been renamed -complete. R=remyoudompheng, daniel.morsing, minux.ma, iant CC=golang-dev https://codereview.appspot.com/7035043
* cmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.R?my Oudompheng2013-01-021-0/+1
| | | | | | | | | | | | | | | A new environment variable GO386 is introduced to choose between code generation targeting 387 or SSE2. No auto-detection is performed and the setting defaults to 387 to preserve previous behaviour. The patch is a reorganization of CL6549052 by rsc. Fixes issue 3912. R=minux.ma, rsc CC=golang-dev https://codereview.appspot.com/6962043
* lib9: remove unreferenced externs and getuser()Carl Mastrangelo2012-11-081-4/+0
| | | | | | | | R=golang-dev, dave, rsc CC=golang-dev http://codereview.appspot.com/6820115 Committer: Russ Cox <rsc@golang.org>